FreeRDP
library.h
1 
20 #ifndef WINPR_LIBRARY_H
21 #define WINPR_LIBRARY_H
22 
23 #include <winpr/winpr.h>
24 #include <winpr/wtypes.h>
25 
26 #if !defined(_WIN32) || defined(_UWP)
27 
28 typedef HANDLE DLL_DIRECTORY_COOKIE;
29 
30 #define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
31 #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
32 #define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
33 #define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
34 
35 #define DONT_RESOLVE_DLL_REFERENCES 0x00000001
36 #define LOAD_LIBRARY_AS_DATAFILE 0x00000002
37 #define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
38 #define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x00000010
39 #define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x00000020
40 #define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x00000040
41 #define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x00000100
42 #define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x00000200
43 #define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
44 #define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
45 #define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000
46 
47 #ifdef __cplusplus
48 extern "C"
49 {
50 #endif
51 
52  WINPR_API DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory);
53  WINPR_API BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie);
54  WINPR_API BOOL SetDefaultDllDirectories(DWORD DirectoryFlags);
55 
56  WINPR_API HMODULE LoadLibraryA(LPCSTR lpLibFileName);
57  WINPR_API HMODULE LoadLibraryW(LPCWSTR lpLibFileName);
58 
59  WINPR_API HMODULE LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
60  WINPR_API HMODULE LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #ifdef UNICODE
67 #define LoadLibrary LoadLibraryW
68 #define LoadLibraryEx LoadLibraryExW
69 #else
70 #define LoadLibrary LoadLibraryA
71 #define LoadLibraryEx LoadLibraryExA
72 #endif
73 
74 #endif
75 
76 #ifdef __cplusplus
77 extern "C"
78 {
79 #endif
80 
81  WINPR_API HMODULE LoadLibraryX(LPCSTR lpLibFileName);
82  WINPR_API HMODULE LoadLibraryExX(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
96 #define GetProcAddressAs(module, name, type) WINPR_FUNC_PTR_CAST(GetProcAddress(module, name), type)
97 
98 #if !defined(_WIN32) && !defined(__CYGWIN__)
99 
100 #ifdef __cplusplus
101 extern "C"
102 {
103 #endif
104 
105  WINPR_API HMODULE GetModuleHandleA(LPCSTR lpModuleName);
106  WINPR_API HMODULE GetModuleHandleW(LPCWSTR lpModuleName);
107 
108  WINPR_API DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
109  WINPR_API DWORD GetModuleFileNameW(HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
110 
111  WINPR_API FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
112 
113  WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #ifdef UNICODE
120 #define GetModuleHandle GetModuleHandleW
121 #define GetModuleFileName GetModuleFileNameW
122 #else
123 #define GetModuleHandle GetModuleHandleA
124 #define GetModuleFileName GetModuleFileNameA
125 #endif
126 
127 #endif
128 
129 #endif /* WINPR_LIBRARY_H */