| 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" { |
| 11 |
pub fn WindowsCreateString( |
| 12 |
sourceString: PCWSTR, |
| 13 |
length: UINT32, |
| 14 |
string: *mut HSTRING, |
| 15 |
) -> HRESULT; |
| 16 |
pub fn WindowsCreateStringReference( |
| 17 |
sourceString: PCWSTR, |
| 18 |
length: UINT32, |
| 19 |
hstringHeader: *mut HSTRING_HEADER, |
| 20 |
string: *mut HSTRING, |
| 21 |
) -> HRESULT; |
| 22 |
pub fn WindowsDeleteString( |
| 23 |
string: HSTRING, |
| 24 |
) -> HRESULT; |
| 25 |
pub fn WindowsDuplicateString( |
| 26 |
string: HSTRING, |
| 27 |
newString: *mut HSTRING, |
| 28 |
) -> HRESULT; |
| 29 |
pub fn WindowsGetStringLen( |
| 30 |
string: HSTRING, |
| 31 |
) -> UINT32; |
| 32 |
pub fn WindowsGetStringRawBuffer( |
| 33 |
string: HSTRING, |
| 34 |
length: *mut UINT32, |
| 35 |
) -> PCWSTR; |
| 36 |
pub fn WindowsIsStringEmpty( |
| 37 |
string: HSTRING, |
| 38 |
) -> BOOL; |
| 39 |
pub fn WindowsStringHasEmbeddedNull( |
| 40 |
string: HSTRING, |
| 41 |
hasEmbedNull: *mut BOOL, |
| 42 |
) -> HRESULT; |
| 43 |
pub fn WindowsCompareStringOrdinal( |
| 44 |
string1: HSTRING, |
| 45 |
string2: HSTRING, |
| 46 |
result: *mut INT32, |
| 47 |
) -> HRESULT; |
| 48 |
pub fn WindowsSubstring( |
| 49 |
string: HSTRING, |
| 50 |
startIndex: UINT32, |
| 51 |
newString: *mut HSTRING, |
| 52 |
) -> HSTRING; |
| 53 |
pub fn WindowsSubstringWithSpecifiedLength( |
| 54 |
string: HSTRING, |
| 55 |
startIndex: UINT32, |
| 56 |
length: UINT32, |
| 57 |
newString: *mut HSTRING, |
| 58 |
) -> HRESULT; |
| 59 |
pub fn WindowsConcatString( |
| 60 |
string1: HSTRING, |
| 61 |
string2: HSTRING, |
| 62 |
newString: *mut HSTRING, |
| 63 |
) -> HRESULT; |
| 64 |
pub fn WindowsReplaceString( |
| 65 |
string: HSTRING, |
| 66 |
stringReplaced: HSTRING, |
| 67 |
stringReplaceWith: HSTRING, |
| 68 |
newString: *mut HSTRING, |
| 69 |
) -> HRESULT; |
| 70 |
pub fn WindowsTrimStringStart( |
| 71 |
string: HSTRING, |
| 72 |
trimString: HSTRING, |
| 73 |
newString: *mut HSTRING, |
| 74 |
) -> HRESULT; |
| 75 |
pub fn WindowsTrimStringEnd( |
| 76 |
string: HSTRING, |
| 77 |
trimString: HSTRING, |
| 78 |
newString: *mut HSTRING, |
| 79 |
) -> HRESULT; |
| 80 |
pub fn WindowsPreallocateStringBuffer( |
| 81 |
length: UINT32, |
| 82 |
charBuffer: *mut *mut WCHAR, |
| 83 |
bufferHandle: *mut HSTRING_BUFFER, |
| 84 |
) -> HRESULT; |
| 85 |
pub fn WindowsPromoteStringBuffer( |
| 86 |
bufferHandle: HSTRING_BUFFER, |
| 87 |
string: *mut HSTRING, |
| 88 |
) -> HRESULT; |
| 89 |
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" { |
| 100 |
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; |
| 108 |
pub fn HSTRING_UserSize( |
| 109 |
pFlags: *const ULONG, |
| 110 |
StartingSize: ULONG, |
| 111 |
ppidl: *const HSTRING, |
| 112 |
) -> ULONG; |
| 113 |
pub fn HSTRING_UserMarshal( |
| 114 |
pFlags: *const ULONG, |
| 115 |
pBuffer: *mut UCHAR, |
| 116 |
ppidl: *const HSTRING, |
| 117 |
) -> *mut UCHAR; |
| 118 |
pub fn HSTRING_UserUnmarshal( |
| 119 |
pFlags: *const ULONG, |
| 120 |
pBuffer: *const UCHAR, |
| 121 |
ppidl: *mut HSTRING, |
| 122 |
) -> *mut UCHAR; |
| 123 |
pub fn HSTRING_UserFree( |
| 124 |
pFlags: *const ULONG, |
| 125 |
ppidl: *const HSTRING, |
| 126 |
); |
| 127 |
#[cfg(target_arch = "x86_64")] |
| 128 |
pub fn HSTRING_UserSize64( |
| 129 |
pFlags: *const ULONG, |
| 130 |
StartingSize: ULONG, |
| 131 |
ppidl: *const HSTRING, |
| 132 |
) -> ULONG; |
| 133 |
#[cfg(target_arch = "x86_64")] |
| 134 |
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")] |
| 140 |
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")] |
| 146 |
pub fn HSTRING_UserFree64( |
| 147 |
pFlags: *const ULONG, |
| 148 |
ppidl: *const HSTRING, |
| 149 |
); |
| 150 |
} |