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 //! ApiSet Contract for api-ms-win-core-libraryloader-l1 7 use ctypes::c_int; 8 use shared::basetsd::LONG_PTR; 9 use shared::minwindef::{ 10 BOOL, DWORD, FARPROC, HGLOBAL, HINSTANCE, HMODULE, HRSRC, LPVOID, UINT, WORD 11 }; 12 use um::winnt::{HANDLE, LANGID, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PCWSTR, PVOID}; 13 pub const GET_MODULE_HANDLE_EX_FLAG_PIN: DWORD = 0x00000001; 14 pub const GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT: DWORD = 0x00000002; 15 pub const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS: DWORD = 0x00000004; 16 pub const DONT_RESOLVE_DLL_REFERENCES: DWORD = 0x00000001; 17 pub const LOAD_LIBRARY_AS_DATAFILE: DWORD = 0x00000002; 18 pub const LOAD_WITH_ALTERED_SEARCH_PATH: DWORD = 0x00000008; 19 pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL: DWORD = 0x00000010; 20 pub const LOAD_LIBRARY_AS_IMAGE_RESOURCE: DWORD = 0x00000020; 21 pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: DWORD = 0x00000040; 22 pub const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: DWORD = 0x00000080; 23 pub const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: DWORD = 0x00000100; 24 pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: DWORD = 0x00000200; 25 pub const LOAD_LIBRARY_SEARCH_USER_DIRS: DWORD = 0x00000400; 26 pub const LOAD_LIBRARY_SEARCH_SYSTEM32: DWORD = 0x00000800; 27 pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: DWORD = 0x00001000; 28 pub const LOAD_LIBRARY_SAFE_CURRENT_DIRS: DWORD = 0x00002000; 29 pub const LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER: DWORD = 0x00004000; 30 pub const LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY: DWORD = 0x00008000; 31 FN!{stdcall ENUMRESLANGPROCA( 32 hModule: HMODULE, 33 lpType: LPCSTR, 34 lpName: LPCSTR, 35 wLanguage: WORD, 36 lParam: LONG_PTR, 37 ) -> BOOL} 38 FN!{stdcall ENUMRESLANGPROCW( 39 hModule: HMODULE, 40 lpType: LPCWSTR, 41 lpName: LPCWSTR, 42 wLanguage: WORD, 43 lParam: LONG_PTR, 44 ) -> BOOL} 45 FN!{stdcall ENUMRESNAMEPROCA( 46 hModule: HMODULE, 47 lpType: LPCSTR, 48 lpName: LPSTR, 49 lParam: LONG_PTR, 50 ) -> BOOL} 51 FN!{stdcall ENUMRESNAMEPROCW( 52 hModule: HMODULE, 53 lpType: LPCWSTR, 54 lpName: LPWSTR, 55 lParam: LONG_PTR, 56 ) -> BOOL} 57 FN!{stdcall ENUMRESTYPEPROCA( 58 hModule: HMODULE, 59 lpType: LPSTR, 60 lParam: LONG_PTR, 61 ) -> BOOL} 62 FN!{stdcall ENUMRESTYPEPROCW( 63 hModule: HMODULE, 64 lpType: LPWSTR, 65 lParam: LONG_PTR, 66 ) -> BOOL} 67 extern "system" { DisableThreadLibraryCalls( hLibModule: HMODULE, ) -> BOOL68 pub fn DisableThreadLibraryCalls( 69 hLibModule: HMODULE, 70 ) -> BOOL; FindResourceExW( hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR, wLanguage: WORD, ) -> HRSRC71 pub fn FindResourceExW( 72 hModule: HMODULE, 73 lpName: LPCWSTR, 74 lpType: LPCWSTR, 75 wLanguage: WORD, 76 ) -> HRSRC; FindStringOrdinal( dwFindStringOrdinalFlags: DWORD, lpStringSource: LPCWSTR, cchSource: c_int, lpStringValue: LPCWSTR, cchValue: c_int, bIgnoreCase: BOOL, ) -> c_int77 pub fn FindStringOrdinal( 78 dwFindStringOrdinalFlags: DWORD, 79 lpStringSource: LPCWSTR, 80 cchSource: c_int, 81 lpStringValue: LPCWSTR, 82 cchValue: c_int, 83 bIgnoreCase: BOOL, 84 ) -> c_int; FreeLibrary( hLibModule: HMODULE, ) -> BOOL85 pub fn FreeLibrary( 86 hLibModule: HMODULE, 87 ) -> BOOL; FreeLibraryAndExitThread( hLibModule: HMODULE, dwExitCode: DWORD, )88 pub fn FreeLibraryAndExitThread( 89 hLibModule: HMODULE, 90 dwExitCode: DWORD, 91 ); FreeResource( hResData: HGLOBAL, ) -> BOOL92 pub fn FreeResource( 93 hResData: HGLOBAL, 94 ) -> BOOL; GetModuleFileNameA( hModule: HMODULE, lpFilename: LPSTR, nSize: DWORD, ) -> DWORD95 pub fn GetModuleFileNameA( 96 hModule: HMODULE, 97 lpFilename: LPSTR, 98 nSize: DWORD, 99 ) -> DWORD; GetModuleFileNameW( hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD, ) -> DWORD100 pub fn GetModuleFileNameW( 101 hModule: HMODULE, 102 lpFilename: LPWSTR, 103 nSize: DWORD, 104 ) -> DWORD; GetModuleHandleA( lpModuleName: LPCSTR, ) -> HMODULE105 pub fn GetModuleHandleA( 106 lpModuleName: LPCSTR, 107 ) -> HMODULE; GetModuleHandleW( lpModuleName: LPCWSTR, ) -> HMODULE108 pub fn GetModuleHandleW( 109 lpModuleName: LPCWSTR, 110 ) -> HMODULE; GetModuleHandleExA( dwFlags: DWORD, lpModuleName: LPCSTR, phModule: *mut HMODULE, ) -> BOOL111 pub fn GetModuleHandleExA( 112 dwFlags: DWORD, 113 lpModuleName: LPCSTR, 114 phModule: *mut HMODULE, 115 ) -> BOOL; GetModuleHandleExW( dwFlags: DWORD, lpModuleName: LPCWSTR, phModule: *mut HMODULE, ) -> BOOL116 pub fn GetModuleHandleExW( 117 dwFlags: DWORD, 118 lpModuleName: LPCWSTR, 119 phModule: *mut HMODULE, 120 ) -> BOOL; GetProcAddress( hModule: HMODULE, lpProcName: LPCSTR, ) -> FARPROC121 pub fn GetProcAddress( 122 hModule: HMODULE, 123 lpProcName: LPCSTR, 124 ) -> FARPROC; LoadLibraryExA( lpLibFileName: LPCSTR, hFile: HANDLE, dwFlags: DWORD, ) -> HMODULE125 pub fn LoadLibraryExA( 126 lpLibFileName: LPCSTR, 127 hFile: HANDLE, 128 dwFlags: DWORD, 129 ) -> HMODULE; LoadLibraryExW( lpLibFileName: LPCWSTR, hFile: HANDLE, dwFlags: DWORD, ) -> HMODULE130 pub fn LoadLibraryExW( 131 lpLibFileName: LPCWSTR, 132 hFile: HANDLE, 133 dwFlags: DWORD, 134 ) -> HMODULE; LoadResource( hModule: HMODULE, hResInfo: HRSRC, ) -> HGLOBAL135 pub fn LoadResource( 136 hModule: HMODULE, 137 hResInfo: HRSRC, 138 ) -> HGLOBAL; LoadStringA( hInstance: HINSTANCE, uID: UINT, lpBuffer: LPSTR, cchBufferMax: c_int, ) -> c_int139 pub fn LoadStringA( 140 hInstance: HINSTANCE, 141 uID: UINT, 142 lpBuffer: LPSTR, 143 cchBufferMax: c_int, 144 ) -> c_int; LoadStringW( hInstance: HINSTANCE, uID: UINT, lpBuffer: LPWSTR, cchBufferMax: c_int, ) -> c_int145 pub fn LoadStringW( 146 hInstance: HINSTANCE, 147 uID: UINT, 148 lpBuffer: LPWSTR, 149 cchBufferMax: c_int, 150 ) -> c_int; LockResource( hResData: HGLOBAL, ) -> LPVOID151 pub fn LockResource( 152 hResData: HGLOBAL, 153 ) -> LPVOID; SizeofResource( hModule: HMODULE, hResInfo: HRSRC, ) -> DWORD154 pub fn SizeofResource( 155 hModule: HMODULE, 156 hResInfo: HRSRC, 157 ) -> DWORD; 158 } 159 pub type DLL_DIRECTORY_COOKIE = PVOID; 160 pub type PDLL_DIRECTORY_COOKIE = *mut PVOID; 161 extern "system" { AddDllDirectory( NewDirectory: PCWSTR, ) -> DLL_DIRECTORY_COOKIE162 pub fn AddDllDirectory( 163 NewDirectory: PCWSTR, 164 ) -> DLL_DIRECTORY_COOKIE; RemoveDllDirectory( Cookie: DLL_DIRECTORY_COOKIE, ) -> BOOL165 pub fn RemoveDllDirectory( 166 Cookie: DLL_DIRECTORY_COOKIE, 167 ) -> BOOL; SetDefaultDllDirectories( DirectoryFlags: DWORD, ) -> BOOL168 pub fn SetDefaultDllDirectories( 169 DirectoryFlags: DWORD, 170 ) -> BOOL; EnumResourceLanguagesExA( hModule: HMODULE, lpType: LPCSTR, lpName: LPCSTR, lpEnumFunc: ENUMRESLANGPROCA, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL171 pub fn EnumResourceLanguagesExA( 172 hModule: HMODULE, 173 lpType: LPCSTR, 174 lpName: LPCSTR, 175 lpEnumFunc: ENUMRESLANGPROCA, 176 lParam: LONG_PTR, 177 dwFlags: DWORD, 178 LangId: LANGID, 179 ) -> BOOL; EnumResourceLanguagesExW( hModule: HMODULE, lpType: LPCWSTR, lpName: LPCWSTR, lpEnumFunc: ENUMRESLANGPROCW, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL180 pub fn EnumResourceLanguagesExW( 181 hModule: HMODULE, 182 lpType: LPCWSTR, 183 lpName: LPCWSTR, 184 lpEnumFunc: ENUMRESLANGPROCW, 185 lParam: LONG_PTR, 186 dwFlags: DWORD, 187 LangId: LANGID, 188 ) -> BOOL; EnumResourceNamesExA( hModule: HMODULE, lpType: LPCSTR, lpEnumFunc: ENUMRESNAMEPROCA, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL189 pub fn EnumResourceNamesExA( 190 hModule: HMODULE, 191 lpType: LPCSTR, 192 lpEnumFunc: ENUMRESNAMEPROCA, 193 lParam: LONG_PTR, 194 dwFlags: DWORD, 195 LangId: LANGID, 196 ) -> BOOL; EnumResourceNamesExW( hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL197 pub fn EnumResourceNamesExW( 198 hModule: HMODULE, 199 lpType: LPCWSTR, 200 lpEnumFunc: ENUMRESNAMEPROCW, 201 lParam: LONG_PTR, 202 dwFlags: DWORD, 203 LangId: LANGID, 204 ) -> BOOL; EnumResourceTypesExA( hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCA, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL205 pub fn EnumResourceTypesExA( 206 hModule: HMODULE, 207 lpEnumFunc: ENUMRESTYPEPROCA, 208 lParam: LONG_PTR, 209 dwFlags: DWORD, 210 LangId: LANGID, 211 ) -> BOOL; EnumResourceTypesExW( hModule: HMODULE, lpEnumFunc: ENUMRESTYPEPROCW, lParam: LONG_PTR, dwFlags: DWORD, LangId: LANGID, ) -> BOOL212 pub fn EnumResourceTypesExW( 213 hModule: HMODULE, 214 lpEnumFunc: ENUMRESTYPEPROCW, 215 lParam: LONG_PTR, 216 dwFlags: DWORD, 217 LangId: LANGID, 218 ) -> BOOL; FindResourceW( hModule: HMODULE, lpName: LPCWSTR, lpType: LPCWSTR, ) -> HRSRC219 pub fn FindResourceW( 220 hModule: HMODULE, 221 lpName: LPCWSTR, 222 lpType: LPCWSTR, 223 ) -> HRSRC; LoadLibraryA( lpFileName: LPCSTR, ) -> HMODULE224 pub fn LoadLibraryA( 225 lpFileName: LPCSTR, 226 ) -> HMODULE; LoadLibraryW( lpFileName: LPCWSTR, ) -> HMODULE227 pub fn LoadLibraryW( 228 lpFileName: LPCWSTR, 229 ) -> HMODULE; EnumResourceNamesW( hModule: HMODULE, lpType: LPCWSTR, lpEnumFunc: ENUMRESNAMEPROCW, lParam: LONG_PTR, ) -> BOOL230 pub fn EnumResourceNamesW( 231 hModule: HMODULE, 232 lpType: LPCWSTR, 233 lpEnumFunc: ENUMRESNAMEPROCW, 234 lParam: LONG_PTR, 235 ) -> BOOL; 236 } 237