summaryrefslogtreecommitdiffstats
path: root/third_party/rust/winapi/src/winrt/winstring.rs
blob: ecbfcdf2a621d8dcaada8f45d0278f04e45321a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use shared::basetsd::{INT32, UINT32, UINT_PTR};
use shared::minwindef::{BOOL, BYTE, UCHAR, ULONG, USHORT};
use um::winnt::{HRESULT, PCWSTR, VOID, WCHAR};
use winrt::hstring::{HSTRING, HSTRING_BUFFER, HSTRING_HEADER};
extern "system" {
    pub fn WindowsCreateString(
        sourceString: PCWSTR,
        length: UINT32,
        string: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsCreateStringReference(
        sourceString: PCWSTR,
        length: UINT32,
        hstringHeader: *mut HSTRING_HEADER,
        string: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsDeleteString(
        string: HSTRING,
    ) -> HRESULT;
    pub fn WindowsDuplicateString(
        string: HSTRING,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsGetStringLen(
        string: HSTRING,
    ) -> UINT32;
    pub fn WindowsGetStringRawBuffer(
        string: HSTRING,
        length: *mut UINT32,
    ) -> PCWSTR;
    pub fn WindowsIsStringEmpty(
        string: HSTRING,
    ) -> BOOL;
    pub fn WindowsStringHasEmbeddedNull(
        string: HSTRING,
        hasEmbedNull: *mut BOOL,
    ) -> HRESULT;
    pub fn WindowsCompareStringOrdinal(
        string1: HSTRING,
        string2: HSTRING,
        result: *mut INT32,
    ) -> HRESULT;
    pub fn WindowsSubstring(
        string: HSTRING,
        startIndex: UINT32,
        newString: *mut HSTRING,
    ) -> HSTRING;
    pub fn WindowsSubstringWithSpecifiedLength(
        string: HSTRING,
        startIndex: UINT32,
        length: UINT32,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsConcatString(
        string1: HSTRING,
        string2: HSTRING,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsReplaceString(
        string: HSTRING,
        stringReplaced: HSTRING,
        stringReplaceWith: HSTRING,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsTrimStringStart(
        string: HSTRING,
        trimString: HSTRING,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsTrimStringEnd(
        string: HSTRING,
        trimString: HSTRING,
        newString: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsPreallocateStringBuffer(
        length: UINT32,
        charBuffer: *mut *mut WCHAR,
        bufferHandle: *mut HSTRING_BUFFER,
    ) -> HRESULT;
    pub fn WindowsPromoteStringBuffer(
        bufferHandle: HSTRING_BUFFER,
        string: *mut HSTRING,
    ) -> HRESULT;
    pub fn WindowsDeleteStringBuffer(
        bufferHandle: HSTRING_BUFFER,
    ) -> HRESULT;
}
FN!{stdcall PINSPECT_HSTRING_CALLBACK(
    *const VOID,
    UINT_PTR,
    UINT32,
    *mut BYTE,
) -> HRESULT}
extern "system" {
    pub fn WindowsInspectString(
        targetHString: UINT_PTR,
        machine: USHORT,
        callback: PINSPECT_HSTRING_CALLBACK,
        context: *const VOID,
        length: *mut UINT32,
        targetStringAddress: *mut UINT_PTR,
    ) -> HRESULT;
    pub fn HSTRING_UserSize(
        pFlags: *const ULONG,
        StartingSize: ULONG,
        ppidl: *const HSTRING,
    ) -> ULONG;
    pub fn HSTRING_UserMarshal(
        pFlags: *const ULONG,
        pBuffer: *mut UCHAR,
        ppidl: *const HSTRING,
    ) -> *mut UCHAR;
    pub fn HSTRING_UserUnmarshal(
        pFlags: *const ULONG,
        pBuffer: *const UCHAR,
        ppidl: *mut HSTRING,
    ) -> *mut UCHAR;
    pub fn HSTRING_UserFree(
        pFlags: *const ULONG,
        ppidl: *const HSTRING,
    );
    #[cfg(target_arch = "x86_64")]
    pub fn HSTRING_UserSize64(
        pFlags: *const ULONG,
        StartingSize: ULONG,
        ppidl: *const HSTRING,
    ) -> ULONG;
    #[cfg(target_arch = "x86_64")]
    pub fn HSTRING_UserMarshal64(
        pFlags: *const ULONG,
        pBuffer: *mut UCHAR,
        ppidl: *const HSTRING,
    ) -> *mut UCHAR;
    #[cfg(target_arch = "x86_64")]
    pub fn HSTRING_UserUnmarshal64(
        pFlags: *const ULONG,
        pBuffer: *const UCHAR,
        ppidl: *mut HSTRING,
    ) -> *mut UCHAR;
    #[cfg(target_arch = "x86_64")]
    pub fn HSTRING_UserFree64(
        pFlags: *const ULONG,
        ppidl: *const HSTRING,
    );
}