2017-07-01 20:06:30 +00:00
|
|
|
/*
|
2017-09-08 20:19:51 +00:00
|
|
|
* PROJECT: ReactOS Application compatibility module
|
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
|
|
|
* PURPOSE: Shim engine structures
|
|
|
|
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
|
2017-07-01 20:06:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SHIMENG_H
|
|
|
|
#define SHIMENG_H
|
|
|
|
|
2017-08-14 16:34:56 +00:00
|
|
|
/* This header is ReactOS specific */
|
2017-07-30 12:47:57 +00:00
|
|
|
|
|
|
|
/* Structure that allows dynamic growing.
|
|
|
|
Be aware, the data may move! */
|
2017-07-01 20:06:30 +00:00
|
|
|
typedef struct _ARRAY
|
|
|
|
{
|
2017-07-30 12:47:57 +00:00
|
|
|
PVOID Data__;
|
|
|
|
DWORD Size__;
|
|
|
|
DWORD MaxSize__;
|
|
|
|
DWORD ItemSize__;
|
2017-07-01 20:06:30 +00:00
|
|
|
} ARRAY, *PARRAY;
|
|
|
|
|
2017-07-30 12:47:57 +00:00
|
|
|
typedef struct _SHIMINFO *PSHIMINFO;
|
|
|
|
typedef struct _SHIMMODULE *PSHIMMODULE;
|
2017-07-01 20:06:30 +00:00
|
|
|
|
2017-07-30 12:47:57 +00:00
|
|
|
/* Shims know this structure as HOOKAPI, with 2 reserved members (the last 2). */
|
2017-07-01 20:06:30 +00:00
|
|
|
typedef struct tagHOOKAPIEX
|
|
|
|
{
|
|
|
|
PCSTR LibraryName;
|
|
|
|
PCSTR FunctionName;
|
|
|
|
PVOID ReplacementFunction;
|
|
|
|
PVOID OriginalFunction;
|
2017-07-30 12:47:57 +00:00
|
|
|
PSHIMINFO pShimInfo;
|
|
|
|
PVOID Unused;
|
2017-07-01 20:06:30 +00:00
|
|
|
} HOOKAPIEX, *PHOOKAPIEX;
|
|
|
|
|
|
|
|
C_ASSERT(sizeof(HOOKAPIEX) == sizeof(HOOKAPI));
|
2017-07-30 12:47:57 +00:00
|
|
|
C_ASSERT(offsetof(HOOKAPIEX, pShimInfo) == offsetof(HOOKAPI, Reserved));
|
2017-07-01 20:06:30 +00:00
|
|
|
|
2017-08-14 16:34:56 +00:00
|
|
|
typedef struct _INEXCLUDE
|
|
|
|
{
|
|
|
|
UNICODE_STRING Module;
|
|
|
|
BOOL Include;
|
|
|
|
} INEXCLUDE, *PINEXCLUDE;
|
2017-07-01 20:06:30 +00:00
|
|
|
|
2017-07-30 12:47:57 +00:00
|
|
|
typedef struct _SHIMINFO
|
2017-07-01 20:06:30 +00:00
|
|
|
{
|
2017-08-14 16:34:56 +00:00
|
|
|
PCWSTR ShimName;
|
2017-07-01 20:06:30 +00:00
|
|
|
PHOOKAPIEX pHookApi;
|
|
|
|
DWORD dwHookCount;
|
2017-07-30 12:47:57 +00:00
|
|
|
PSHIMMODULE pShimModule;
|
2017-08-14 16:34:56 +00:00
|
|
|
ARRAY InExclude; /* INEXCLUDE */
|
2017-07-30 12:47:57 +00:00
|
|
|
} SHIMINFO, *PSHIMINFO;
|
2017-07-01 20:06:30 +00:00
|
|
|
|
|
|
|
typedef struct _SHIMMODULE
|
|
|
|
{
|
|
|
|
UNICODE_STRING Name;
|
|
|
|
PVOID BaseAddress;
|
|
|
|
|
|
|
|
PHOOKAPIEX (WINAPI* pGetHookAPIs)(LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount);
|
|
|
|
BOOL (WINAPI* pNotifyShims)(DWORD fdwReason, PVOID ptr);
|
|
|
|
|
2017-07-30 12:47:57 +00:00
|
|
|
ARRAY EnabledShims; /* PSHIMINFO */
|
2017-07-01 20:06:30 +00:00
|
|
|
} SHIMMODULE, *PSHIMMODULE;
|
|
|
|
|
|
|
|
typedef struct _HOOKMODULEINFO
|
|
|
|
{
|
|
|
|
UNICODE_STRING Name;
|
|
|
|
PVOID BaseAddress;
|
|
|
|
|
2017-07-30 12:47:57 +00:00
|
|
|
ARRAY HookApis; /* PHOOKAPIEX */
|
|
|
|
|
2017-07-01 20:06:30 +00:00
|
|
|
} HOOKMODULEINFO, *PHOOKMODULEINFO;
|
|
|
|
|
2018-01-24 21:41:56 +00:00
|
|
|
typedef struct _FLAGINFO
|
|
|
|
{
|
|
|
|
ULARGE_INTEGER AppCompatFlags;
|
|
|
|
ULARGE_INTEGER AppCompatFlagsUser;
|
|
|
|
ULONG ProcessParameters_Flags;
|
|
|
|
} FLAGINFO, *PFLAGINFO;
|
|
|
|
|
2017-07-01 20:06:30 +00:00
|
|
|
|
|
|
|
#if SDBAPI_DEBUG_ALLOC
|
|
|
|
|
|
|
|
LPVOID SdbpAlloc(SIZE_T size, int line, const char* file);
|
|
|
|
LPVOID SdbpReAlloc(LPVOID mem, SIZE_T size, SIZE_T oldSize, int line, const char* file);
|
|
|
|
VOID SdbpFree(LPVOID mem, int line, const char* file);
|
|
|
|
|
|
|
|
#define SeiAlloc(size) SdbpAlloc(size, __LINE__, __FILE__)
|
|
|
|
#define SeiReAlloc(mem, size, oldSize) SdbpReAlloc(mem, size, oldSize, __LINE__, __FILE__)
|
|
|
|
#define SeiFree(mem) SdbpFree(mem, __LINE__, __FILE__)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
LPVOID SdbpAlloc(SIZE_T size);
|
|
|
|
LPVOID SdbpReAlloc(LPVOID mem, SIZE_T size, SIZE_T oldSize);
|
|
|
|
VOID SdbpFree(LPVOID mem);
|
|
|
|
|
|
|
|
#define SeiAlloc(size) SdbpAlloc(size)
|
|
|
|
#define SeiReAlloc(mem, size, oldSize) SdbpReAlloc(mem, size, oldSize)
|
|
|
|
#define SeiFree(mem) SdbpFree(mem)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // SHIMENG_H
|