ReactOS  0.4.14-dev-1112-g2b067d6
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 }
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
FT_Library library
Definition: cffdrivr.c:654
Definition: msg.h:42
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)

◆ 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 
344  dll = LoadLibraryW(buf);
345  if (!dll)
346  {
347  skip("Unable to load shim dll from AppPatch\n");
349 
350  if (SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\System32\\")) &&
351  SUCCEEDED(StringCchCatW(buf, _countof(buf), ShimDll)))
352  {
353  dll = LoadLibraryW(buf);
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 }
UINT WINAPI GetSystemWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2396
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define _countof(array)
Definition: fontsub.cpp:30
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
static HMODULE dll
Definition: str.c:188
HRESULT(WINAPI * tSDBGETAPPPATCHDIR)(PVOID hsdb, LPWSTR path, DWORD size)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
PHOOKAPI(WINAPI * tGETHOOKAPIS)(LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:418
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ LoadShimDLL2()

tGETHOOKAPIS LoadShimDLL2 ( PCWSTR  ShimDll)

Definition at line 369 of file versionlie.c.

370 {
371  HMODULE module;
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 }
HMODULE module
Definition: main.cpp:47
smooth NULL
Definition: ftsmooth.c:416
PHOOKAPI(WINAPI * tGETHOOKAPIS)(LPCSTR szCommandLine, LPCWSTR wszShimName, PDWORD pdwHookCount)
static tGETHOOKAPIS pGetHookAPIs
Definition: versionlie.c:21
#define skip(...)
Definition: atltest.h:64
BOOL LoadShimDLL(PCWSTR ShimDll, HMODULE *module, tGETHOOKAPIS *ppGetHookAPIs)
Definition: versionlie.c:307

Referenced by START_TEST().