2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Shim Engine
4 * FILE: dll/appcompat/shims/shimlib/shimlib.h
5 * PURPOSE: ReactOS Shim Engine
6 * PROGRAMMER: Mark Jansen
11 typedef struct tagHOOKAPI
15 PVOID ReplacementFunction
;
16 PVOID OriginalFunction
;
21 PVOID
ShimLib_ShimMalloc(SIZE_T
);
22 void ShimLib_ShimFree(PVOID
);
23 PCSTR
ShimLib_StringDuplicateA(PCSTR
);
24 BOOL
ShimLib_StrAEqualsW(PCSTR
, PCWSTR
);
27 /* Forward events to generic handlers */
28 void ShimLib_Init(HINSTANCE
);
29 void ShimLib_Deinit(void);
30 PHOOKAPI WINAPI
ShimLib_GetHookAPIs(LPCSTR
,LPCWSTR
,PDWORD
);
31 BOOL WINAPI
ShimLib_NotifyShims(DWORD fdwReason
, PVOID ptr
);
34 /* Shims should respond to SHIM_REASON_XXXX in the Notify routines.
35 SHIM_NOTIFY_ codes are sent by apphelp, and translated to SHIM_REASON_ by the shimlib routines.
36 The only exception being SHIM_NOTIFY_ATTACH, that is also set for one-time init.
39 #define SHIM_REASON_INIT 100
40 #define SHIM_REASON_DEINIT 101
41 #define SHIM_REASON_DLL_LOAD 102 /* Arg: PLDR_DATA_TABLE_ENTRY */
42 #define SHIM_REASON_DLL_UNLOAD 103 /* Arg: PLDR_DATA_TABLE_ENTRY */
44 #define SHIM_NOTIFY_ATTACH 1
45 #define SHIM_NOTIFY_DETACH 2
46 #define SHIM_NOTIFY_DLL_LOAD 3 /* Arg: PLDR_DATA_TABLE_ENTRY */
47 #define SHIM_NOTIFY_DLL_UNLOAD 4 /* Arg: PLDR_DATA_TABLE_ENTRY */
51 typedef enum _SEI_LOG_LEVEL
{
57 BOOL WINAPIV
SeiDbgPrint(SEI_LOG_LEVEL Level
, PCSTR FunctionName
, PCSTR Format
, ...);
58 extern ULONG g_ShimEngDebugLevel
;
60 #define SHIMENG_ERR(fmt, ...) do { if (g_ShimEngDebugLevel) SeiDbgPrint(SEI_ERR, __FUNCTION__, fmt, ##__VA_ARGS__ ); } while (0)
61 #define SHIMENG_WARN(fmt, ...) do { if (g_ShimEngDebugLevel) SeiDbgPrint(SEI_WARN, __FUNCTION__, fmt, ##__VA_ARGS__ ); } while (0)
62 #define SHIMENG_INFO(fmt, ...) do { if (g_ShimEngDebugLevel) SeiDbgPrint(SEI_INFO, __FUNCTION__, fmt, ##__VA_ARGS__ ); } while (0)
66 typedef PHOOKAPI (WINAPI
* _PVGetHookAPIs
)(DWORD
, PCSTR
, PDWORD
);
67 typedef BOOL (WINAPI
* _PVNotify
)(DWORD
, PVOID
);
69 typedef struct tagSHIMREG
71 _PVGetHookAPIs GetHookAPIs
;
78 #define _SHMALLOC(x) __declspec(allocate(x))
79 #elif defined(__GNUC__)
80 #define _SHMALLOC(x) __attribute__ ((section (x) ))
82 #error Your compiler is not supported.