ReactOS  0.4.10-dev-19-g39281f0
env.c File Reference
#include <ntstatus.h>
#include <windows.h>
#include <shlwapi.h>
#include <winnt.h>
#include <userenv.h>
#include <winternl.h>
#include <winerror.h>
#include <stdio.h>
#include "wine/test.h"
#include "apphelp_apitest.h"
Include dependency graph for env.c:

Go to the source code of this file.

Classes

struct  ShimData_Win2k3
 
struct  ShimData_Win7
 
struct  ShimData_Win10_v1
 
struct  ShimData_Win10_v2
 
struct  ShimData_QueryOffset
 
struct  test_RemoteShimInfo
 

Macros

#define WIN32_NO_STATUS
 
#define SHIMDATA_MAGIC   0xAC0DEDAB
 
#define MAX_LAYER_LENGTH   256
 
#define SDB_DATABASE_MAIN_SHIM   0x80030000
 
#define SDBGMEF_IGNORE_ENVIRONMENT   0x1
 
#define expect_layeronly   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_layeronly_imp
 
#define RESET_CHECKRUNAPP_VARS()
 
#define CHECK_BASICS()
 
#define CHECKREASON(value, w10dum)   (g_ModuleVersion < WINVER_WIN10 ? value : w10dum)
 

Typedefs

typedef voidHSDB
 
typedef voidPDB
 
typedef DWORD TAGREF
 
typedef WORD TAG
 
typedef struct ShimData_Win2k3 ShimData_Win2k3
 
typedef struct ShimData_Win7 ShimData_Win7
 
typedef struct ShimData_Win10_v1 ShimData_Win10_v1
 
typedef struct ShimData_Win10_v2 ShimData_Win10_v2
 
typedef struct ShimData_QueryOffset ShimData_QueryOffset
 
typedef struct test_RemoteShimInfo test_RemoteShimInfo
 

Functions

 BOOL (WINAPI *pSdbGetMatchingExe)(HSDB hsdb
 
 HSDB (WINAPI *pSdbInitDatabase)(DWORD dwFlags
 
 void (WINAPI *pSdbReleaseDatabase)(HSDB hsdb)
 
 TAG (WINAPI *pSdbGetTagFromTagID)(PDB pdb
 
 TAGREF (WINAPI *pSdbGetLayerTagRef)(HSDB hsdb
 
 DWORD (WINAPI *pSdbGetAppCompatDataSize)(PVOID pData)
 
 C_ASSERT (sizeof(ShimData_Win2k3)==392)
 
 C_ASSERT (sizeof(ShimData_Win7)==1500)
 
 C_ASSERT (sizeof(ShimData_Win10_v1)==4712)
 
 C_ASSERT (sizeof(ShimData_Win10_v2)==3976)
 
 C_ASSERT (offsetof(ShimData_Win10_v2, dwSize)==0)
 
 C_ASSERT (offsetof(ShimData_Win2k3, dwSize)==68)
 
 C_ASSERT (offsetof(ShimData_Win7, dwSize)==520)
 
 C_ASSERT (offsetof(ShimData_Win10_v1, dwSize)==520)
 
 C_ASSERT (offsetof(ShimData_Win10_v2, dwMagic)==4)
 
 C_ASSERT (offsetof(ShimData_Win2k3, dwMagic)==72)
 
 C_ASSERT (offsetof(ShimData_Win7, dwMagic)==524)
 
 C_ASSERT (offsetof(ShimData_Win10_v1, dwMagic)==524)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwSize_10_v2)==0)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwSize_2k3)==68)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwSize_7_10)==520)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwMagic_10_v2)==4)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwMagic_2k3)==72)
 
 C_ASSERT (offsetof(ShimData_QueryOffset, dwMagic_7_10)==524)
 
static BOOL readproc (HANDLE proc, LPVOID address, PVOID target, DWORD size)
 
static BOOL get_shiminfo (HANDLE proc, test_RemoteShimInfo *info)
 
static HANDLE create_proc (BOOL suspended)
 
static void create_environ (const char *layers[], size_t num)
 
static void ValidateShim (TAGREF trLayer, const char *name)
 
static void Validate_ShimData_Win2k3 (PVOID data, size_t count, const char *layers[])
 
static void Validate_ShimData_Win7 (PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
 
static void Validate_ShimData_Win10_v2 (PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
 
static void Validate_ShimData_Win10 (PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
 
static void Validate_EmptyShimData_Win10 (PVOID data)
 
static void Test_layers (WCHAR szApphelp[256])
 
static void Test_repeatlayer (WCHAR szApphelp[256])
 
TAGREF find_layer (const char *szLayerStart, const char *szLayerEnd)
 
static void expect_layeronly_imp (SDBQUERYRESULT_VISTA *result, const char *layers, DWORD flags)
 
static void Test_Shimdata (SDBQUERYRESULT_VISTA *result, const WCHAR *szLayer)
 
static void Test_GetMatchingExe (void)
 
HANDLE xOpenFile (WCHAR *ApplicationName)
 
static BOOL call_ApphelpCheckRunApp (HANDLE FileHandle, PWCHAR ApplicationName, PVOID Environment, USHORT ExeType, PULONG Reason, PVOID *SdbQueryAppCompatData, PULONG SdbQueryAppCompatDataSize, PVOID *SxsData, PULONG SxsDataSize, PULONG FusionFlags)
 
static void Test_ApphelpCheckRunApp (WCHAR szApphelp[256])
 
 START_TEST (env)
 

Variables

static HMODULE hdll
 
LPCWSTR szPath
 
LPCWSTR LPCWSTR szModuleName
 
LPCWSTR LPCWSTR LPCWSTR pszEnvironment
 
LPCWSTR LPCWSTR LPCWSTR DWORD dwFlags
 
LPCWSTR LPCWSTR LPCWSTR DWORD
PSDBQUERYRESULT_VISTA 
pQueryResult
 
LPCWSTR pszDatabasePath
 
TAGREF trWhich
 
TAGREF PDBppdb
 
TAGREF PDB TAGIDptiWhich
 
TAGID tiWhich
 
LPCWSTR layerName
 
PVOID Unk1
 
PVOID PVOID Unk2
 
PVOID PVOID PWCHAR ApplicationName
 
PVOID PVOID PWCHAR PVOID Environment
 
PVOID PVOID PWCHAR PVOID USHORT ExeType
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG 
Reason
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID
SdbQueryAppCompatData
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG 
SdbQueryAppCompatDataSize
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG
PVOID
SxsData
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG
PVOID PULONG 
SxsDataSize
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG
PVOID PULONG PULONG 
FusionFlags
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG
PVOID PULONG PULONG PULONG64 
SomeFlag1
 
PVOID PVOID PWCHAR PVOID
USHORT PULONG PVOID PULONG
PVOID PULONG PULONG PULONG64
PULONG 
SomeFlag2
 
PVOID PVOID PWCHAR PVOID PVOID Unk3
 
PSDBQUERYRESULT_VISTA PVOIDppData
 
PSDBQUERYRESULT_VISTA PVOID DWORDdwSize
 
LPCWSTR pszImageName
 
LPCWSTR PVOID pData
 
static HSDB g_LayerDB
 
static DWORD g_ShimDataSize
 
static DWORD g_ModuleVersion
 
static const SDBQUERYRESULT_VISTA empty_result = { { 0 } }
 
static const SDBQUERYRESULT_VISTA almost_empty = { { 0 }, { 0 }, { 0 }, 0, 0, 0, 0, { 0 }, SHIMREG_DISABLE_LAYER, 0 }
 

Macro Definition Documentation

#define CHECK_BASICS ( )
Value:
do { \
ok(AppCompatData != NULL && AppCompatData != &Query, "Expected the pointer to be valid\n"); \
ok_hex(AppCompatDataSize, sizeof(SDBQUERYRESULT_VISTA)); \
ok(SxsData == NULL, "Expected the pointer to be NULL\n"); \
} while (0)
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:45
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_hex(expression, result)
Definition: test.h:758
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
int ret
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:45

Definition at line 849 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

#define CHECKREASON (   value,
  w10dum 
)    (g_ModuleVersion < WINVER_WIN10 ? value : w10dum)

Definition at line 860 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

#define expect_layeronly   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : expect_layeronly_imp

Definition at line 726 of file env.c.

Referenced by Test_ApphelpCheckRunApp(), and Test_GetMatchingExe().

#define MAX_LAYER_LENGTH   256

Definition at line 67 of file env.c.

#define RESET_CHECKRUNAPP_VARS ( )
Value:
do { \
if (AppCompatData && AppCompatData != &Query) { RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatData); } \
memset(&Query, 0, sizeof(Query)); \
AppCompatData = &Query; \
AppCompatDataSize = 123456; \
} while (0)
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:45
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
ULONG Reason
Definition: ntimage.h:533
smooth NULL
Definition: ftsmooth.c:416
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
if(!(yy_init))
Definition: macro.lex.yy.c:717
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
PVOID PVOID PWCHAR PVOID USHORT ExeType
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:45
#define memset(x, y, z)
Definition: compat.h:39

Definition at line 838 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

#define SDB_DATABASE_MAIN_SHIM   0x80030000

Definition at line 174 of file env.c.

Referenced by find_layer(), and ValidateShim().

#define SDBGMEF_IGNORE_ENVIRONMENT   0x1

Definition at line 176 of file env.c.

#define WIN32_NO_STATUS

Definition at line 9 of file env.c.

Typedef Documentation

typedef void* HSDB

Definition at line 26 of file env.c.

typedef void* PDB

Definition at line 27 of file env.c.

typedef WORD TAG

Definition at line 29 of file env.c.

typedef DWORD TAGREF

Definition at line 28 of file env.c.

Function Documentation

BOOL ( WINAPI pSdbGetMatchingExe)
C_ASSERT ( sizeof(ShimData_Win2k3 = =392)
C_ASSERT ( sizeof(ShimData_Win7 = =1500)
C_ASSERT ( sizeof(ShimData_Win10_v1 = =4712)
C_ASSERT ( sizeof(ShimData_Win10_v2 = =3976)
C_ASSERT ( offsetof(ShimData_Win10_v2, dwSize = =0)
C_ASSERT ( offsetof(ShimData_Win2k3, dwSize = =68)
C_ASSERT ( offsetof(ShimData_Win7, dwSize = =520)
C_ASSERT ( offsetof(ShimData_Win10_v1, dwSize = =520)
C_ASSERT ( offsetof(ShimData_Win10_v2, dwMagic)  = =4)
C_ASSERT ( offsetof(ShimData_Win2k3, dwMagic)  = =72)
C_ASSERT ( offsetof(ShimData_Win7, dwMagic)  = =524)
C_ASSERT ( offsetof(ShimData_Win10_v1, dwMagic)  = =524)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwSize_10_v2)  = =0)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwSize_2k3)  = =68)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwSize_7_10)  = =520)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwMagic_10_v2)  = =4)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwMagic_2k3)  = =72)
C_ASSERT ( offsetof(ShimData_QueryOffset, dwMagic_7_10)  = =524)
static BOOL call_ApphelpCheckRunApp ( HANDLE  FileHandle,
PWCHAR  ApplicationName,
PVOID  Environment,
USHORT  ExeType,
PULONG  Reason,
PVOID SdbQueryAppCompatData,
PULONG  SdbQueryAppCompatDataSize,
PVOID SxsData,
PULONG  SxsDataSize,
PULONG  FusionFlags 
)
static

Definition at line 863 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

866 {
867  ULONG64 SomeFlag1 = 0;
868  ULONG SomeFlag2 = 0;
869 
870  if (pApphelpCheckRunAppEx_w7)
871  {
872  return pApphelpCheckRunAppEx_w7(FileHandle, NULL, NULL, ApplicationName, Environment, ExeType, Reason,
874  FusionFlags, &SomeFlag1, &SomeFlag2);
875  }
876 
877  if (pApphelpCheckRunAppEx_w10)
878  {
879  return pApphelpCheckRunAppEx_w10(FileHandle, NULL, NULL, ApplicationName, Environment, NULL, ExeType, Reason,
881  FusionFlags, &SomeFlag1, &SomeFlag2);
882  }
883 
884  return FALSE;
885 }
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:45
ULONG Reason
Definition: ntimage.h:533
#define FALSE
Definition: types.h:117
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG PULONG64 SomeFlag1
Definition: env.c:45
smooth NULL
Definition: ftsmooth.c:416
unsigned __int64 ULONG64
Definition: imports.h:198
static HANDLE FileHandle
Definition: cabinet.c:48
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT ExeType
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG PULONG64 PULONG SomeFlag2
Definition: env.c:45
unsigned int ULONG
Definition: retypes.h:1
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID * SdbQueryAppCompatData
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG SdbQueryAppCompatDataSize
Definition: env.c:45
static void create_environ ( const char layers[],
size_t  num 
)
static

Definition at line 256 of file env.c.

Referenced by Test_layers().

257 {
258  char buf[256] = { 0 };
259  size_t n;
260  for (n = 0; n < num; ++n)
261  {
262  if (n)
263  strcat(buf, " ");
264  strcat(buf, layers[n]);
265  }
266  SetEnvironmentVariableA("__COMPAT_LAYER", buf);
267 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint n
Definition: s_context.h:57
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
GLuint GLuint num
Definition: glext.h:9618
static HANDLE create_proc ( BOOL  suspended)
static

Definition at line 238 of file env.c.

Referenced by Test_layers(), and Test_repeatlayer().

239 {
240  static char proc_name[MAX_PATH] = { 0 };
241  STARTUPINFOA si = {sizeof(si)};
243  BOOL res;
244  if (!proc_name[0])
245  {
246  GetModuleFileNameA(NULL, proc_name, MAX_PATH);
247  }
248 
249  res = CreateProcessA(NULL, proc_name, NULL, NULL, TRUE, suspended ? CREATE_SUSPENDED : 0, NULL, NULL, &si, &pi);
250  if (!res)
251  return NULL;
252  CloseHandle(pi.hThread);
253  return pi.hProcess;
254 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:545
#define CREATE_SUSPENDED
Definition: winbase.h:178
smooth NULL
Definition: ftsmooth.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4780
#define MAX_PATH
Definition: compat.h:26
static DWORD pi
Definition: protocol.c:147
GLuint res
Definition: glext.h:9613
DWORD ( WINAPI pSdbGetAppCompatDataSize)
static void expect_layeronly_imp ( SDBQUERYRESULT_VISTA result,
const char layers,
DWORD  flags 
)
static

Definition at line 568 of file env.c.

569 {
570  DWORD dwLayerCount = 0, n;
571  TAGREF atrLayers[SDB_MAX_LAYERS] = { 0 };
572 
573  const char* layer = layers, *nextlayer;
574  while (layer && *layer)
575  {
576  nextlayer = strchr(layer, ' ');
577  atrLayers[dwLayerCount++] = find_layer(layer, nextlayer ? nextlayer : (layer + strlen(layer)));
578  layer = nextlayer ? (nextlayer+1) : NULL;
579  }
580 
582  {
583  SDBQUERYRESULT_2k3* result2 = (SDBQUERYRESULT_2k3*)result;
584  result = NULL;
585 
586  winetest_ok(!memcmp(&result2->atrExes, &empty_result.atrExes, sizeof(result2->atrExes)), "Expected atrExes to be empty\n");
587  winetest_ok(!memcmp(&result2->atrLayers[dwLayerCount], &empty_result.atrLayers[dwLayerCount], sizeof(result2->atrLayers) - dwLayerCount * sizeof(result2->atrLayers[0])), "Expected atrLayers[+1] to be empty\n");
588  for (n = 0; n < dwLayerCount; ++n)
589  {
590  winetest_ok(result2->atrLayers[n] == atrLayers[n], "Expected atrLayers[%u] to be %x, was %x\n",
591  n, atrLayers[n], result2->atrLayers[n]);
592  }
593  winetest_ok(result2->dwLayerFlags == 0, "Expected dwLayerFlags to be 0, was %u\n", result2->dwLayerFlags);
594  winetest_ok(result2->trApphelp == 0, "Expected trApphelp to be 0, was %u\n", result2->trApphelp);
595  winetest_ok(result2->dwExeCount == 0, "Expected dwExeCount to be 0, was %u\n", result2->dwExeCount);
596  winetest_ok(result2->dwLayerCount == dwLayerCount, "Expected dwLayerCount to be %u, was %u\n", dwLayerCount, result2->dwLayerCount);
597  winetest_ok(!memcmp(&result2->guidID, &empty_result.guidID, sizeof(result2->guidID)), "Expected guidID to be empty\n");
598  winetest_ok(result2->dwFlags == flags, "Expected dwFlags to be 0x%x, was 0x%x\n", flags, result2->dwFlags);
599  winetest_ok(result2->dwCustomSDBMap == 1, "Expected dwCustomSDBMap to be 1, was %u\n", result2->dwCustomSDBMap);
600  winetest_ok(!memcmp(&result2->rgGuidDB[1], &empty_result.rgGuidDB[1], sizeof(result2->rgGuidDB) - sizeof(result2->rgGuidDB[0])), "Expected rgGuidDB[+1] to be empty\n");
601  }
602  else
603  {
604  winetest_ok(!memcmp(&result->atrExes, &empty_result.atrExes, sizeof(empty_result.atrExes)), "Expected atrExes to be empty\n");
605  winetest_ok(!memcmp(&result->adwExeFlags, &empty_result.adwExeFlags, sizeof(empty_result.adwExeFlags)), "Expected adwExeFlags to be empty\n");
606  winetest_ok(!memcmp(&result->atrLayers[dwLayerCount], &empty_result.atrLayers[dwLayerCount], sizeof(empty_result.atrLayers) - dwLayerCount * sizeof(empty_result.atrLayers[0])), "Expected atrLayers[+1] to be empty\n");
607  for (n = 0; n < dwLayerCount; ++n)
608  {
609  winetest_ok(result->atrLayers[n] == atrLayers[n], "Expected atrLayers[%u] to be %x, was %x\n",
610  n, atrLayers[n], result->atrLayers[n]);
611  }
612  winetest_ok(result->dwLayerFlags == 0, "Expected dwLayerFlags to be 0, was %u\n", result->dwLayerFlags);
613  winetest_ok(result->trApphelp == 0, "Expected trApphelp to be 0, was %u\n", result->trApphelp);
614  winetest_ok(result->dwExeCount == 0, "Expected dwExeCount to be 0, was %u\n", result->dwExeCount);
615  winetest_ok(result->dwLayerCount == dwLayerCount, "Expected dwLayerCount to be %u, was %u\n", dwLayerCount, result->dwLayerCount);
616  winetest_ok(!memcmp(&result->guidID, &empty_result.guidID, sizeof(empty_result.guidID)), "Expected guidID to be empty\n");
617  winetest_ok(result->dwFlags == flags, "Expected dwFlags to be 0x%x, was 0x%x\n", flags, result->dwFlags);
618  winetest_ok(result->dwCustomSDBMap == 1, "Expected dwCustomSDBMap to be 1, was %u\n", result->dwCustomSDBMap);
619  winetest_ok(!memcmp(&result->rgGuidDB[1], &empty_result.rgGuidDB[1], sizeof(empty_result.rgGuidDB) - sizeof(empty_result.rgGuidDB[0])), "Expected rgGuidDB[+1] to be empty\n");
620  }
621 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static DWORD g_ModuleVersion
Definition: env.c:61
DWORD DWORD
Definition: winlogon.h:75
GLuint n
Definition: s_context.h:57
TAGREF atrExes[SDB_MAX_EXES_VISTA]
DWORD dwLayerCount
Definition: db.cpp:804
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
DWORD TAGREF
Definition: sdbtypes.h:18
void __winetest_cdecl winetest_ok(int condition, const char *msg,...)
static const SDBQUERYRESULT_VISTA empty_result
Definition: env.c:62
GLbitfield flags
Definition: glext.h:7161
GUID rgGuidDB[SDB_MAX_SDBS]
TAGREF atrLayers[SDB_MAX_LAYERS]
TAGREF atrLayers[SDB_MAX_LAYERS]
#define WINVER_VISTA
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GUID rgGuidDB[SDB_MAX_SDBS]
DWORD adwExeFlags[SDB_MAX_EXES_VISTA]
#define SDB_MAX_LAYERS
Definition: apphelp.h:44
TAGREF atrExes[SDB_MAX_EXES_2k3]
TAGREF find_layer(const char *szLayerStart, const char *szLayerEnd)
Definition: env.c:553
TAGREF find_layer ( const char szLayerStart,
const char szLayerEnd 
)

Definition at line 553 of file env.c.

Referenced by expect_layeronly_imp().

554 {
555  char layer[100] = { 0 };
556  WCHAR layerW[100] = { 0 };
557  strncpy(layer, szLayerStart, szLayerEnd - szLayerStart);
558 
559  if (!g_LayerDB)
560  {
561  g_LayerDB = pSdbInitDatabase(SDB_DATABASE_MAIN_SHIM, 0);
562  }
563 
564  mbstowcs(layerW, layer, strlen(layer));
565  return pSdbGetLayerTagRef(g_LayerDB, layerW);
566 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
size_t __cdecl mbstowcs(_Out_writes_opt_z_(_MaxCount) wchar_t *_Dest, _In_z_ const char *_Source, _In_ size_t _MaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define SDB_DATABASE_MAIN_SHIM
Definition: env.c:174
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
static HSDB g_LayerDB
Definition: env.c:59
static BOOL get_shiminfo ( HANDLE  proc,
test_RemoteShimInfo info 
)
static

Definition at line 201 of file env.c.

Referenced by Test_layers(), and Test_repeatlayer().

202 {
204  ULONG sizeOut = 0;
205  NTSTATUS status = NtQueryInformationProcess(proc, ProcessBasicInformation, &pbi, sizeof(pbi), &sizeOut);
206  ok(NT_SUCCESS(status), "Expected NtQI to succeed, but failed with: %x\n", status);
207  memset(info, 0, sizeof(*info));
208  if (NT_SUCCESS(status))
209  {
210  PEB peb = { 0 };
211  if (readproc(proc, pbi.PebBaseAddress, &peb, sizeof(peb)))
212  {
213  MEMORY_BASIC_INFORMATION mbi = { 0 };
214  SIZE_T dwRead;
215 
216  info->AppCompatFlags = peb.AppCompatFlags;
218  info->AppCompatInfo = peb.AppCompatInfo;
219  if (peb.pShimData == NULL)
220  return TRUE;
221 
222  dwRead = VirtualQueryEx(proc, (LPCVOID)peb.pShimData, &mbi, sizeof(mbi));
223  ok(dwRead == sizeof(mbi), "Expected VQE to return %u, got %lu\n", sizeof(mbi), dwRead);
224  if (dwRead == sizeof(mbi) || peb.pShimData == NULL)
225  {
226  info->ShimDataSize = mbi.RegionSize;
227  info->pShimData = malloc(mbi.RegionSize);
228  if (readproc(proc, peb.pShimData, info->pShimData, mbi.RegionSize))
229  return TRUE;
230  free(info->pShimData);
231  info->pShimData = NULL;
232  }
233  }
234  }
235  return FALSE;
236 }
#define TRUE
Definition: types.h:120
ULARGE_INTEGER AppCompatFlagsUser
Definition: winternl.h:337
#define free
Definition: debug_ros.c:5
DWORD ShimDataSize
Definition: env.c:184
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
static HANDLE proc()
Definition: pdb.c:31
ULARGE_INTEGER AppCompatFlagsUser
Definition: env.c:182
#define FALSE
Definition: types.h:117
static BOOL readproc(HANDLE proc, LPVOID address, PVOID target, DWORD size)
Definition: env.c:189
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PERBANDINFO * pbi
Definition: winddi.h:3917
PVOID pShimData
Definition: env.c:183
#define ok(value,...)
Definition: CComObject.cpp:34
SIZE_T NTAPI VirtualQueryEx(IN HANDLE hProcess, IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
Definition: virtmem.c:236
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
PVOID AppCompatInfo
Definition: env.c:185
PVOID AppCompatInfo
Definition: winternl.h:339
ULONG_PTR SIZE_T
Definition: typedefs.h:78
ULARGE_INTEGER AppCompatFlags
Definition: winternl.h:336
CONST void * LPCVOID
Definition: windef.h:191
unsigned int ULONG
Definition: retypes.h:1
ULARGE_INTEGER AppCompatFlags
Definition: env.c:181
#define malloc
Definition: debug_ros.c:4
#define memset(x, y, z)
Definition: compat.h:39
Definition: ps.c:97
HSDB ( WINAPI pSdbInitDatabase)
static BOOL readproc ( HANDLE  proc,
LPVOID  address,
PVOID  target,
DWORD  size 
)
static

Definition at line 189 of file env.c.

Referenced by get_shiminfo(), and TIFFClientOpen().

190 {
191  SIZE_T dwRead;
192  if (ReadProcessMemory(proc, address, target, size, &dwRead))
193  {
194  ok(dwRead == size, "Expected to read %u bytes, got %lu\n", size, dwRead);
195  return dwRead == size;
196  }
197  ok(0, "RPM failed with %u\n", GetLastError());
198  return FALSE;
199 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:415
static HANDLE proc()
Definition: pdb.c:31
#define FALSE
Definition: types.h:117
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
ULONG_PTR SIZE_T
Definition: typedefs.h:78
START_TEST ( env  )

Definition at line 1243 of file env.c.

1244 {
1245  WCHAR szApphelp[MAX_PATH];
1246  ShimData_QueryOffset QueryOffset;
1247  DWORD ShimDataType;
1248  NTSTATUS ExceptionStatus = STATUS_SUCCESS;
1249 
1250  //SetEnvironmentVariable("SHIM_DEBUG_LEVEL", "127");
1251  //SetEnvironmentVariable("SHIMENG_DEBUG_LEVEL", "127");
1252 
1254 
1255  hdll = LoadLibraryA("apphelp.dll");
1256 
1257 
1258 
1261  trace("Detected host: 0x%x, module: 0x%x\n", g_WinVersion, g_ModuleVersion);
1262 
1263  GetModuleFileNameW(hdll, szApphelp, _countof(szApphelp));
1264 
1265 
1266  pSdbGetMatchingExe = (void*)GetProcAddress(hdll, "SdbGetMatchingExe");
1267  pSdbInitDatabase = (void*)GetProcAddress(hdll, "SdbInitDatabase");
1268  pSdbReleaseDatabase = (void*)GetProcAddress(hdll, "SdbReleaseDatabase");
1269  pSdbTagRefToTagID = (void*)GetProcAddress(hdll, "SdbTagRefToTagID");
1270  pSdbGetTagFromTagID = (void*)GetProcAddress(hdll, "SdbGetTagFromTagID");
1271  pSdbGetLayerTagRef = (void*)GetProcAddress(hdll, "SdbGetLayerTagRef");
1272 
1273  switch (g_ModuleVersion)
1274  {
1275  case WINVER_WIN7:
1276  pApphelpCheckRunAppEx_w7 = (void*)GetProcAddress(hdll, "ApphelpCheckRunAppEx");
1277  break;
1278  case WINVER_WIN10:
1279  pApphelpCheckRunAppEx_w10 = (void*)GetProcAddress(hdll, "ApphelpCheckRunAppEx");
1280  break;
1281  default:
1282  skip("Unknown apphelp.dll version %x, cannot determine which ApphelpCheckRunApp(Ex) function to use\n", g_ModuleVersion);
1283  break;
1284  }
1285 
1286  pSdbPackAppCompatData = (void*)GetProcAddress(hdll, "SdbPackAppCompatData");
1287  pSdbUnpackAppCompatData = (void*)GetProcAddress(hdll, "SdbUnpackAppCompatData");
1288  pSdbGetAppCompatDataSize = (void*)GetProcAddress(hdll, "SdbGetAppCompatDataSize");
1289 
1290 
1291  memset(&QueryOffset, 0, sizeof(QueryOffset));
1292  QueryOffset.dwMagic_2k3 = QueryOffset.dwMagic_7_10 = QueryOffset.dwMagic_10_v2 = SHIMDATA_MAGIC;
1293  QueryOffset.dwSize_2k3 = 1;
1294  QueryOffset.dwSize_7_10 = 2;
1295  QueryOffset.dwSize_10_v2 = 3;
1296 
1297  g_ShimDataSize = g_WinVersion < WINVER_WIN10 ? 4096 : 8192;
1298  _SEH2_TRY
1299  {
1300  ShimDataType = pSdbGetAppCompatDataSize(&QueryOffset);
1301  }
1303  {
1304  ExceptionStatus = _SEH2_GetExceptionCode();
1305  }
1306  _SEH2_END;
1307 
1308  ok(ExceptionStatus == STATUS_SUCCESS, "Exception 0x%08x, expected 0x%08x\n", ExceptionStatus, STATUS_SUCCESS);
1309  if (ExceptionStatus != STATUS_SUCCESS)
1310  {
1311  skip("SdbGetAppCompatDataSize not functional\n");
1312  return;
1313  }
1314 
1315  /* New version of Win10.. */
1316  if (g_WinVersion == WINVER_WIN10 && ShimDataType == 3)
1317  g_ShimDataSize = 4096;
1318 
1320  {
1321  Test_layers(szApphelp);
1322  Test_repeatlayer(szApphelp);
1323  }
1324  else
1325  {
1326  skip("Tests requiring process launch, reported OS version (0x%x) does not match apphelp version (0x%x)\n", g_WinVersion, g_ModuleVersion);
1327  }
1328 
1329  {
1331  }
1332 
1333  Test_ApphelpCheckRunApp(szApphelp);
1334  if (g_LayerDB)
1335  pSdbReleaseDatabase(g_LayerDB);
1336 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:606
static HMODULE hdll
Definition: env.c:33
#define trace(...)
Definition: kmt_test.h:217
static void Test_repeatlayer(WCHAR szApphelp[256])
Definition: env.c:509
static void Test_layers(WCHAR szApphelp[256])
Definition: env.c:440
__wchar_t WCHAR
Definition: xmlstorage.h:180
return STATUS_SUCCESS
Definition: btrfs.c:2690
#define _countof(array)
Definition: fontsub.cpp:30
DWORD get_module_version(HMODULE mod)
Definition: data.c:803
static DWORD g_ModuleVersion
Definition: env.c:61
DWORD DWORD
Definition: winlogon.h:75
_SEH2_TRY
Definition: create.c:4250
DWORD dwMagic_7_10
Definition: env.c:145
DWORD get_host_winver(void)
Definition: data.c:788
DWORD dwMagic_2k3
Definition: env.c:140
#define WINVER_WIN10
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD dwMagic_10_v2
Definition: env.c:135
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static DWORD g_WinVersion
#define ok(value,...)
Definition: CComObject.cpp:34
LONG NTSTATUS
Definition: precomp.h:26
static void Test_GetMatchingExe(void)
Definition: env.c:729
#define MAX_PATH
Definition: compat.h:26
static DWORD g_ShimDataSize
Definition: env.c:60
#define WINVER_WIN7
void silence_debug_output(void)
Definition: data.c:833
DWORD dwSize_7_10
Definition: env.c:144
#define SHIMDATA_MAGIC
Definition: env.c:66
static HSDB g_LayerDB
Definition: env.c:59
_SEH2_END
Definition: create.c:4424
#define skip(...)
Definition: CString.cpp:57
static void Test_ApphelpCheckRunApp(WCHAR szApphelp[256])
Definition: env.c:891
DWORD dwSize_2k3
Definition: env.c:139
#define GetProcAddress(x, y)
Definition: compat.h:410
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwSize_10_v2
Definition: env.c:134
TAG ( WINAPI pSdbGetTagFromTagID)
TAGREF ( WINAPI pSdbGetLayerTagRef)
static void Test_ApphelpCheckRunApp ( WCHAR  szApphelp[256])
static

Definition at line 891 of file env.c.

Referenced by START_TEST().

892 {
893  BOOL ret;
895  WCHAR ApplicationName[MAX_PATH], EmptyName[1] = { 0 };
896  DWORD expect_flags = (g_WinVersion < WINVER_WIN10) ? 1 : 0x21;
897 
898  USHORT ExeType;
899  PVOID AppCompatData = NULL, SxsData, DuplicatedEnv, Environment;
900  ULONG AppCompatDataSize, SxsDataSize, FusionFlags;
901  ULONG Reason;
903  int n;
904  /* this are the only interesting bits (with the exception of '1', which is there to invoke the 'default' case) */
905  const int kTestBits = 0x70503;
906 
907  if (!pApphelpCheckRunAppEx_w7 && !pApphelpCheckRunAppEx_w10)
908  {
909  skip("No usable ApphelpCheckRunAppEx\n");
910  return;
911  }
912 
913  GetModuleFileNameW(NULL, ApplicationName, MAX_PATH);
914 
915  FileHandle = xOpenFile(ApplicationName);
916  SetEnvironmentVariableA("__COMPAT_LAYER", NULL);
917  if (!CreateEnvironmentBlock(&DuplicatedEnv, NULL, TRUE))
918  DuplicatedEnv = NULL;
919  ok(DuplicatedEnv != NULL, "Invalid env (%u)\n", GetLastError());
920 
921  /* First with the environment without __COMPAT_LAYER */
923 
924  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, DuplicatedEnv, ExeType, &Reason,
925  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
926 
927  CHECK_BASICS();
928  ok_hex(Reason, CHECKREASON(0x30000, 0));
929  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
930 
931  /* We need this to be set for tests later on. */
932  SetEnvironmentVariableA("__COMPAT_LAYER", "256Color");
933 
935  {
936  /* Showing that when an environment is passed in, that is used instead of the current.
937  In Win10 this behavior is no longer observed */
938 
940 
941  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, DuplicatedEnv, ExeType, &Reason,
942  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
943 
944  CHECK_BASICS();
945  ok_hex(Reason, CHECKREASON(0x30000, 0));
946  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
947  }
948 
949  for (n = 0; n < 32; ++n)
950  {
951  ULONG ExpectedReason;
952  if (!(kTestBits & (1<<n)))
953  continue;
955  ExpectedReason = Reason = (1 << n);
956  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, DuplicatedEnv, ExeType, &Reason,
957  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
958 
959  CHECK_BASICS();
960  if (ExpectedReason == 2)
961  ExpectedReason = 2;
962  else if (ExpectedReason == 0x100)
963  ExpectedReason = 0x30000;
964  else
965  ExpectedReason |= 0x30000;
966  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
967  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
968  }
969 
971  {
972  /* Now, using a NULL env, showing that the current environment is used.
973  W10 does no longer do this, so we skip this test here. */
974  Environment = NULL;
975 
977 
978  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
979  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
980 
981  CHECK_BASICS();
982  ok_hex(Reason, CHECKREASON(0x50000, 0));
983  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
984  expect_layeronly(AppCompatData, "256Color", expect_flags);
985 
986  for (n = 0; n < 32; ++n)
987  {
988  ULONG ExpectedReason;
990  if (!(kTestBits & (1<<n)))
991  continue;
992  ExpectedReason = Reason = (1 << n);
993  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
994  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
995 
996  CHECK_BASICS();
997  if (ExpectedReason == 2)
998  ExpectedReason = 2;
999  else if (ExpectedReason == 0x100)
1000  ExpectedReason = 0x50000;
1001  else if (ExpectedReason == 0x400)
1002  ExpectedReason = 0x30400;
1003  else
1004  ExpectedReason |= 0x50000;
1005  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1006  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1007  {
1008  if (ExpectedReason != 0x30400)
1009  expect_layeronly(AppCompatData, "256Color", expect_flags);
1010  else
1011  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1012  }
1013  }
1014  }
1015 
1016  /* Passing in an environment with __COMPAT_LAYER set */
1017  Environment = GetEnvironmentStringsW();
1018 
1020 
1021  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1022  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1023 
1024  CHECK_BASICS();
1025  ok_hex(Reason, CHECKREASON(0x50000, 0));
1026  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1027  expect_layeronly(AppCompatData, "256Color", expect_flags);
1028 
1029  for (n = 0; n < 32; ++n)
1030  {
1031  ULONG ExpectedReason;
1032  if (!(kTestBits & (1<<n)))
1033  continue;
1035  ExpectedReason = Reason = (1 << n);
1036  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1037  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1038 
1039  CHECK_BASICS();
1040  if (ExpectedReason == 2)
1041  ExpectedReason = 2;
1042  else if (ExpectedReason == 0x100)
1043  ExpectedReason = 0x50000;
1044  else if (ExpectedReason == 0x400)
1045  ExpectedReason = 0x30400;
1046  else
1047  ExpectedReason |= 0x50000;
1048  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1049  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1050  {
1051  if (ExpectedReason != 0x30400 || g_ModuleVersion >= WINVER_WIN10)
1052  expect_layeronly(AppCompatData, "256Color", expect_flags);
1053  else
1054  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1055  }
1056  }
1057 
1058  /* NULL file handle still works */
1060 
1061  ret = call_ApphelpCheckRunApp(NULL, ApplicationName, Environment, ExeType, &Reason,
1062  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1063 
1064  CHECK_BASICS();
1065  ok_hex(Reason, CHECKREASON(0x50000, 0));
1066  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1067  expect_layeronly(AppCompatData, "256Color", expect_flags);
1068 
1069  for (n = 0; n < 32; ++n)
1070  {
1071  ULONG ExpectedReason;
1073  if (!(kTestBits & (1<<n)))
1074  continue;
1075  ExpectedReason = Reason = (1 << n);
1076  ret = call_ApphelpCheckRunApp(NULL, ApplicationName, Environment, ExeType, &Reason,
1077  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1078 
1079  CHECK_BASICS();
1080  if (ExpectedReason == 2)
1081  ExpectedReason = 2;
1082  else if (ExpectedReason == 0x100)
1083  ExpectedReason = 0x50000;
1084  else if (ExpectedReason == 0x400)
1085  ExpectedReason = 0x30400;
1086  else
1087  ExpectedReason |= 0x50000;
1088  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1089  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1090  {
1091  /* W10 does not use the flags anymore? */
1092  if (ExpectedReason != 0x30400 || g_ModuleVersion >= WINVER_WIN10)
1093  expect_layeronly(AppCompatData, "256Color", expect_flags);
1094  else
1095  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1096  }
1097  }
1098 
1099 
1100  /* INVALID_HANDLE_VALUE file handle results in failure (according to flags!), but still results in AppCompatData */
1102 
1103  ret = call_ApphelpCheckRunApp(INVALID_HANDLE_VALUE, ApplicationName, Environment, ExeType, &Reason,
1104  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1105 
1106  CHECK_BASICS();
1107  ok_hex(Reason, 0);
1108  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1109  expect_layeronly(AppCompatData, "256Color", expect_flags);
1110 
1111  for (n = 0; n < 32; ++n)
1112  {
1113  ULONG ExpectedReason;
1114  if (!(kTestBits & (1<<n)))
1115  continue;
1117  ExpectedReason = Reason = (1 << n);
1118  ret = call_ApphelpCheckRunApp(INVALID_HANDLE_VALUE, NULL, Environment, ExeType, &Reason,
1119  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1120 
1121  CHECK_BASICS();
1122  if (ExpectedReason == 0x100)
1123  ExpectedReason = 0;
1124  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1125  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1126  {
1127  if (ExpectedReason != 0x400 && g_ModuleVersion < WINVER_WIN7)
1128  expect_layeronly(AppCompatData, "256Color", expect_flags);
1129  else
1130  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1131  }
1132  }
1133 
1134  /* NULL filename crashes, showing this in the log before going down:
1135 [Err ][SdbpGetLongFileName ] Failed to get NT path name for ""
1136 [Err ][SdbpCreateSearchDBContext] Unable to parse executable path for "".
1137 [Err ][SdbGetMatchingExe ] Failed to create search DB context.
1138 */
1140 
1141  ret = call_ApphelpCheckRunApp(FileHandle, EmptyName, Environment, ExeType, &Reason,
1142  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1143 
1144  CHECK_BASICS();
1145  ok_hex(Reason, CHECKREASON(0x30000, 0));
1146  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1147  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1148 
1149  /* 0 ExeType = don't care? */
1151  ExeType = 0;
1152 
1153  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1154  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1155 
1156  CHECK_BASICS();
1157  ok_hex(Reason, CHECKREASON(0x50000, 0));
1158  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1159  expect_layeronly(AppCompatData, "256Color", expect_flags);
1160 
1161  for (n = 0; n < 32; ++n)
1162  {
1163  ULONG ExpectedReason;
1164  if (!(kTestBits & (1<<n)))
1165  continue;
1167  ExeType = 0;
1168  ExpectedReason = Reason = (1 << n);
1169  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1170  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1171 
1172  CHECK_BASICS();
1173  if (ExpectedReason == 2)
1174  ExpectedReason = 2;
1175  else if (ExpectedReason == 0x100)
1176  ExpectedReason = 0x50000;
1177  else if (ExpectedReason == 0x400)
1178  ExpectedReason = 0x30400;
1179  else
1180  ExpectedReason |= 0x50000;
1181  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1182  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1183  {
1184  if (ExpectedReason != 0x30400 || g_ModuleVersion >= WINVER_WIN10)
1185  expect_layeronly(AppCompatData, "256Color", expect_flags);
1186  else
1187  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1188  }
1189  }
1190 
1191 
1193  ExeType = IMAGE_FILE_MACHINE_POWERPCFP;
1194 
1195  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1196  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1197 
1198  CHECK_BASICS();
1199  ok_hex(Reason, CHECKREASON(0x50000, 0));
1200  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1201  expect_layeronly(AppCompatData, "256Color", expect_flags);
1202 
1203  for (n = 0; n < 32; ++n)
1204  {
1205  ULONG ExpectedReason;
1206  if (!(kTestBits & (1<<n)))
1207  continue;
1209  ExeType = IMAGE_FILE_MACHINE_POWERPCFP;
1210  ExpectedReason = Reason = (1 << n);
1211  ret = call_ApphelpCheckRunApp(FileHandle, ApplicationName, Environment, ExeType, &Reason,
1212  &AppCompatData, &AppCompatDataSize, &SxsData, &SxsDataSize, &FusionFlags);
1213 
1214  CHECK_BASICS();
1215  if (ExpectedReason == 2)
1216  ExpectedReason = 2;
1217  else if (ExpectedReason == 0x100)
1218  ExpectedReason = 0x50000;
1219  else if (ExpectedReason == 0x400)
1220  ExpectedReason = 0x30400;
1221  else
1222  ExpectedReason |= 0x50000;
1223  ok_hex(Reason, CHECKREASON(ExpectedReason, (1 << n)));
1224  if (AppCompatData && AppCompatDataSize == sizeof(SDBQUERYRESULT_VISTA))
1225  {
1226  if (ExpectedReason != 0x30400 || g_ModuleVersion >= WINVER_WIN10)
1227  expect_layeronly(AppCompatData, "256Color", expect_flags);
1228  else
1229  ok(!memcmp(AppCompatData, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
1230  }
1231  }
1232 
1233 
1234  if (AppCompatData && AppCompatData != &Query)
1235  RtlFreeHeap(RtlGetProcessHeap(), 0, AppCompatData);
1236 
1237  FreeEnvironmentStringsW(Environment);
1238  DestroyEnvironmentBlock(DuplicatedEnv);
1239  NtClose(FileHandle);
1240 }
DWORD *typedef PVOID
Definition: winlogon.h:52
static BOOL call_ApphelpCheckRunApp(HANDLE FileHandle, PWCHAR ApplicationName, PVOID Environment, USHORT ExeType, PULONG Reason, PVOID *SdbQueryAppCompatData, PULONG SdbQueryAppCompatDataSize, PVOID *SxsData, PULONG SxsDataSize, PULONG FusionFlags)
Definition: env.c:863
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:606
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG PULONG FusionFlags
Definition: env.c:45
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define expect_layeronly
Definition: env.c:726
static DWORD g_ModuleVersion
Definition: env.c:61
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
DWORD DWORD
Definition: winlogon.h:75
GLuint n
Definition: s_context.h:57
#define WINVER_WIN10
smooth NULL
Definition: ftsmooth.c:416
static DWORD g_WinVersion
#define ok(value,...)
Definition: CComObject.cpp:34
#define ok_hex(expression, result)
Definition: test.h:758
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI FreeEnvironmentStringsW(IN LPWSTR EnvironmentStrings)
Definition: environ.c:389
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
#define MAX_PATH
Definition: compat.h:26
static const SDBQUERYRESULT_VISTA empty_result
Definition: env.c:62
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3392
int ret
#define WINVER_WIN7
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:727
static HANDLE FileHandle
Definition: cabinet.c:48
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:45
DWORD *typedef HANDLE
Definition: winlogon.h:52
PVOID PVOID PWCHAR PVOID USHORT ExeType
Definition: env.c:45
unsigned short USHORT
Definition: pedump.c:61
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID PULONG SxsDataSize
Definition: env.c:45
#define skip(...)
Definition: CString.cpp:57
LPWSTR WINAPI GetEnvironmentStringsW(VOID)
Definition: environ.c:344
unsigned int ULONG
Definition: retypes.h:1
PVOID PVOID PWCHAR PVOID USHORT PULONG PVOID PULONG PVOID * SxsData
Definition: env.c:45
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:45
HANDLE xOpenFile(WCHAR *ApplicationName)
Definition: env.c:802
#define CHECKREASON(value, w10dum)
Definition: env.c:860
#define IMAGE_FILE_MACHINE_POWERPCFP
Definition: ntimage.h:28
#define RESET_CHECKRUNAPP_VARS()
Definition: env.c:838
#define CHECK_BASICS()
Definition: env.c:849
static void Test_GetMatchingExe ( void  )
static

Definition at line 729 of file env.c.

Referenced by START_TEST().

730 {
731  BOOL ret;
732  SDBQUERYRESULT_VISTA result = { { 0 } };
733  WCHAR self[MAX_PATH];
734  DWORD flags = (g_WinVersion < WINVER_VISTA) ? 0 : ((g_WinVersion < WINVER_WIN10) ? 1 : 0x21);
735 
737  SetEnvironmentVariableA("__COMPAT_LAYER", NULL);
738 
739  /* szPath cannot be NULL! */
740  ret = pSdbGetMatchingExe(NULL, L"", NULL, NULL, 0, &result);
741  ok(ret == FALSE, "Expected ret to be FALSE\n");
742  ok(!memcmp(&result, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
743 
744  result = empty_result;
745 
746  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
747  ok(ret == FALSE, "Expected ret to be FALSE\n");
748  ok(!memcmp(&result, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
749 
750  result = empty_result;
751  SetEnvironmentVariableA("__COMPAT_LAYER", "Some_invalid_layer_name");
752 
753  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
754  ok(ret == FALSE, "Expected ret to be FALSE\n");
756  ok(!memcmp(&result, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
757  else
758  ok(!memcmp(&result, &almost_empty, sizeof(almost_empty)), "Expected result to be almost empty\n");
759 
760  result = empty_result;
761  SetEnvironmentVariableA("__COMPAT_LAYER", "256Color");
762 
763  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
764  ok(ret == TRUE, "Expected ret to be TRUE\n");
765  expect_layeronly(&result, "256Color", flags);
766 
767  Test_Shimdata(&result, L"256Color");
768 
769  result = empty_result;
770  SetEnvironmentVariableA("__COMPAT_LAYER", "640X480");
771 
772  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
773  ok(ret == TRUE, "Expected ret to be TRUE\n");
774  expect_layeronly(&result, "640X480", flags);
775 
776  Test_Shimdata(&result, L"640X480");
777 
778  /* HIGHDPIAWARE does not exist in 2k3 */
780  {
781  result = empty_result;
782  SetEnvironmentVariableA("__COMPAT_LAYER", "HIGHDPIAWARE");
783 
784  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
785  ok(ret == TRUE, "Expected ret to be TRUE\n");
786  expect_layeronly(&result, "HIGHDPIAWARE", flags);
787 
788  Test_Shimdata(&result, L"HIGHDPIAWARE");
789 
790  result = empty_result;
791  SetEnvironmentVariableA("__COMPAT_LAYER", "256Color HIGHDPIAWARE 640X480");
792 
793  ret = pSdbGetMatchingExe(NULL, self, NULL, NULL, 0, &result);
794  ok(ret == TRUE, "Expected ret to be TRUE\n");
795  expect_layeronly(&result, "256Color HIGHDPIAWARE 640X480", flags);
796 
797  Test_Shimdata(&result, L"256Color HIGHDPIAWARE 640X480");
798  }
799 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:606
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: bidi.c:85
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void Test_Shimdata(SDBQUERYRESULT_VISTA *result, const WCHAR *szLayer)
Definition: env.c:623
#define expect_layeronly
Definition: env.c:726
DWORD DWORD
Definition: winlogon.h:75
#define FALSE
Definition: types.h:117
#define WINVER_WIN10
smooth NULL
Definition: ftsmooth.c:416
static DWORD g_WinVersion
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
#define MAX_PATH
Definition: compat.h:26
static const SDBQUERYRESULT_VISTA empty_result
Definition: env.c:62
static const SDBQUERYRESULT_VISTA almost_empty
Definition: env.c:63
GLbitfield flags
Definition: glext.h:7161
int ret
#define WINVER_VISTA
#define WINVER_2003
GLuint64EXT * result
Definition: glext.h:11304
static void Test_layers ( WCHAR  szApphelp[256])
static

Definition at line 440 of file env.c.

Referenced by START_TEST().

441 {
442  static const char* layers[] = {
443  "256Color", "NT4SP5", "DisableNXHideUI", "DisableNXShowUI",
444  "WIN2000SP3", "640X480", /*"DISABLEDWM",*/ "HIGHDPIAWARE",
445  /*"RUNASADMIN",*/ "DISABLETHEMES" /*, "Layer_Win95VersionLie"*/ };
446 
447  size_t n;
448  HANDLE proc;
450  BOOL res;
451 
452  for (n = 0; n <= (sizeof(layers) / sizeof(layers[0])); ++n)
453  {
454  create_environ(layers, n);
455 
456  proc = create_proc(TRUE);
457  res = get_shiminfo(proc, &info);
458  TerminateProcess(proc, 0);
459  CloseHandle(proc);
460 
461  if (!res)
462  {
463  ok(0, "Unable to get process info (%u)!\n", n);
464  continue;
465  }
466 
467  if (n == 0)
468  {
469  ok(info.AppCompatFlags.QuadPart == 0, "Expected AppCompatFlags to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlags.QuadPart));
470  ok(info.AppCompatFlagsUser.QuadPart == 0, "Expected AppCompatFlagsUser to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlagsUser.QuadPart));
471  ok(info.AppCompatInfo == NULL, "Expected AppCompatInfo to be NULL, was: %p\n", info.AppCompatInfo);
473  {
474  ok(info.pShimData == NULL, "Expected pShimData to be NULL, was: %p\n", info.pShimData);
475  }
476  else
477  {
479  }
480  }
481  else
482  {
483  ok(info.AppCompatFlags.QuadPart == 0, "Expected AppCompatFlags to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlags.QuadPart));
484  ok(info.AppCompatFlagsUser.QuadPart == 0, "Expected AppCompatFlagsUser to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlagsUser.QuadPart));
485  ok(info.AppCompatInfo == NULL, "Expected AppCompatInfo to be NULL, was: %p\n", info.AppCompatInfo);
486  ok(info.pShimData != NULL, "Expected pShimData to be valid, was NULL\n");
487  ok(info.ShimDataSize == g_ShimDataSize, "Expected ShimDataSize to be %u, was: %u\n", g_ShimDataSize, info.ShimDataSize);
488  if (info.pShimData)
489  {
491  Validate_ShimData_Win2k3(info.pShimData, n, layers);
492  else if (g_WinVersion < WINVER_WIN10)
493  Validate_ShimData_Win7(info.pShimData, szApphelp, n, layers);
494  else
495  Validate_ShimData_Win10(info.pShimData, szApphelp, n, layers);
496  }
497  }
498  free(info.pShimData);
499  }
500 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
static void Validate_EmptyShimData_Win10(PVOID data)
Definition: env.c:411
#define free
Definition: debug_ros.c:5
DWORD ShimDataSize
Definition: env.c:184
static HANDLE create_proc(BOOL suspended)
Definition: env.c:238
static HANDLE proc()
Definition: pdb.c:31
ULARGE_INTEGER AppCompatFlagsUser
Definition: env.c:182
GLuint n
Definition: s_context.h:57
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
static void create_environ(const char *layers[], size_t num)
Definition: env.c:256
#define WINVER_WIN10
smooth NULL
Definition: ftsmooth.c:416
static BOOL get_shiminfo(HANDLE proc, test_RemoteShimInfo *info)
Definition: env.c:201
PVOID pShimData
Definition: env.c:183
static DWORD g_WinVersion
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID AppCompatInfo
Definition: env.c:185
static DWORD g_ShimDataSize
Definition: env.c:60
const XML_Char XML_Encoding * info
Definition: expat.h:530
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define WINVER_VISTA
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1589
GLuint res
Definition: glext.h:9613
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
ULARGE_INTEGER AppCompatFlags
Definition: env.c:181
static void Validate_ShimData_Win2k3(PVOID data, size_t count, const char *layers[])
Definition: env.c:298
static void Validate_ShimData_Win7(PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
Definition: env.c:309
static void Validate_ShimData_Win10(PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
Definition: env.c:375
static void Test_repeatlayer ( WCHAR  szApphelp[256])
static

Definition at line 509 of file env.c.

Referenced by START_TEST().

510 {
511  static const char* layers[] = {
512  "256Color", "256Color", "256Color", "256Color",
513  "256Color", "256Color", "256Color", "256Color" };
514 
515  HANDLE proc;
517  BOOL res;
518 
519  SetEnvironmentVariableA("__COMPAT_LAYER", "256Color 256Color 256Color 256Color 256Color 256Color 256Color 256Color");
520 
521 
522  proc = create_proc(TRUE);
523  res = get_shiminfo(proc, &info);
524  TerminateProcess(proc, 0);
525  CloseHandle(proc);
526 
527  if (res)
528  {
529  ok(info.AppCompatFlags.QuadPart == 0, "Expected AppCompatFlags to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlags.QuadPart));
530  ok(info.AppCompatFlagsUser.QuadPart == 0, "Expected AppCompatFlagsUser to be 0, was: %s\n", wine_dbgstr_longlong(info.AppCompatFlagsUser.QuadPart));
531  ok(info.AppCompatInfo == 0, "Expected AppCompatInfo to be 0, was: %p\n", info.AppCompatInfo);
532  ok(info.pShimData != NULL, "Expected pShimData to be valid, was NULL\n");
533  ok(info.ShimDataSize == g_ShimDataSize, "Expected ShimDataSize to be %u, was: %u\n", g_ShimDataSize, info.ShimDataSize);
534  if (info.pShimData)
535  {
536  /* Win10 only 'loads' one layer */
539  else if (g_WinVersion < WINVER_WIN10)
540  Validate_ShimData_Win7(info.pShimData, szApphelp, SDB_MAX_LAYERS, layers);
541  else
542  Validate_ShimData_Win10(info.pShimData, szApphelp, 1, layers);
543  }
544  }
545  else
546  {
547  ok(0, "Unable to get process info!\n");
548  }
549 
550 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
DWORD ShimDataSize
Definition: env.c:184
static HANDLE create_proc(BOOL suspended)
Definition: env.c:238
static HANDLE proc()
Definition: pdb.c:31
ULARGE_INTEGER AppCompatFlagsUser
Definition: env.c:182
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define WINVER_WIN10
smooth NULL
Definition: ftsmooth.c:416
static BOOL get_shiminfo(HANDLE proc, test_RemoteShimInfo *info)
Definition: env.c:201
PVOID pShimData
Definition: env.c:183
static DWORD g_WinVersion
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
PVOID AppCompatInfo
Definition: env.c:185
BOOL WINAPI DECLSPEC_HOTPATCH SetEnvironmentVariableA(IN LPCSTR lpName, IN LPCSTR lpValue)
Definition: environ.c:218
static DWORD g_ShimDataSize
Definition: env.c:60
const XML_Char XML_Encoding * info
Definition: expat.h:530
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define WINVER_VISTA
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1589
GLuint res
Definition: glext.h:9613
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
ULARGE_INTEGER AppCompatFlags
Definition: env.c:181
static void Validate_ShimData_Win2k3(PVOID data, size_t count, const char *layers[])
Definition: env.c:298
static void Validate_ShimData_Win7(PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
Definition: env.c:309
#define SDB_MAX_LAYERS
Definition: apphelp.h:44
static void Validate_ShimData_Win10(PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
Definition: env.c:375
static void Test_Shimdata ( SDBQUERYRESULT_VISTA result,
const WCHAR szLayer 
)
static

Definition at line 623 of file env.c.

Referenced by Test_GetMatchingExe().

624 {
625  BOOL ret;
626  PVOID pData;
627  DWORD dwSize;
628 
629  pData = NULL;
630  dwSize = 0;
631  ret = pSdbPackAppCompatData(g_LayerDB, result, &pData, &dwSize);
632  ok(ret == TRUE, "Expected ret to be TRUE\n");
633 
634  if (pData)
635  {
636  ShimData_Win2k3* pWin2k3;
637  ShimData_Win7* pWin7;
638  ShimData_Win10_v1* pWin10;
639  ShimData_Win10_v2* pWin10_v2;
640  SDBQUERYRESULT_VISTA result2 = { { 0 } };
641 
642  DWORD res = pSdbGetAppCompatDataSize(pData);
643  ok_int(dwSize, res);
644  switch(dwSize)
645  {
646  case sizeof(ShimData_Win2k3):
647  pWin2k3 = (ShimData_Win2k3*)pData;
648  ok_hex(pWin2k3->dwMagic, SHIMDATA_MAGIC);
649  ok_int(pWin2k3->dwSize, dwSize);
650  ok(pWin2k3->dwCustomSDBMap == 1, "Expected pWin2k3->dwCustomSDBMap to equal 1, was %u for %s\n", pWin2k3->dwCustomSDBMap, wine_dbgstr_w(szLayer));
651  //ok(!memcmp(&pWin2k3->Query, result, sizeof(SDBQUERYRESULT_2k3)), "Expected pWin2k3->Query to equal result\n");
652  //ok_wstr(pWin7->szLayer, szLayer);
653  break;
654  case sizeof(ShimData_Win7):
655  pWin7 = (ShimData_Win7*)pData;
656  ok_hex(pWin7->dwMagic, SHIMDATA_MAGIC);
657  ok_int(pWin7->dwSize, dwSize);
658  ok(!memcmp(&pWin7->Query, result, sizeof(*result)), "Expected pWin7->Query to equal result\n");
659  ok_wstr(pWin7->szLayer, szLayer);
660  break;
661  case sizeof(ShimData_Win10_v1):
662  pWin10 = (ShimData_Win10_v1*)pData;
663  ok_hex(pWin10->dwMagic, SHIMDATA_MAGIC);
664  ok_int(pWin10->dwSize, dwSize);
665  ok(!memcmp(&pWin10->Query, result, sizeof(*result)), "Expected pWin10->Query to equal result\n");
666  ok_wstr(pWin10->szLayerEnv, szLayer);
667  ok_wstr(pWin10->szLayer, L"");
668  break;
669  case sizeof(ShimData_Win10_v2):
670  pWin10_v2 = (ShimData_Win10_v2*)pData;
671  ok_hex(pWin10_v2->dwMagic, SHIMDATA_MAGIC);
672  ok_int(pWin10_v2->dwSize, dwSize);
673  ok(!memcmp(&pWin10_v2->Query, result, sizeof(*result)), "Expected pWin10->Query to equal result\n");
674  ok_wstr(pWin10_v2->szLayerEnv, szLayer);
675  ok_wstr(pWin10_v2->szLayer, L"");
676  break;
677  default:
678  skip("Unknown size %d\n", dwSize);
679  break;
680  }
681 
682  ret = pSdbUnpackAppCompatData(g_LayerDB, NULL, pData, &result2);
683  ok(ret == TRUE, "Expected ret to be TRUE\n");
684  /* TODO: For some reason 2k3 does not seem to output the database GUIDs,
685  investigate when we have support for multible db's! */
686  if (dwSize == sizeof(ShimData_Win2k3))
687  {
690  const GUID rgGuidDB0 = {0x11111111, 0x1111, 0x1111, {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}};
691 
692  // Check expected data.
693  ok(input->dwLayerCount == 1,
694  "Expected input->dwLayerCount to be 1, was %u for %s\n",
695  input->dwLayerCount, wine_dbgstr_w(szLayer));
696  ok(input->dwCustomSDBMap == 1,
697  "Expected input->dwCustomSDBMap to be 1, was %u for %s\n",
698  input->dwCustomSDBMap, wine_dbgstr_w(szLayer));
699  ok(IsEqualGUID(&input->rgGuidDB[0], &rgGuidDB0),
700  "Expected input->rgGuidDB[0] to be %s, was %s for %s\n",
701  wine_dbgstr_guid(&rgGuidDB0), wine_dbgstr_guid(&input->rgGuidDB[0]), wine_dbgstr_w(szLayer));
702 
703  // Check missing data.
704  ok(output->dwLayerCount == 0,
705  "Expected output->dwLayerCount to be 0, was %u for %s\n",
706  output->dwLayerCount, wine_dbgstr_w(szLayer));
707  ok(output->dwCustomSDBMap == 0,
708  "Expected output->dwCustomSDBMap to be 0, was %u for %s\n",
709  output->dwCustomSDBMap, wine_dbgstr_w(szLayer));
710  ok(IsEqualGUID(&output->rgGuidDB[0], &empty_result.rgGuidDB[0]),
711  "Expected output->rgGuidDB[0] to be empty, was %s for %s\n",
712  wine_dbgstr_guid(&output->rgGuidDB[0]), wine_dbgstr_w(szLayer));
713 
714  // Fake it for now, so the memcmp works.
715  output->dwLayerCount = input->dwLayerCount;
716  output->dwCustomSDBMap = input->dwCustomSDBMap;
717  output->rgGuidDB[0] = input->rgGuidDB[0];
718  }
719  ok(!memcmp(&result2, result, sizeof(*result)), "Expected result2 to equal result for %s\n", wine_dbgstr_w(szLayer));
720 
721  RtlFreeHeap(GetProcessHeap(), 0, pData);
722  }
723 }
DWORD *typedef PVOID
Definition: winlogon.h:52
WCHAR szLayer[MAX_LAYER_LENGTH]
Definition: env.c:103
#define TRUE
Definition: types.h:120
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
DWORD dwMagic
Definition: env.c:90
WCHAR szLayerEnv[MAX_LAYER_LENGTH]
Definition: env.c:109
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: bidi.c:85
struct ShimData_Win7 ShimData_Win7
#define ok_int(x, y)
Definition: sprintf.c:21
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
const char * wine_dbgstr_guid(const GUID *guid)
DWORD dwMagic
Definition: env.c:117
DWORD dwMagic
Definition: env.c:74
DWORD DWORD
Definition: winlogon.h:75
DWORD dwMagic
Definition: env.c:100
WCHAR szLayer[MAX_LAYER_LENGTH]
Definition: env.c:92
DWORD dwCustomSDBMap
Definition: env.c:80
DWORD dwSize
Definition: env.c:89
DWORD dwSize
Definition: env.c:73
#define ok_wstr(x, y)
Definition: test.h:794
SDBQUERYRESULT_VISTA Query
Definition: env.c:102
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
SDBQUERYRESULT_VISTA Query
Definition: env.c:120
#define ok(value,...)
Definition: CComObject.cpp:34
struct ShimData_Win2k3 ShimData_Win2k3
#define ok_hex(expression, result)
Definition: test.h:758
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
struct ShimData_Win10_v1 ShimData_Win10_v1
static const SDBQUERYRESULT_VISTA empty_result
Definition: env.c:62
int ret
WCHAR szLayerEnv[MAX_LAYER_LENGTH]
Definition: env.c:127
#define SHIMDATA_MAGIC
Definition: env.c:66
WCHAR szLayer[MAX_LAYER_LENGTH]
Definition: env.c:121
static HSDB g_LayerDB
Definition: env.c:59
GUID rgGuidDB[SDB_MAX_SDBS]
GLenum GLenum GLenum input
Definition: glext.h:9031
DWORD dwSize
Definition: env.c:116
DWORD dwSize
Definition: env.c:99
#define skip(...)
Definition: CString.cpp:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4002
GLuint res
Definition: glext.h:9613
GUID rgGuidDB[SDB_MAX_SDBS]
SDBQUERYRESULT_VISTA Query
Definition: env.c:91
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LPCWSTR PVOID pData
Definition: env.c:55
struct ShimData_Win10_v2 ShimData_Win10_v2
static void Validate_EmptyShimData_Win10 ( PVOID  data)
static

Definition at line 411 of file env.c.

Referenced by Test_layers().

412 {
414  ok(pShimData != NULL, "Expected pShimData\n");
415  if (!pShimData)
416  return;
417 
418  if (pShimData->dwMagic != SHIMDATA_MAGIC)
419  {
420  ShimData_Win10_v2* pShimData2 = (ShimData_Win10_v2*)data;
421  if (pShimData2->dwMagic != SHIMDATA_MAGIC)
422  {
423  skip("Unknown shimdata (win10)\n");
424  return;
425  }
426 
427  ok(!lstrcmpiW(pShimData2->szLayer, L""), "Expected pShimData->szLayer to be '', was %s\n", wine_dbgstr_w(pShimData2->szLayer));
428  ok(pShimData2->dwSize == sizeof(ShimData_Win10_v2), "Expected pShimData->dwSize to be %u, was %u\n", sizeof(ShimData_Win10_v2), pShimData2->dwSize);
429  ok(!memcmp(&pShimData2->Query, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
430  }
431  else
432  {
433  ok(!lstrcmpiW(pShimData->szModule, L""), "Expected pShimData->Module to be '', was %s\n", wine_dbgstr_w(pShimData->szModule));
434  ok(!lstrcmpiW(pShimData->szLayer, L""), "Expected pShimData->szLayer to be '', was %s\n", wine_dbgstr_w(pShimData->szLayer));
435  ok(pShimData->dwSize == sizeof(ShimData_Win10_v1), "Expected pShimData->dwSize to be %u, was %u\n", sizeof(ShimData_Win10_v1), pShimData->dwSize);
436  ok(!memcmp(&pShimData->Query, &empty_result, sizeof(empty_result)), "Expected result to be empty\n");
437  }
438 }
WCHAR szLayer[MAX_LAYER_LENGTH]
Definition: env.c:103
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: bidi.c:85
DWORD dwMagic
Definition: env.c:117
DWORD dwMagic
Definition: env.c:100
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
SDBQUERYRESULT_VISTA Query
Definition: env.c:102
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
SDBQUERYRESULT_VISTA Query
Definition: env.c:120
#define ok(value,...)
Definition: CComObject.cpp:34
static const SDBQUERYRESULT_VISTA empty_result
Definition: env.c:62
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SHIMDATA_MAGIC
Definition: env.c:66
WCHAR szLayer[MAX_LAYER_LENGTH]
Definition: env.c:121
DWORD dwSize
Definition: env.c:116
DWORD dwSize
Definition: env.c:99
WCHAR szModule[260]
Definition: env.c:98
#define skip(...)
Definition: CString.cpp:57
static void Validate_ShimData_Win10 ( PVOID  data,
WCHAR  szApphelp[256],
size_t  count,
const char layers[] 
)
static

Definition at line 375 of file env.c.

Referenced by Test_layers(), and Test_repeatlayer().

376 {
377  size_t n;
379 
380  if (pShimData->dwMagic != SHIMDATA_MAGIC)
381  {
382  Validate_ShimData_Win10_v2(data, szApphelp, count, layers);
383  return;
384  }
385 
386 
387  ok(!lstrcmpiW(pShimData->szModule, szApphelp), "Expected pShimData->Module to be %s, was %s\n",
388  wine_dbgstr_w(szApphelp), wine_dbgstr_w(pShimData->szModule));
389  ok(pShimData->dwSize == sizeof(ShimData_Win10_v1), "Expected pShimData->dwSize to be %u, was %u\n",
390  sizeof(ShimData_Win10_v1), pShimData->dwSize);
391  if (pShimData->Query.dwLayerCount != min(count, SDB_MAX_LAYERS))
392  {
393  char buf[250] = {0};
394  GetEnvironmentVariableA("__COMPAT_LAYER", buf, _countof(buf));
395  trace("At test: %s\n", buf);
396  }
397  ok(pShimData->Query.dwLayerCount == min(count, SDB_MAX_LAYERS),
398  "Expected LayerCount to be %u, was %u\n", min(count, SDB_MAX_LAYERS), pShimData->Query.dwLayerCount);
399  for (n = 0; n < SDB_MAX_LAYERS; ++n)
400  {
401  if (n < count)
402  {
403  ok(pShimData->Query.atrLayers[n] != 0, "Expected to find a valid layer in index %u / %u\n", n, count);
404  ValidateShim(pShimData->Query.atrLayers[n], layers[n]);
405  }
406  else
407  ok(pShimData->Query.atrLayers[n] == 0, "Expected to find an empty layer in index %u / %u\n", n, count);
408  }
409 }
#define trace(...)
Definition: kmt_test.h:217
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define _countof(array)
Definition: fontsub.cpp:30
DWORD dwMagic
Definition: env.c:100
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLuint n
Definition: s_context.h:57
SDBQUERYRESULT_VISTA Query
Definition: env.c:102
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
#define ok(value,...)
Definition: CComObject.cpp:34
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:411
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void Validate_ShimData_Win10_v2(PVOID data, WCHAR szApphelp[256], size_t count, const char *layers[])
Definition: env.c:341
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void ValidateShim(TAGREF trLayer, const char *name)
Definition: env.c:269
#define SHIMDATA_MAGIC
Definition: env.c:66
TAGREF atrLayers[SDB_MAX_LAYERS]
DWORD dwSize
Definition: env.c:99
WCHAR szModule[260]
Definition: env.c:98
#define min(a, b)
Definition: monoChain.cc:55
#define SDB_MAX_LAYERS
Definition: apphelp.h:44
static void Validate_ShimData_Win10_v2 ( PVOID  data,
WCHAR  szApphelp[256],
size_t  count,
const char layers[] 
)
static

Definition at line 341 of file env.c.

Referenced by Validate_ShimData_Win10().

342 {
343  size_t n;
345 
346  if (pShimData->dwMagic != SHIMDATA_MAGIC)
347  {
348  skip("Yet another unknown shimdata variant...\n");
349  return;
350  }
351 
352  ok(pShimData->dwSize == sizeof(ShimData_Win10_v2), "Expected pShimData->dwSize to be %u, was %u\n",
353  sizeof(ShimData_Win10_v2), pShimData->dwSize);
354  if (pShimData->Query.dwLayerCount != min(count, SDB_MAX_LAYERS))
355  {
356  char buf[250] = {0};
357  GetEnvironmentVariableA("__COMPAT_LAYER", buf, _countof(buf));
358  trace("At test: %s\n", buf);
359  }
360  ok(pShimData->Query.dwLayerCount == min(count, SDB_MAX_LAYERS),
361  "Expected LayerCount to be %u, was %u\n", min(count, SDB_MAX_LAYERS), pShimData->Query.dwLayerCount);
362  for (n = 0; n < SDB_MAX_LAYERS; ++n)
363  {
364  if (n < count)
365  {
366  ok(pShimData->Query.atrLayers[n] != 0, "Expected to find a valid layer in index %u / %u\n", n, count);
367  ValidateShim(pShimData->Query.atrLayers[n], layers[n]);
368  }
369  else
370  ok(pShimData->Query.atrLayers[n] == 0, "Expected to find an empty layer in index %u / %u\n", n, count);
371  }
372 
373 }
#define trace(...)
Definition: kmt_test.h:217
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define _countof(array)
Definition: fontsub.cpp:30
DWORD dwMagic
Definition: env.c:117
GLuint n
Definition: s_context.h:57
SDBQUERYRESULT_VISTA Query
Definition: env.c:120
#define ok(value,...)
Definition: CComObject.cpp:34
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:411
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void ValidateShim(TAGREF trLayer, const char *name)
Definition: env.c:269
#define SHIMDATA_MAGIC
Definition: env.c:66
TAGREF atrLayers[SDB_MAX_LAYERS]
DWORD dwSize
Definition: env.c:116
#define skip(...)
Definition: CString.cpp:57
#define min(a, b)
Definition: monoChain.cc:55
#define SDB_MAX_LAYERS
Definition: apphelp.h:44
static void Validate_ShimData_Win2k3 ( PVOID  data,
size_t  count,
const char layers[] 
)
static

Definition at line 298 of file env.c.

Referenced by Test_layers(), and Test_repeatlayer().

299 {
300  //size_t n;
301  ShimData_Win2k3* pShimData = (ShimData_Win2k3*)data;
302 
303  ok(!lstrcmpW(pShimData->szModule, L"ShimEng.dll"), "Expected pShimData->Module to be %s, was %s\n", wine_dbgstr_w(L"ShimEng.dll"), wine_dbgstr_w(pShimData->szModule));
304  ok(pShimData->dwMagic == SHIMDATA_MAGIC, "Expected pShimData->dwMagic to be 0x%x, was 0x%x\n", SHIMDATA_MAGIC, pShimData->dwMagic);
305  ok(pShimData->dwSize == sizeof(ShimData_Win2k3), "Expected pShimData->dwSize to be %u, was %u\n", sizeof(ShimData_Win2k3), pShimData->dwSize);
306  ok(pShimData->dwCustomSDBMap == 1, "Expected pShimData->dwCustomSDBMap to be 1, was %u\n", pShimData->dwCustomSDBMap);
307 }
Definition: bidi.c:85
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
DWORD dwMagic
Definition: env.c:74
DWORD dwCustomSDBMap
Definition: env.c:80
DWORD dwSize
Definition: env.c:73
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
WCHAR szModule[34]
Definition: env.c:72
#define ok(value,...)
Definition: CComObject.cpp:34
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SHIMDATA_MAGIC
Definition: env.c:66
static void Validate_ShimData_Win7 ( PVOID  data,
WCHAR  szApphelp[256],
size_t  count,
const char layers[] 
)
static

Definition at line 309 of file env.c.

Referenced by Test_layers(), and Test_repeatlayer().

310 {
311  size_t n;
312  ShimData_Win7* pShimData = (ShimData_Win7*)data;
313 
314  ok(!lstrcmpW(pShimData->szModule, szApphelp), "Expected pShimData->Module to be %s, was %s\n",
315  wine_dbgstr_w(szApphelp), wine_dbgstr_w(pShimData->szModule));
316  ok(pShimData->dwMagic == SHIMDATA_MAGIC, "Expected pShimData->dwMagic to be 0x%x, was 0x%x\n",
317  SHIMDATA_MAGIC, pShimData->dwMagic);
318  ok(pShimData->dwSize == sizeof(ShimData_Win7), "Expected pShimData->dwSize to be %u, was %u\n",
319  sizeof(ShimData_Win7), pShimData->dwSize);
320  if (pShimData->Query.dwLayerCount != min(count, SDB_MAX_LAYERS))
321  {
322  char buf[250] = {0};
323  GetEnvironmentVariableA("__COMPAT_LAYER", buf, _countof(buf));
324  trace("At test: %s\n", buf);
325  }
326  ok(pShimData->Query.dwLayerCount == min(count, SDB_MAX_LAYERS),
327  "Expected LayerCount to be %u, was %u\n", min(count, SDB_MAX_LAYERS), pShimData->Query.dwLayerCount);
328  for (n = 0; n < SDB_MAX_LAYERS; ++n)
329  {
330  if (n < count)
331  {
332  ok(pShimData->Query.atrLayers[n] != 0, "Expected to find a valid layer in index %u / %u\n", n, count);
333  ValidateShim(pShimData->Query.atrLayers[n], layers[n]);
334  }
335  else
336  ok(pShimData->Query.atrLayers[n] == 0, "Expected to find an empty layer in index %u / %u\n", n, count);
337  }
338  ok(pShimData->unknown == 0x14c, "Expected pShimData->unknown to be 0x14c, was 0x%x\n", pShimData->unknown);
339 }
DWORD unknown
Definition: env.c:93
WCHAR szModule[260]
Definition: env.c:88
#define trace(...)
Definition: kmt_test.h:217
DWORD dwMagic
Definition: env.c:90
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define _countof(array)
Definition: fontsub.cpp:30
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint n
Definition: s_context.h:57
DWORD dwSize
Definition: env.c:89
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
#define ok(value,...)
Definition: CComObject.cpp:34
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:411
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void ValidateShim(TAGREF trLayer, const char *name)
Definition: env.c:269
#define SHIMDATA_MAGIC
Definition: env.c:66
TAGREF atrLayers[SDB_MAX_LAYERS]
#define min(a, b)
Definition: monoChain.cc:55
#define SDB_MAX_LAYERS
Definition: apphelp.h:44
SDBQUERYRESULT_VISTA Query
Definition: env.c:91
static void ValidateShim ( TAGREF  trLayer,
const char name 
)
static

Definition at line 269 of file env.c.

Referenced by Validate_ShimData_Win10(), Validate_ShimData_Win10_v2(), and Validate_ShimData_Win7().

270 {
271  HSDB hsdb = pSdbInitDatabase(SDB_DATABASE_MAIN_SHIM, NULL);
272  ok(hsdb != NULL, "Expected a valid handle\n");
273  if (hsdb)
274  {
275  PDB pdb = NULL;
276  TAGID tagid = 0xdeadbeef;
277  WCHAR nameW[256] = { 0 };
278  BOOL ret;
279 
280  mbstowcs(nameW, name, strlen(name));
281 
282  ret = pSdbTagRefToTagID(hsdb, trLayer, &pdb, &tagid);
283  ok(ret == TRUE, "Expected pSdbTagRefToTagID to succeed\n");
284  if (ret)
285  {
286  TAG tag;
287  ok(pdb != NULL, "Expected pdb to be a valid pointer\n");
288  ok(tagid != 0 && tagid != 0xdeadbeef, "Expected tagid to be a valid tag id, was: 0x%x\n", tagid);
289  tag = pSdbGetTagFromTagID(pdb, tagid);
290  ok(tag == 0x700b, "Expected tag to be 0x700b, was 0x%x\n", (DWORD)tag);
291  }
292 
293  pSdbReleaseDatabase(hsdb);
294  }
295 }
#define TRUE
Definition: types.h:120
static PDB pdb
Definition: db.cpp:160
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
size_t __cdecl mbstowcs(_Out_writes_opt_z_(_MaxCount) wchar_t *_Dest, _In_z_ const char *_Source, _In_ size_t _MaxCount)
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: sdbtypes.h:24
#define SDB_DATABASE_MAIN_SHIM
Definition: env.c:174
DWORD DWORD
Definition: winlogon.h:75
Definition: apphelp.h:27
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static const WCHAR nameW[]
Definition: main.c:46
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
WORD TAG
Definition: sdbtypes.h:16
Definition: name.c:36
DWORD TAGID
Definition: sdbtypes.h:17
char * tag
Definition: main.c:59
void ( WINAPI pSdbReleaseDatabase)
HANDLE xOpenFile ( WCHAR ApplicationName)

Definition at line 802 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

803 {
809 
811  {
812  skip("Unable to translate %s to Nt path\n", wine_dbgstr_w(ApplicationName));
813  return NULL;
814  }
815 
816 
817  InitializeObjectAttributes(&ObjectAttributes, &FileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
818  Status = NtOpenFile(&FileHandle,
819  SYNCHRONIZE |
822  FILE_EXECUTE,
823  &ObjectAttributes,
824  &IoStatusBlock,
828 
829  RtlFreeUnicodeString(&FileName);
830 
831  if (!NT_SUCCESS(Status))
832  return NULL;
833 
834  return FileHandle;
835 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define FILE_SHARE_READ
Definition: compat.h:125
#define FILE_READ_DATA
Definition: nt_native.h:628
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3508
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_EXECUTE
Definition: nt_native.h:642
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
static HANDLE FileHandle
Definition: cabinet.c:48
struct _FileName FileName
Definition: fatprocs.h:884
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:45
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define skip(...)
Definition: CString.cpp:57
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)

Variable Documentation

const SDBQUERYRESULT_VISTA almost_empty = { { 0 }, { 0 }, { 0 }, 0, 0, 0, 0, { 0 }, SHIMREG_DISABLE_LAYER, 0 }
static

Definition at line 63 of file env.c.

PVOID PVOID PWCHAR ApplicationName

Definition at line 45 of file env.c.

Referenced by BaseCheckVDM(), CreateProcessInternalA(), and Test_ApphelpCheckRunApp().

Definition at line 35 of file env.c.

Definition at line 54 of file env.c.

Referenced by Test_Shimdata().

const SDBQUERYRESULT_VISTA empty_result = { { 0 } }
static

Definition at line 62 of file env.c.

Referenced by Test_GetMatchingExe().

Definition at line 45 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

HSDB g_LayerDB
static

Definition at line 59 of file env.c.

DWORD g_ModuleVersion
static

Definition at line 61 of file env.c.

Referenced by expect_layeronly_imp(), START_TEST(), and Test_ApphelpCheckRunApp().

DWORD g_ShimDataSize
static

Definition at line 60 of file env.c.

Referenced by START_TEST(), Test_layers(), and Test_repeatlayer().

HMODULE hdll
static

Definition at line 33 of file env.c.

Referenced by START_TEST().

LPCWSTR layerName

Definition at line 40 of file env.c.

Definition at line 55 of file env.c.

Referenced by Test_Shimdata().

Definition at line 54 of file env.c.

Referenced by AtlModuleExtractCreateWndData(), and DECLARE_INTERFACE_().

TAGREF PDB* ppdb

Definition at line 38 of file env.c.

Definition at line 35 of file env.c.

Referenced by SdbPackAppCompatData().

LPCWSTR pszDatabasePath

Definition at line 36 of file env.c.

LPCWSTR LPCWSTR LPCWSTR pszEnvironment

Definition at line 35 of file env.c.

LPCWSTR pszImageName

Definition at line 55 of file env.c.

TAGREF PDB TAGID* ptiWhich

Definition at line 38 of file env.c.

Definition at line 45 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

PVOID PVOID PWCHAR PVOID PVOID USHORT PULONG PVOID * SdbQueryAppCompatData

Definition at line 45 of file env.c.

PVOID PVOID PWCHAR PVOID PVOID USHORT PULONG PVOID PULONG SdbQueryAppCompatDataSize

Definition at line 45 of file env.c.

Definition at line 45 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

Definition at line 45 of file env.c.

Referenced by Test_ApphelpCheckRunApp().

LPCWSTR LPCWSTR szModuleName
LPCWSTR szPath

Definition at line 35 of file env.c.

Referenced by _tWinMain(), AdvInstallFileW(), AudioDlgProc(), BuildVolatileEnvironment(), cmd_vol(), CmdInstallService(), CommandAttrib(), CControlPanelEnum::CreateCPanelEnumList(), CreateDirectoryPath(), CreateShortcut(), CreateShortcuts(), DIALOG_FileOpen(), DIALOG_FileSaveAs(), DisableNetworkAdapter(), DoEntry(), DoSaveFileAs(), EnumThemes(), FileExtractDialogWndProc(), fill_file_description(), GetDesktopPath(), CShellLink::GetIconLocation(), GetIconOverlay(), GetInstalledVersion_WowUser(), GetLayoutName(), GetProgramsPath(), GRPFILE_WriteGroupFile(), HACKISH_PathResolve(), CFileSysEnum::Initialize(), InitLogs(), isUnattendSetup(), LayoutList_Create(), ATL::CImage::Load(), LoadSetupData(), LoadSoundFiles(), LoadTypeLibEx(), SEALED_::LoadTypeLibrary(), OleMetafilePictFromIconAndLabel(), OnAddStartMenuItems(), OnAdvancedStartMenuItems(), OnClearRecentItems(), CFSFolder::ParseDisplayName(), PathCanonicalizeA(), PathCompactPathA(), PathCompactPathExA(), PathFileExistsDefExtA(), PathIsDirectoryEmptyA(), PathMakeSystemFolderA(), PathRelativePathToA(), PathSetDlgItemPathA(), POWRPROF_GetMachinePowerPolicy(), POWRPROF_GetUserPowerPolicy(), PrintPrompt(), ProcessUnattendInf(), ProcessUnattendSetup(), PushDirectory(), ReadCommand(), ReadProcessorPwrScheme(), RecursiveRemoveDir(), RegisterInShimCache(), RegisterTypeLibraries(), RunApphelpCacheControlTests(), ATL::CImage::Save(), search_res_tlb(), set_cookie(), CShellLink::SetPath(), CShellLink::SetTargetFromPIDLOrPath(), SHCreateStreamOnFileA(), SHEmptyRecycleBinW(), SHExplorerParseCmdLine(), SHGetFolderLocation(), SHGetWebFolderFilePathA(), SHLWAPI_PathFindInOtherDirs(), SHRegOpenUSKeyA(), START_TEST(), StartAutoApplications(), Stream_WriteLocationInfo(), test_iconlocation(), test_Installer(), test_WritePwrScheme(), UninstallApplication(), UXTHEME_LoadImage(), UXTHEME_SelectImage(), WelcomeDlgProc(), and wrapSdbSetPermLayerKeys2().

TAGID tiWhich

Definition at line 39 of file env.c.

TAGREF trWhich

Definition at line 38 of file env.c.

PVOID Unk1

Definition at line 45 of file env.c.

PVOID PVOID Unk2

Definition at line 45 of file env.c.

Definition at line 49 of file env.c.