ReactOS  0.4.13-dev-1174-gdff75d7
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 303 of file versionlie.c.

304 {
305  static tSDBGETAPPPATCHDIR pSdbGetAppPatchDir = NULL;
306  HMODULE dll;
307  WCHAR buf[MAX_PATH] = {0};
308  if (!pSdbGetAppPatchDir)
309  {
310  dll = LoadLibraryA("apphelp.dll");
311  pSdbGetAppPatchDir = (tSDBGETAPPPATCHDIR)GetProcAddress(dll, "SdbGetAppPatchDir");
312 
313  if (!pSdbGetAppPatchDir)
314  {
315  skip("Unable to retrieve SdbGetAppPatchDir (%p, %p)\n", dll, pSdbGetAppPatchDir);
316  }
317  }
318 
319  if (!pSdbGetAppPatchDir || !SUCCEEDED(pSdbGetAppPatchDir(NULL, buf, MAX_PATH)))
320  {
321  skip("Unable to retrieve AppPatch dir, building manually\n");
323  {
324  skip("Unable to build AppPatch name(1)\n");
325  return FALSE;
326  }
327  if (!SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\AppPatch")))
328  {
329  skip("Unable to build AppPatch name(2)\n");
330  return FALSE;
331  }
332  }
333  if (!SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\")) ||
334  !SUCCEEDED(StringCchCatW(buf, _countof(buf), ShimDll)))
335  {
336  skip("Unable to append dll name\n");
337  return FALSE;
338  }
339 
340  dll = LoadLibraryW(buf);
341  if (!dll)
342  {
343  skip("Unable to load shim dll from AppPatch\n");
345 
346  if (SUCCEEDED(StringCchCatW(buf, _countof(buf), L"\\System32\\")) &&
347  SUCCEEDED(StringCchCatW(buf, _countof(buf), ShimDll)))
348  {
349  dll = LoadLibraryW(buf);
350  }
351 
352  if (!dll)
353  {
354  skip("Unable to load shim dll from System32 (Recent Win10)\n");
355  return FALSE;
356  }
357  }
358  *module = dll;
359  *ppGetHookAPIs = (tGETHOOKAPIS)GetProcAddress(dll, "GetHookAPIs");
360 
361  return *ppGetHookAPIs != NULL;
362 }
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:404
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:410
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ LoadShimDLL2()

tGETHOOKAPIS LoadShimDLL2 ( PCWSTR  ShimDll)

Definition at line 365 of file versionlie.c.

366 {
367  HMODULE module;
369 
370  if (LoadShimDLL(ShimDll, &module, &pGetHookAPIs))
371  {
372  if (!pGetHookAPIs)
373  skip("No GetHookAPIs found\n");
374  return pGetHookAPIs;
375  }
376  return NULL;
377 }
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:303

Referenced by START_TEST().