ReactOS 0.4.15-dev-7842-g558ab78
appshim_apitest.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagHOOKAPI
 

Macros

#define expect_shim   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_shim_imp
 

Typedefs

typedef struct tagHOOKAPI HOOKAPI
 
typedef struct tagHOOKAPIPHOOKAPI
 
typedef HRESULT(WINAPItSDBGETAPPPATCHDIR) (PVOID hsdb, LPWSTR path, DWORD size)
 
typedef PHOOKAPI(WINAPItGETHOOKAPIS) (LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount)
 

Functions

void expect_shim_imp (PHOOKAPI hook, PCSTR library, PCSTR function, PCSTR shim, int *same)
 
BOOL LoadShimDLL (PCWSTR ShimDll, HMODULE *module, tGETHOOKAPIS *ppGetHookAPIs)
 
tGETHOOKAPIS LoadShimDLL2 (PCWSTR ShimDll)
 

Macro Definition Documentation

◆ expect_shim

#define expect_shim   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_shim_imp

Definition at line 23 of file appshim_apitest.h.

Typedef Documentation

◆ HOOKAPI

◆ PHOOKAPI

◆ tGETHOOKAPIS

typedef PHOOKAPI(WINAPI * tGETHOOKAPIS) (LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount)

Definition at line 18 of file appshim_apitest.h.

◆ tSDBGETAPPPATCHDIR

typedef HRESULT(WINAPI * tSDBGETAPPPATCHDIR) (PVOID hsdb, LPWSTR path, DWORD size)

Definition at line 17 of file appshim_apitest.h.

Function Documentation

◆ expect_shim_imp()

void expect_shim_imp ( PHOOKAPI  hook,
PCSTR  library,
PCSTR  function,
PCSTR  shim,
int same 
)

Definition at line 45 of file versionlie.c.

46{
47 int lib = lstrcmpA(library, hook->LibraryName);
48 int fn = lstrcmpA(function, hook->FunctionName);
49 winetest_ok(lib == 0, "Expected LibrarayName to be %s, was: %s for %s\n", library, hook->LibraryName, shim);
50 winetest_ok(fn == 0, "Expected FunctionName to be %s, was: %s for %s\n", function, hook->FunctionName, shim);
51 *same = (lib == 0 && fn == 0);
52}
@ hook
Definition: SystemMenu.c:35
FT_Library library
Definition: cffdrivr.c:654
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

◆ LoadShimDLL()

BOOL LoadShimDLL ( PCWSTR  ShimDll,
HMODULE module,
tGETHOOKAPIS ppGetHookAPIs 
)

Definition at line 307 of file versionlie.c.

308{
309 static tSDBGETAPPPATCHDIR pSdbGetAppPatchDir = NULL;
310 HMODULE dll;
311 WCHAR buf[MAX_PATH] = {0};
312 if (!pSdbGetAppPatchDir)
313 {
314 dll = LoadLibraryA("apphelp.dll");
315 pSdbGetAppPatchDir = (tSDBGETAPPPATCHDIR)GetProcAddress(dll, "SdbGetAppPatchDir");
316
317 if (!pSdbGetAppPatchDir)
318 {
319 skip("Unable to retrieve SdbGetAppPatchDir (%p, %p)\n", dll, pSdbGetAppPatchDir);
320 }
321 }
322
323 if (!pSdbGetAppPatchDir || !SUCCEEDED(pSdbGetAppPatchDir(NULL, buf, MAX_PATH)))
324 {
325 skip("Unable to retrieve AppPatch dir, building manually\n");
327 {
328 skip("Unable to build AppPatch name(1)\n");
329 return FALSE;
330 }
331 if (!SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\AppPatch")))
332 {
333 skip("Unable to build AppPatch name(2)\n");
334 return FALSE;
335 }
336 }
337 if (!SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\")) ||
338 !SUCCEEDED(StringCchCatW(buf, _countof(buf), ShimDll)))
339 {
340 skip("Unable to append dll name\n");
341 return FALSE;
342 }
343
345 if (!dll)
346 {
347 skip("Unable to load shim dll from AppPatch\n");
349
350 if (SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\System32\\")) &&
352 {
354 }
355
356 if (!dll)
357 {
358 skip("Unable to load shim dll from System32 (Recent Win10)\n");
359 return FALSE;
360 }
361 }
362 *module = dll;
363 *ppGetHookAPIs = (tGETHOOKAPIS)GetProcAddress(dll, "GetHookAPIs");
364
365 return *ppGetHookAPIs != NULL;
366}
PHOOKAPI(WINAPI * tGETHOOKAPIS)(LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount)
HRESULT(WINAPI * tSDBGETAPPPATCHDIR)(PVOID hsdb, LPWSTR path, DWORD size)
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define LoadLibraryW(x)
Definition: compat.h:747
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2397
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static HMODULE dll
Definition: str.c:188
#define L(x)
Definition: ntvdm.h:50
#define _countof(array)
Definition: sndvol32.h:68
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LoadShimDLL2(), run_test(), and START_TEST().

◆ LoadShimDLL2()

tGETHOOKAPIS LoadShimDLL2 ( PCWSTR  ShimDll)

Definition at line 369 of file versionlie.c.

370{
373
374 if (LoadShimDLL(ShimDll, &module, &pGetHookAPIs))
375 {
376 if (!pGetHookAPIs)
377 skip("No GetHookAPIs found\n");
378 return pGetHookAPIs;
379 }
380 return NULL;
381}
BOOL LoadShimDLL(PCWSTR ShimDll, HMODULE *module, tGETHOOKAPIS *ppGetHookAPIs)
Definition: versionlie.c:307
static tGETHOOKAPIS pGetHookAPIs
Definition: versionlie.c:21

Referenced by START_TEST().