ReactOS  0.4.14-dev-358-gbef841c
ignoreloadlibrary.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shimlib.h>
#include "ntndk.h"
#include <setup_shim.inl>
#include <implement_shim.inl>
Include dependency graph for ignoreloadlibrary.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define SHIM_NS   IgnoreLoadLibrary
 
#define SHIM_NUM_HOOKS   4
 
#define SHIM_SETUP_HOOKS
 

Typedefs

typedef HMODULE(WINAPILOADLIBRARYAPROC) (LPCSTR lpLibFileName)
 
typedef HMODULE(WINAPILOADLIBRARYEXAPROC) (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 
typedef HMODULE(WINAPILOADLIBRARYWPROC) (LPCWSTR lpLibFileName)
 
typedef HMODULE(WINAPILOADLIBRARYEXWPROC) (LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 

Functions

HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryA (LPCSTR lpLibFileName)
 
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExA (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryW (LPCWSTR lpLibFileName)
 
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExW (LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
 

Macro Definition Documentation

◆ SHIM_NS

#define SHIM_NS   IgnoreLoadLibrary

Definition at line 20 of file ignoreloadlibrary.c.

◆ SHIM_NUM_HOOKS

#define SHIM_NUM_HOOKS   4

Definition at line 73 of file ignoreloadlibrary.c.

◆ SHIM_SETUP_HOOKS

#define SHIM_SETUP_HOOKS
Value:
SHIM_HOOK(0, "KERNEL32.DLL", "LoadLibraryA", SHIM_OBJ_NAME(APIHook_LoadLibraryA)) \
SHIM_HOOK(1, "KERNEL32.DLL", "LoadLibraryExA", SHIM_OBJ_NAME(APIHook_LoadLibraryExA)) \
SHIM_HOOK(2, "KERNEL32.DLL", "LoadLibraryW", SHIM_OBJ_NAME(APIHook_LoadLibraryW)) \
SHIM_HOOK(3, "KERNEL32.DLL", "LoadLibraryExW", SHIM_OBJ_NAME(APIHook_LoadLibraryExW))
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryA(LPCSTR lpLibFileName)
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryW(LPCWSTR lpLibFileName)
HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)

Definition at line 74 of file ignoreloadlibrary.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file ignoreloadlibrary.c.

Typedef Documentation

◆ LOADLIBRARYAPROC

typedef HMODULE(WINAPI* LOADLIBRARYAPROC) (LPCSTR lpLibFileName)

Definition at line 14 of file ignoreloadlibrary.c.

◆ LOADLIBRARYEXAPROC

typedef HMODULE(WINAPI* LOADLIBRARYEXAPROC) (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)

Definition at line 15 of file ignoreloadlibrary.c.

◆ LOADLIBRARYEXWPROC

typedef HMODULE(WINAPI* LOADLIBRARYEXWPROC) (LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)

Definition at line 17 of file ignoreloadlibrary.c.

◆ LOADLIBRARYWPROC

typedef HMODULE(WINAPI* LOADLIBRARYWPROC) (LPCWSTR lpLibFileName)

Definition at line 16 of file ignoreloadlibrary.c.

Function Documentation

◆ APIHook_LoadLibraryA()

HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryA ( LPCSTR  lpLibFileName)

Definition at line 24 of file ignoreloadlibrary.c.

25 {
26  HMODULE Module;
27  DWORD dwOldErrorMode;
28 
30  Module = CALL_SHIM(0, LOADLIBRARYAPROC)(lpLibFileName);
31  SetErrorMode(dwOldErrorMode);
32 
33  return Module;
34 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:70
HMODULE(WINAPI * LOADLIBRARYAPROC)(LPCSTR lpLibFileName)
#define SEM_NOOPENFILEERRORBOX
Definition: rtltypes.h:72

◆ APIHook_LoadLibraryExA()

HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExA ( LPCSTR  lpLibFileName,
HANDLE  hFile,
DWORD  dwFlags 
)

Definition at line 36 of file ignoreloadlibrary.c.

37 {
38  HMODULE Module;
39  DWORD dwOldErrorMode;
40 
42  Module = CALL_SHIM(1, LOADLIBRARYEXAPROC)(lpLibFileName, hFile, dwFlags);
43  SetErrorMode(dwOldErrorMode);
44 
45  return Module;
46 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:70
_In_ HANDLE hFile
Definition: mswsock.h:90
#define SEM_NOOPENFILEERRORBOX
Definition: rtltypes.h:72
HMODULE(WINAPI * LOADLIBRARYEXAPROC)(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)

◆ APIHook_LoadLibraryExW()

HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryExW ( LPCWSTR  lpLibFileName,
HANDLE  hFile,
DWORD  dwFlags 
)

Definition at line 60 of file ignoreloadlibrary.c.

61 {
62  HMODULE Module;
63  DWORD dwOldErrorMode;
64 
66  Module = CALL_SHIM(3, LOADLIBRARYEXWPROC)(lpLibFileName, hFile, dwFlags);
67  SetErrorMode(dwOldErrorMode);
68 
69  return Module;
70 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
HMODULE(WINAPI * LOADLIBRARYEXWPROC)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:70
_In_ HANDLE hFile
Definition: mswsock.h:90
#define SEM_NOOPENFILEERRORBOX
Definition: rtltypes.h:72

◆ APIHook_LoadLibraryW()

HMODULE WINAPI SHIM_OBJ_NAME() APIHook_LoadLibraryW ( LPCWSTR  lpLibFileName)

Definition at line 48 of file ignoreloadlibrary.c.

49 {
50  HMODULE Module;
51  DWORD dwOldErrorMode;
52 
54  Module = CALL_SHIM(2, LOADLIBRARYWPROC)(lpLibFileName);
55  SetErrorMode(dwOldErrorMode);
56 
57  return Module;
58 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:70
HMODULE(WINAPI * LOADLIBRARYWPROC)(LPCWSTR lpLibFileName)
#define SEM_NOOPENFILEERRORBOX
Definition: rtltypes.h:72