version 1.5.3
This commit is contained in:
commit
61a794d0fb
22
wepoll.c
22
wepoll.c
@ -925,6 +925,18 @@ int init(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set up a workaround for the following problem:
|
||||||
|
* FARPROC addr = GetProcAddress(...);
|
||||||
|
* MY_FUNC func = (MY_FUNC) addr; <-- GCC 8 warning/error.
|
||||||
|
* MY_FUNC func = (MY_FUNC) (void*) addr; <-- MSVC warning/error.
|
||||||
|
* To compile cleanly with either compiler, do casts with this "bridge" type:
|
||||||
|
* MY_FUNC func = (MY_FUNC) (nt__fn_ptr_cast_t) addr; */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
typedef void* nt__fn_ptr_cast_t;
|
||||||
|
#else
|
||||||
|
typedef FARPROC nt__fn_ptr_cast_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define X(return_type, attributes, name, parameters) \
|
#define X(return_type, attributes, name, parameters) \
|
||||||
WEPOLL_INTERNAL return_type(attributes* name) parameters = NULL;
|
WEPOLL_INTERNAL return_type(attributes* name) parameters = NULL;
|
||||||
NT_NTDLL_IMPORT_LIST(X)
|
NT_NTDLL_IMPORT_LIST(X)
|
||||||
@ -932,15 +944,17 @@ NT_NTDLL_IMPORT_LIST(X)
|
|||||||
|
|
||||||
int nt_global_init(void) {
|
int nt_global_init(void) {
|
||||||
HMODULE ntdll;
|
HMODULE ntdll;
|
||||||
|
FARPROC fn_ptr;
|
||||||
|
|
||||||
ntdll = GetModuleHandleW(L"ntdll.dll");
|
ntdll = GetModuleHandleW(L"ntdll.dll");
|
||||||
if (ntdll == NULL)
|
if (ntdll == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#define X(return_type, attributes, name, parameters) \
|
#define X(return_type, attributes, name, parameters) \
|
||||||
name = (return_type(attributes*) parameters) GetProcAddress(ntdll, #name); \
|
fn_ptr = GetProcAddress(ntdll, #name); \
|
||||||
if (name == NULL) \
|
if (fn_ptr == NULL) \
|
||||||
return -1;
|
return -1; \
|
||||||
|
name = (return_type(attributes*) parameters)(nt__fn_ptr_cast_t) fn_ptr;
|
||||||
NT_NTDLL_IMPORT_LIST(X)
|
NT_NTDLL_IMPORT_LIST(X)
|
||||||
#undef X
|
#undef X
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user