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