ReactOS 0.4.16-dev-401-g45b008d
delayimp.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Tests for delayload
5 * PROGRAMMER: Mark Jansen
6 */
7
8#include <apitest.h>
9
10#include <apitest.h>
11#include <strsafe.h>
12#include <delayimp.h>
13
14/* Some libraries to test against */
15#include <mmsystem.h>
16#include <winver.h>
17#include <shlwapi.h>
18#include <intshcut.h>
19#include <sfc.h>
20#include <imagehlp.h>
21#include <mmddk.h>
22
23#include <pseh/pseh2.h>
24
25/* Compatibility with the MS defines */
26
27#ifndef FACILITY_VISUALCPP
28#define FACILITY_VISUALCPP ((LONG)0x6d)
29#endif
30
31#ifndef VcppException
32#define VcppException(sev,err) ((sev) | (FACILITY_VISUALCPP<<16) | err)
33#endif
34
35#ifdef __REACTOS__
36#define WINMM_DLLNAME "winmm.dll"
37#else
38#define WINMM_DLLNAME "WINMM.dll"
39#endif
40
43bool g_BypassMost = false;
45bool g_ImportByName = true;
46const char* g_ExpectedDll = NULL;
47const char* g_ExpectedName = NULL;
48char g_Target[100] = { 0 };
49
51{
52 if (g_Target[0] == '\0' && pdli)
53 {
54 if (pdli->dlp.fImportByName)
55 sprintf(g_Target, "%s!%s", pdli->szDll, pdli->dlp.szProcName);
56 else
57 sprintf(g_Target, "%s!#%lu", pdli->szDll, pdli->dlp.dwOrdinal);
58 }
59 return g_Target;
60}
61
62
64{
66 :mAddr(NULL), mProt(0)
67 {
68 if (IsBadWritePtr(addr, 1))
69 {
70 mAddr = addr;
72 }
73 }
75 {
76 DWORD dwOld;
77 if (mAddr)
78 VirtualProtect(mAddr, 1, mProt, &dwOld);
79 }
80
83};
84
85
87size_t g_DliHookIndex = 0;
88#define LAST_DLI 333
89
90static void SetExpectedDli(unsigned* order)
91{
94 g_Target[0] = '\0';
95}
96
97static void CheckDli_imp(unsigned dliNotify, PDelayLoadInfo pdli, BOOL ErrorHandler)
98{
99 if (!g_DliHookExpected) return;
100
101 winetest_ok(dliNotify == g_DliHookExpected[g_DliHookIndex], "Expected dliNotify to be %u, was: %u for %s\n",
102 g_DliHookExpected[g_DliHookIndex], dliNotify, target(pdli));
103 if (ErrorHandler)
104 {
105 winetest_ok(dliNotify == dliFailGetProc || dliNotify == dliFailLoadLib,
106 "Expected code %u to be processed by the Hook, not the ErrorHandler for %s\n", dliNotify, target(pdli));
107 }
108 else
109 {
110 winetest_ok(dliNotify == dliStartProcessing || dliNotify == dliNotePreLoadLibrary ||
111 dliNotify == dliNotePreGetProcAddress || dliNotify == dliNoteEndProcessing,
112 "Expected code %u to be processed by the ErrorHandler, not the Hook for %s\n", dliNotify, target(pdli));
113 }
116}
117
118static void CheckDliDone_imp()
119{
120 if (!g_DliHookExpected) return;
122 "Expected g_DliHookExpected[g_DliHookIndex] to be %u, was: %u for %s\n",
125 g_Target[0] = '\0';
126}
127
128#define CheckDli (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : CheckDli_imp
129#define CheckDliDone (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : CheckDliDone_imp
130
131
132/* Replacement functions */
134{
135 return 123;
136}
137
139{
140 return 12345;
141}
142
143
145FARPROC WINAPI DliHook(unsigned dliNotify, PDelayLoadInfo pdli)
146{
147 ok(pdli && pdli->cb >= 36, "Expected a valid pointer with a struct that is big enough: %p, %lu\n",
148 pdli, pdli ? pdli->cb : 0u);
149 if (!pdli || pdli->cb < 36) return NULL;
150
151 CheckDli(dliNotify, pdli, FALSE);
152
154 {
155 g_BreakFunctionName = false;
157 char* procname = (char*)pdli->dlp.szProcName;
158 UnProtect prot(procname);
159 char c = procname[0];
160 procname[0] = isupper(c) ? tolower(c) : toupper(c);
161 }
162
163 /* Validate dll name when required */
165 {
166 ok(!strcmp(g_ExpectedDll, pdli->szDll), "Expected szDll to be '%s', but was: '%s'\n", g_ExpectedDll, pdli->szDll);
167 ok(pdli->dlp.fImportByName, "Expected import by name (%s!%s)\n", g_ExpectedDll, g_ExpectedName);
168 if (pdli->dlp.fImportByName)
169 {
170 ok(!strcmp(g_ExpectedName, pdli->dlp.szProcName), "Expected szProcName to be '%s', but was: '%s'\n",
172 }
173 }
174
175
176 if (dliNotify == dliStartProcessing)
177 {
178 /* Test loadlib fail */
179 if (!_stricmp(pdli->szDll, "sfc_os.dll"))
180 {
181 char* dll = (char*)pdli->szDll;
182 UnProtect u(dll);
183 dll[0] = 'l'; dll[1] = '_'; dll[2] = 'm';
184 }
185 if (!_stricmp(pdli->szDll, "imagehlp.dll"))
186 {
187 char* dll = (char*)pdli->szDll;
188 UnProtect u(dll);
189 dll[0] = 'x'; dll[1] = 'x'; dll[2] = 'x'; dll[3] = 'x'; dll[4] = 'x';
190 }
191 /* Test bypass */
192 if (!_stricmp(pdli->szDll, "dbghelp.dll"))
193 return MyFunction;
194 }
195 else if (dliNotify == dliNotePreLoadLibrary)
196 {
197 /* Show that this value is actually used! */
198 if (!_stricmp(pdli->szDll, "version.dll"))
199 {
200 g_VersionDll = LoadLibraryA("version.dll");
201 return (FARPROC)1;
202 }
203
204 }
205 else if (dliNotify == dliNotePreGetProcAddress)
206 {
207 if (pdli->dlp.fImportByName && !strcmp(pdli->dlp.szProcName, "SfcIsKeyProtected"))
208 {
210 }
211 }
212
213 /* Parameter validation */
214 ok(pdli->ppfn != NULL, "Expected ppfn to be valid, was NULL for %s\n", target(pdli));
215 ok(pdli->szDll != NULL, "Expected szDll to be valid, was NULL for %s\n", target(pdli));
217 "Expected dwLastError to be ERROR_SUCCESS, was: %lu for %s\n", pdli->dwLastError, target(pdli));
218 ok(g_ImportByName == !!pdli->dlp.fImportByName, "Expected pdli->dlp.fImportByName to equal g_ImportByname\n");
219 if (pdli->dlp.fImportByName)
220 ok(pdli->dlp.szProcName != NULL, "Expected szProcName to be valid, was NULL for %s\n", target(pdli));
221 else
222 ok(pdli->dlp.dwOrdinal != 0, "Expected dwOrdinal to be valid, was NULL for %s\n", target(pdli));
223 switch(dliNotify)
224 {
226 ok(pdli->hmodCur == NULL, "Expected hmodCur to be NULL, was: %p for %s\n", pdli->hmodCur, target(pdli));
227 ok(pdli->pfnCur == NULL, "Expected pfnCur to be NULL, was: %p for %s\n", pdli->pfnCur, target(pdli));
228 break;
230 ok(pdli->hmodCur == NULL, "Expected hmodCur to be NULL, was: %p for %s\n", pdli->hmodCur, target(pdli));
231 ok(pdli->pfnCur == NULL, "Expected pfnCur to be NULL, was: %p for %s\n", pdli->pfnCur, target(pdli));
232 break;
234 ok(pdli->hmodCur != NULL, "Expected hmodCur to be valid, was NULL for %s\n", target(pdli));
235 ok(pdli->pfnCur == NULL, "Expected pfnCur to be NULL, was: %p for %s\n", pdli->pfnCur, target(pdli));
236 break;
238 if (!g_BypassMost)
239 ok(pdli->hmodCur != NULL, "Expected hmodCur to be valid, was NULL for %s\n", target(pdli));
240 ok(pdli->pfnCur != NULL, "Expected pfnCur to be a valid pointer, was NULL for %s\n", target(pdli));
242 {
244 ok(targetProc != NULL, "This should not happen, the function i need is unavail! (%s!%s)\n",
246 ok(targetProc == pdli->pfnCur, "Expected pfnCur to be %p, was %p for %s\n", targetProc, pdli->pfnCur, target(pdli));
247 ok(pdli->ppfn && targetProc == *pdli->ppfn,
248 "Expected ppfn to be valid and to result in %p, was: %p(%p) for %s\n",
249 target, pdli->ppfn, pdli->ppfn ? *pdli->ppfn : NULL, target(pdli));
250 }
251 break;
252 default:
253 break;
254 }
255 return NULL;
256}
257
258FARPROC WINAPI DliFailHook(unsigned dliNotify, PDelayLoadInfo pdli)
259{
260 ok(pdli && pdli->cb >= 36,
261 "Expected a valid pointer with a struct that is big enough: %p, %lu\n", pdli, pdli ? pdli->cb : 0u);
262 if (!pdli || pdli->cb < 36) return NULL;
263
264 CheckDli(dliNotify, pdli, TRUE);
265
266 /* Redirections / fixes */
267 if (dliNotify == dliFailLoadLib)
268 {
269 if (!_stricmp(pdli->szDll, "l_m_os.dll"))
270 return (FARPROC)LoadLibraryA("sfc_os.dll");
271 }
272 else if (dliNotify == dliFailGetProc)
273 {
274 if (pdli->dlp.fImportByName && pdli->hmodCur == (HMODULE)1)
275 {
277 }
278 }
279
280 /* Parameter validation */
281 ok(pdli->ppfn != NULL, "Expected ppfn to be valid, was NULL for %s\n", target(pdli));
282 ok(pdli->szDll != NULL, "Expected szDll to be valid, was NULL for %s\n", target(pdli));
283 if (pdli->dlp.fImportByName)
284 ok(pdli->dlp.szProcName != NULL, "Expected szProcName to be valid, was NULL for %s\n", target(pdli));
285 else
286 ok(pdli->dlp.dwOrdinal != 0, "Expected dwOrdinal to be valid, was NULL for %s\n", target(pdli));
287 switch(dliNotify)
288 {
289 case dliFailLoadLib:
290 ok(pdli->hmodCur == NULL, "Expected hmodCur to be NULL, was: %p for %s\n", pdli->hmodCur, target(pdli));
291 ok(pdli->pfnCur == NULL, "Expected pfnCur to be NULL, was: %p for %s\n", pdli->pfnCur, target(pdli));
293 "Expected dwLastError to be ERROR_MOD_NOT_FOUND, was: %lu for %s\n", pdli->dwLastError, target(pdli));
294 break;
295 case dliFailGetProc:
296 ok(pdli->hmodCur != NULL, "Expected hmodCur to be valid, was NULL for %s\n", target(pdli));
297 ok(pdli->pfnCur == NULL, "Expected pfnCur to be NULL, was: %p for %s\n", pdli->pfnCur, target(pdli));
299 "Expected dwLastError to be ERROR_PROC_NOT_FOUND, was: %lu for %s\n", pdli->dwLastError, target(pdli));
300 break;
301 }
302
303 return NULL;
304}
305
306
308{
310 ok(ExceptionCode == expected, "Expected code to be 0x%lx, was: 0x%lx\n", expected, ExceptionCode);
311 ok(ExceptionInfo != NULL, "Expected to get exception info\n");
312 ok(ExceptionInfo->ExceptionRecord != NULL, "Expected to get a valid record info\n");
313
314 if (ExceptionCode != expected)
315 {
316 skip("Skipping other checks, this was not the exception we expected!\n");
318 }
319
320 if (ExceptionInfo && ExceptionInfo->ExceptionRecord)
321 {
322 PEXCEPTION_RECORD ExceptionRecord = ExceptionInfo->ExceptionRecord;
323 ok(ExceptionRecord->ExceptionCode == expected, "Expected ExceptionCode to be 0x%lx, was 0x%lx\n",
324 expected, ExceptionRecord->ExceptionCode);
325 /* We can still continue. */
326 ok(ExceptionRecord->ExceptionFlags == 0, "Expected ExceptionFlags to be 0, was: 0x%lx\n",
327 ExceptionRecord->ExceptionFlags);
328 ok(ExceptionRecord->NumberParameters == 1, "Expected 1 parameter, got %lu\n",
329 ExceptionRecord->NumberParameters);
330 if (ExceptionRecord->NumberParameters == 1)
331 {
332 PDelayLoadInfo LoadInfo = (PDelayLoadInfo)ExceptionRecord->ExceptionInformation[0];
333 ok(LoadInfo && LoadInfo->cb >= 36, "Expected a valid pointer with a struct that is big enough: %p, %lu\n",
334 LoadInfo, LoadInfo ? LoadInfo->cb : 0);
335
336 if (g_ExpectedDll)
337 ok(!strcmp(g_ExpectedDll, LoadInfo->szDll), "Expected szDll to be '%s', but was: '%s'\n",
338 g_ExpectedDll, LoadInfo->szDll);
339 if (g_ExpectedName)
340 {
341 ok(LoadInfo->dlp.fImportByName, "Expected import by name\n");
342 if (LoadInfo->dlp.fImportByName)
343 {
345 "Expected szProcName to be '%s', but was: '%s'\n", g_ExpectedName, LoadInfo->dlp.szProcName);
346
348 {
349 HMODULE mod = LoadLibraryA("imagehlp.dll");
351 }
352 else
353 {
354 char buf[100];
356 sprintf(buf, "%c%s", first, g_ExpectedName + 1);
358 }
360 }
361 }
362 }
363 }
364
366}
367
368/* We register one hook the 'default' way and one manually,
369so that we can check that both fallback and registration work*/
370extern "C"
371{
373 //PfnDliHook __pfnDliFailureHook2 = DliFailHook;
374}
375
376
377bool g_UsePointers = false;
378
379template<typename PTR>
381{
382 /* Old delayload type */
383 if (g_UsePointers)
384 return reinterpret_cast<PTR>(rva);
385 return reinterpret_cast<PTR>((reinterpret_cast<PBYTE>(dos) + rva));
386}
387
388
398unsigned g_imagehlp[] = { dliStartProcessing, dliNotePreLoadLibrary, dliFailLoadLib, LAST_DLI }; /* This exception does not fire EndProcessing! */
399
400
401//#define DELAYLOAD_SUPPORTS_UNLOADING
402START_TEST(delayimp)
403{
405 /* Verify that both scenario's work */
406 ok(__pfnDliNotifyHook2 == DliHook, "Expected __pfnDliNotifyHook2 to be DliHook(%p), but was: %p\n",
408 ok(__pfnDliFailureHook2 == NULL, "Expected __pfnDliFailureHook2 to be NULL, but was: %p\n",
410
412
413
415
416 ok(dos->e_magic == IMAGE_DOS_SIGNATURE, "Expected a DOS header\n");
418 return;
419
422
423 /* Test some advanced features (loading / unloading) */
424 if (delaydir->Size != 0)
425 {
426#if defined(_DELAY_IMP_VER) && _DELAY_IMP_VER == 2 && defined(DELAYLOAD_SUPPORTS_UNLOADING)
427 /* First, before mangling the delayload stuff, let's try some v2 functions */
429 ok(mod == NULL, "Expected mod to be NULL, was %p\n", mod);
430 /* Now, a mistyped module (case sensitive!) */
431 HRESULT hr = __HrLoadAllImportsForDll("WiNmM.DlL");
432 ok(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), "Expected hr to be HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), was %lu\n", hr);
434 ok(mod == NULL, "Expected mod to be NULL, was %p\n", mod);
435
436 /* Let's load it */
437 hr = __HrLoadAllImportsForDll(WINMM_DLLNAME);
438 ok(hr == S_OK, "Expected hr to be S_OK, was %lu\n", hr);
440 ok(mod != NULL, "Expected mod to be valid, was NULL\n");
441
442 BOOL status = __FUnloadDelayLoadedDLL2(WINMM_DLLNAME);
443 ok(status == TRUE, "Expected __FUnloadDelayLoadedDLL2 to succeed\n");
445 ok(mod == NULL, "Expected mod to be NULL, was %p\n", mod);
446#else
447 trace("Binary compiled without support for unloading\n");
448#endif
449 }
450 else
451 {
452 skip("No IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT found, some advanced features might not work!\n");
453 }
454
455 /* Test the normal flow without a dll loaded */
458 g_ExpectedName = "mmGetCurrentTask";
459 DWORD task = mmGetCurrentTask();
460 ok(task == GetCurrentThreadId(), "Expected ret to be current thread id (0x%lx), was 0x%lx\n", GetCurrentThreadId(), task);
461 CheckDliDone();
462
463 /* Test the normal flow with a dll loaded */
466 g_ExpectedName = "midiOutClose";
467 DWORD err = midiOutClose((HMIDIOUT)(ULONG_PTR)0xdeadbeef);
468 ok(err == MMSYSERR_INVALHANDLE, "Expected err to be MMSYSERR_INVALHANDLE, was 0x%lx\n", err);
469 CheckDliDone();
470
471 /* Make sure GetProcAddress fails, also ignore the Failure hook, use the exception to set the address */
474 g_ExpectedName = "MixerClose";
475 g_BreakFunctionName = true;
477 {
478 err = mixerClose((HMIXER)(ULONG_PTR)0xdeadbeef);
479 }
481 {
483 }
484 _SEH2_END;
485 ok(err == MMSYSERR_INVALHANDLE, "Expected err to be MMSYSERR_INVALHANDLE, was 0x%lx\n", err);
486 CheckDliDone();
487 ok(g_BreakFunctionName == false, "Expected the functionname to be changed\n");
488
489 /* Make the LoadLib fail, manually load the library in the Failure Hook,
490 Respond to the dliNotePreGetProcAddress with an alternate function address */
493 ok(ret == 12345, "Expected ret to be 12345, was %u\n", ret); /* The original function returns FALSE! */
494 CheckDliDone();
495
496 /* Show that it works with the manually returned dll */
499 ok(ret == FALSE, "Expected ret to be FALSE, was %u\n", ret);
500 CheckDliDone();
501
502 /* Return a fake dll handle, so that we can see when it is being used, and manually return a function in the Failure Hook */
505 ok(ret == FALSE, "Expected ret to be FALSE, was %u\n", ret);
506 CheckDliDone();
507
508 /* Manually return a function in the failure hook, when the module is the previously set bad one */
511 ok(ret == FALSE, "Expected ret to be FALSE, was %u\n", ret);
512 CheckDliDone();
513
514 if (HIWORD(SymGetOptions) == NULL)
515 {
516 skip("SymGetOptions until CORE-6504 is fixed\n");
517 }
518 else
519 {
520 /* Completely bypass most hooks, by directly replying with a function address */
522 g_BypassMost = true;
523 DWORD opt = SymGetOptions();
524 g_BypassMost = false;
525 ok(opt == 123, "Expected opt to be 123, was %lu\n", opt); /* The original function returns ERROR_INVALID_HANDLE */
526 CheckDliDone();
527 }
528
529 /* Import by ordinal */
530 g_ImportByName = false;
532 PARSEDURLA pua = { sizeof(pua), 0 };
533 HRESULT hr = ParseURLA("", &pua);
534 ok(hr == URL_E_INVALID_SYNTAX, "Expected tmp to be URL_E_INVALID_SYNTAX, was %lx\n", hr);
535 CheckDliDone();
536 g_ImportByName = true;
537
538 /* Handle LoadLib failure with an exception handler */
539 if (HIWORD(MapAndLoad) == NULL)
540 {
541 skip("MapAndLoad until CORE-6504 is fixed\n");
542 }
543 else
544 {
546 LOADED_IMAGE img = {0};
547 ret = 123;
548 g_ExceptionIsModule = true;
549 g_ExpectedDll = "xxxxxhlp.dll";
550 g_ExpectedName = "MapAndLoad";
552 {
553 ret = MapAndLoad("some_not_existing_file.aabbcc", NULL, &img, FALSE, TRUE);
554 }
556 {
557 ;
558 }
559 _SEH2_END;
560 g_ExceptionIsModule = false;
561 ok(ret == FALSE, "Expected ret to be FALSE, was %u\n", ret);
562 CheckDliDone();
563 }
564}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int toupper(int c)
Definition: utclib.c:881
#define isupper(c)
Definition: acclib.h:71
int tolower(int c)
Definition: utclib.c:902
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define _stricmp
Definition: cat.c:22
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1774
#define VcppException(sev, err)
Definition: delayimp.cpp:32
unsigned g_winmm_midi_out_close[]
Definition: delayimp.cpp:390
static void CheckDli_imp(unsigned dliNotify, PDelayLoadInfo pdli, BOOL ErrorHandler)
Definition: delayimp.cpp:97
unsigned g_sfc_file[]
Definition: delayimp.cpp:393
static void SetExpectedDli(unsigned *order)
Definition: delayimp.cpp:90
PfnDliHook __pfnDliNotifyHook2
Definition: delayimp.h:80
size_t g_DliHookIndex
Definition: delayimp.cpp:87
bool g_ImportByName
Definition: delayimp.cpp:45
bool g_ExceptionIsModule
Definition: delayimp.cpp:44
unsigned * g_DliHookExpected
Definition: delayimp.cpp:86
bool g_BypassMost
Definition: delayimp.cpp:43
static void CheckDliDone_imp()
Definition: delayimp.cpp:118
unsigned g_sfc_key[]
Definition: delayimp.cpp:392
#define LAST_DLI
Definition: delayimp.cpp:88
bool g_UsePointers
Definition: delayimp.cpp:377
unsigned g_winmm_get_cur_task[]
Definition: delayimp.cpp:389
unsigned g_version_a[]
Definition: delayimp.cpp:394
unsigned g_winmm_mide_in_close[]
Definition: delayimp.cpp:391
#define WINMM_DLLNAME
Definition: delayimp.cpp:38
const char * g_ExpectedName
Definition: delayimp.cpp:47
LONG ExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo, ULONG ExceptionCode)
Definition: delayimp.cpp:307
unsigned g_version_w[]
Definition: delayimp.cpp:395
FARPROC WINAPI DliFailHook(unsigned dliNotify, PDelayLoadInfo pdli)
Definition: delayimp.cpp:258
unsigned g_imagehlp[]
Definition: delayimp.cpp:398
unsigned g_scard[]
Definition: delayimp.cpp:396
const char * g_ExpectedDll
Definition: delayimp.cpp:46
static HMODULE g_VersionDll
Definition: delayimp.cpp:144
INT_PTR WINAPI MyFunction()
Definition: delayimp.cpp:133
bool g_BrokenFunctionName
Definition: delayimp.cpp:42
BOOL WINAPI MySfcIsKeyProtected(HKEY KeyHandle, LPCWSTR SubKeyName, REGSAM KeySam)
Definition: delayimp.cpp:138
char g_Target[100]
Definition: delayimp.cpp:48
bool g_BreakFunctionName
Definition: delayimp.cpp:41
unsigned g_shlwapi[]
Definition: delayimp.cpp:397
FARPROC WINAPI DliHook(unsigned dliNotify, PDelayLoadInfo pdli)
Definition: delayimp.cpp:145
PTR Rva2Addr(PIMAGE_DOS_HEADER dos, RVA rva)
Definition: delayimp.cpp:380
#define CheckDliDone
Definition: delayimp.cpp:129
#define CheckDli
Definition: delayimp.cpp:128
struct DelayLoadInfo * PDelayLoadInfo
@ dliNoteEndProcessing
Definition: delayimp.h:39
@ dliFailLoadLib
Definition: delayimp.h:37
@ dliNotePreGetProcAddress
Definition: delayimp.h:36
@ dliNotePreLoadLibrary
Definition: delayimp.h:35
@ dliFailGetProc
Definition: delayimp.h:38
@ dliStartProcessing
Definition: delayimp.h:34
FARPROC(WINAPI * PfnDliHook)(unsigned, PDelayLoadInfo)
Definition: delayimp.h:77
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
int(* FARPROC)()
Definition: compat.h:36
DWORD RVA
Definition: compat.h:1262
#define GetProcAddress(x, y)
Definition: compat.h:753
DWORD WINAPI SymGetOptions(void)
Definition: dbghelp.c:600
BOOL WINAPI MapAndLoad(PCSTR pszImageName, PCSTR pszDllPath, PLOADED_IMAGE pLoadedImage, BOOL bDotDll, BOOL bReadOnly)
Definition: access.c:131
BOOL NTAPI IsBadWritePtr(IN LPVOID lp, IN UINT_PTR ucb)
Definition: except.c:883
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
HRESULT WINAPI ParseURLA(LPCSTR x, PARSEDURLA *y)
Definition: url.c:161
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:845
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:853
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
GLint GLvoid * img
Definition: gl.h:1956
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const GLint * first
Definition: glext.h:5794
GLenum const GLvoid * addr
Definition: glext.h:9621
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:92
#define S_OK
Definition: intsafe.h:52
#define URL_E_INVALID_SYNTAX
Definition: intshcut.h:32
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOL expected
Definition: store.c:2063
static HMODULE dll
Definition: str.c:188
IMAGE_NT_HEADERS nt
Definition: module.c:50
IMAGE_DOS_HEADER dos
Definition: module.c:49
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4725
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
#define ERROR_SEVERITY_ERROR
Definition: ntbasedef.h:604
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT
Definition: ntimage.h:488
PfnDliHook __pfnDliFailureHook2
Definition: delayimp.h:81
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define err(...)
DWORD WINAPI mmGetCurrentTask(void)
Definition: winmm.c:2912
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
BOOL WINAPI SfcGetNextProtectedFile(HANDLE RpcHandle, PPROTECTED_FILE_DATA ProtFileData)
Definition: sfc_os.c:142
BOOL WINAPI SfcIsKeyProtected(HKEY hKey, LPCWSTR lpSubKey, REGSAM samDesired)
Definition: sfc_os.c:117
HRESULT hr
Definition: shlfolder.c:183
HMODULE hmodCur
Definition: delayimp.h:72
DWORD cb
Definition: delayimp.h:67
FARPROC pfnCur
Definition: delayimp.h:73
LPCSTR szDll
Definition: delayimp.h:70
DelayLoadProc dlp
Definition: delayimp.h:71
FARPROC * ppfn
Definition: delayimp.h:69
DWORD dwLastError
Definition: delayimp.h:74
BOOL fImportByName
Definition: delayimp.h:57
DWORD dwOrdinal
Definition: delayimp.h:61
LPCSTR szProcName
Definition: delayimp.h:60
~UnProtect()
Definition: delayimp.cpp:74
UnProtect(PVOID addr)
Definition: delayimp.cpp:65
DWORD mProt
Definition: delayimp.cpp:82
PVOID mAddr
Definition: delayimp.cpp:81
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
Definition: ps.c:97
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
int ret
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:135
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define GetModuleHandle
Definition: winbase.h:3852
#define WINAPI
Definition: msvc.h:6
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_PROC_NOT_FOUND
Definition: winerror.h:199
UINT WINAPI mixerClose(HMIXER hMix)
Definition: winmm.c:386
UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
Definition: winmm.c:978
ACCESS_MASK REGSAM
Definition: winreg.h:69
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185