[APPHELP] Try Dos and Nt path formats in SdbGetFileAttributes.
[reactos.git] / dll / appcompat / apphelp / shimeng.h
1 /*
2 * PROJECT: ReactOS Application compatibility module
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Shim engine structures
5 * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8 #ifndef SHIMENG_H
9 #define SHIMENG_H
10
11 /* This header is ReactOS specific */
12
13 /* Structure that allows dynamic growing.
14 Be aware, the data may move! */
15 typedef struct _ARRAY
16 {
17 PVOID Data__;
18 DWORD Size__;
19 DWORD MaxSize__;
20 DWORD ItemSize__;
21 } ARRAY, *PARRAY;
22
23 typedef struct _SHIMINFO *PSHIMINFO;
24 typedef struct _SHIMMODULE *PSHIMMODULE;
25
26 /* Shims know this structure as HOOKAPI, with 2 reserved members (the last 2). */
27 typedef struct tagHOOKAPIEX
28 {
29 PCSTR LibraryName;
30 PCSTR FunctionName;
31 PVOID ReplacementFunction;
32 PVOID OriginalFunction;
33 PSHIMINFO pShimInfo;
34 PVOID Unused;
35 } HOOKAPIEX, *PHOOKAPIEX;
36
37 C_ASSERT(sizeof(HOOKAPIEX) == sizeof(HOOKAPI));
38 C_ASSERT(offsetof(HOOKAPIEX, pShimInfo) == offsetof(HOOKAPI, Reserved));
39
40 typedef struct _INEXCLUDE
41 {
42 UNICODE_STRING Module;
43 BOOL Include;
44 } INEXCLUDE, *PINEXCLUDE;
45
46 typedef struct _SHIMINFO
47 {
48 PCWSTR ShimName;
49 PHOOKAPIEX pHookApi;
50 DWORD dwHookCount;
51 PSHIMMODULE pShimModule;
52 ARRAY InExclude; /* INEXCLUDE */
53 } SHIMINFO, *PSHIMINFO;
54
55 typedef struct _SHIMMODULE
56 {
57 UNICODE_STRING Name;
58 PVOID BaseAddress;
59
60 PHOOKAPIEX (WINAPI* pGetHookAPIs)(LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount);
61 BOOL (WINAPI* pNotifyShims)(DWORD fdwReason, PVOID ptr);
62
63 ARRAY EnabledShims; /* PSHIMINFO */
64 } SHIMMODULE, *PSHIMMODULE;
65
66 typedef struct _HOOKMODULEINFO
67 {
68 UNICODE_STRING Name;
69 PVOID BaseAddress;
70
71 ARRAY HookApis; /* PHOOKAPIEX */
72
73 } HOOKMODULEINFO, *PHOOKMODULEINFO;
74
75
76 #if SDBAPI_DEBUG_ALLOC
77
78 LPVOID SdbpAlloc(SIZE_T size, int line, const char* file);
79 LPVOID SdbpReAlloc(LPVOID mem, SIZE_T size, SIZE_T oldSize, int line, const char* file);
80 VOID SdbpFree(LPVOID mem, int line, const char* file);
81
82 #define SeiAlloc(size) SdbpAlloc(size, __LINE__, __FILE__)
83 #define SeiReAlloc(mem, size, oldSize) SdbpReAlloc(mem, size, oldSize, __LINE__, __FILE__)
84 #define SeiFree(mem) SdbpFree(mem, __LINE__, __FILE__)
85
86 #else
87
88 LPVOID SdbpAlloc(SIZE_T size);
89 LPVOID SdbpReAlloc(LPVOID mem, SIZE_T size, SIZE_T oldSize);
90 VOID SdbpFree(LPVOID mem);
91
92 #define SeiAlloc(size) SdbpAlloc(size)
93 #define SeiReAlloc(mem, size, oldSize) SdbpReAlloc(mem, size, oldSize)
94 #define SeiFree(mem) SdbpFree(mem)
95
96 #endif
97
98 #endif // SHIMENG_H