xref: /reactos/sdk/include/psdk/delayimp.h (revision 3468e27c)
1 #ifndef _delayimp_h
2 #define _delayimp_h
3 
4 #ifdef __GNUC__
5 /* Hack, for bug in ld.  Will be removed soon.  */
6 #define __ImageBase __MINGW_LSYMBOL(_image_base__)
7 #endif
8 
9 #if defined(__cplusplus)
10 #define ExternC extern "C"
11 #else
12 #define ExternC extern
13 #endif
14 
15 #ifndef FACILITY_VISUALCPP
16 #define FACILITY_VISUALCPP  ((LONG)0x6d)
17 #endif
18 #define VcppException(sev,err)  ((sev) | (FACILITY_VISUALCPP<<16) | err)
19 
20 #define DELAYLOAD_VERSION 0x200
21 
22 typedef DWORD RVA;
23 typedef IMAGE_THUNK_DATA *PImgThunkData;
24 typedef const IMAGE_THUNK_DATA *PCImgThunkData;
25 
26 enum DLAttr
27 {
28     dlattrRva = 0x1,
29 };
30 
31 /* Notification codes */
32 enum
33 {
34     dliStartProcessing,
35     dliNotePreLoadLibrary,
36     dliNotePreGetProcAddress,
37     dliFailLoadLib,
38     dliFailGetProc,
39     dliNoteEndProcessing,
40 };
41 
42 typedef struct ImgDelayDescr
43 {
44     DWORD grAttrs;
45     RVA rvaDLLName;
46     RVA rvaHmod;
47     RVA rvaIAT;
48     RVA rvaINT;
49     RVA rvaBoundIAT;
50     RVA rvaUnloadIAT;
51     DWORD dwTimeStamp;
52 } ImgDelayDescr, *PImgDelayDescr;
53 typedef const ImgDelayDescr *PCImgDelayDescr;
54 
55 typedef struct DelayLoadProc
56 {
57     BOOL fImportByName;
58     union
59     {
60         LPCSTR szProcName;
61         DWORD dwOrdinal;
62     };
63 } DelayLoadProc;
64 
65 typedef struct DelayLoadInfo
66 {
67     DWORD cb;
68     PCImgDelayDescr pidd;
69     FARPROC *ppfn;
70     LPCSTR szDll;
71     DelayLoadProc dlp;
72     HMODULE hmodCur;
73     FARPROC pfnCur;
74     DWORD dwLastError;
75 } DelayLoadInfo, *PDelayLoadInfo;
76 
77 typedef FARPROC (WINAPI *PfnDliHook)(unsigned, PDelayLoadInfo);
78 
79 
80 ExternC PfnDliHook __pfnDliNotifyHook2;
81 ExternC PfnDliHook __pfnDliFailureHook2;
82 
83 #endif /* not _delayimp_h */
84