ReactOS 0.4.15-dev-7834-g00c4b3d
versionlie.c File Reference
#include <ntstatus.h>
#include <windows.h>
#include <winternl.h>
#include "wine/test.h"
#include <strsafe.h>
#include "appshim_apitest.h"
Include dependency graph for versionlie.c:

Go to the source code of this file.

Classes

struct  VersionLieInfo
 

Macros

#define WIN32_NO_STATUS
 
#define FLAG_BUGGY_ServicePackMajorMinor   1
 
#define FLAG_AlternateHookOrder   2
 
#define verify_shima   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shima_imp
 
#define verify_shimw   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shimw_imp
 
#define verify_shim   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shim_imp
 

Typedefs

typedef struct VersionLieInfo VersionLieInfo
 
typedef BOOL(WINAPIGETVERSIONEXAPROC) (LPOSVERSIONINFOEXA)
 
typedef BOOL(WINAPIGETVERSIONEXWPROC) (LPOSVERSIONINFOEXW)
 
typedef DWORD(WINAPIGETVERSIONPROC) (void)
 

Functions

void expect_shim_imp (PHOOKAPI hook, PCSTR library, PCSTR function, PCSTR shim, int *same)
 
static void verify_shima_imp (PHOOKAPI hook, const VersionLieInfo *info, PCSTR shim, int same)
 
static void verify_shimw_imp (PHOOKAPI hook, const VersionLieInfo *info, PCSTR shim, int same, int first_might_be_broken)
 
static void verify_shim_imp (PHOOKAPI hook, const VersionLieInfo *info, PCSTR shim, int same)
 
static void run_test (LPCSTR shim, const VersionLieInfo *info)
 
DWORD get_host_winver (void)
 
BOOL LoadShimDLL (PCWSTR ShimDll, HMODULE *module, tGETHOOKAPIS *ppGetHookAPIs)
 
tGETHOOKAPIS LoadShimDLL2 (PCWSTR ShimDll)
 
 START_TEST (versionlie)
 

Variables

static tGETHOOKAPIS pGetHookAPIs
 
static DWORD g_WinVersion
 
VersionLieInfo g_Win95 = { 0xC3B60004, 4, 0, 950, VER_PLATFORM_WIN32_WINDOWS, 0, 0, FLAG_BUGGY_ServicePackMajorMinor | FLAG_AlternateHookOrder }
 
VersionLieInfo g_WinNT4SP5 = { 0x05650004, 4, 0, 1381, VER_PLATFORM_WIN32_NT, 5, 0, FLAG_BUGGY_ServicePackMajorMinor }
 
VersionLieInfo g_Win98 = { 0xC0000A04, 4, 10, 0x040A08AE, VER_PLATFORM_WIN32_WINDOWS, 0, 0, FLAG_BUGGY_ServicePackMajorMinor }
 
VersionLieInfo g_Win2000 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win2000SP1 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 1, 0 }
 
VersionLieInfo g_Win2000SP2 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 2, 0 }
 
VersionLieInfo g_Win2000SP3 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 3, 0 }
 
VersionLieInfo g_WinXP = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_WinXPSP1 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 1, 0 }
 
VersionLieInfo g_WinXPSP2 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 2, 0 }
 
VersionLieInfo g_WinXPSP3 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 3, 0 }
 
VersionLieInfo g_Win2k3RTM = { 0x0ece0205, 5, 2, 3790, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win2k3SP1 = { 0x0ece0205, 5, 2, 3790, VER_PLATFORM_WIN32_NT, 1, 0 }
 
VersionLieInfo g_WinVistaRTM = { 0x17700006, 6, 0, 6000, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_WinVistaSP1 = { 0x17710006, 6, 0, 6001, VER_PLATFORM_WIN32_NT, 1, 0 }
 
VersionLieInfo g_WinVistaSP2 = { 0x17720006, 6, 0, 6002, VER_PLATFORM_WIN32_NT, 2, 0 }
 
VersionLieInfo g_Win7RTM = { 0x1db00106, 6, 1, 7600, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win7SP1 = { 0x1db10106, 6, 1, 7601, VER_PLATFORM_WIN32_NT, 1, 0 }
 
VersionLieInfo g_Win8RTM = { 0x23f00206, 6, 2, 9200, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win81RTM = { 0x25800306, 6, 3, 9600, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win10RTM = { 0x47ba000a, 10, 0, 18362, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win2k16RTM = { 0x3fab000a, 10, 0, 16299, VER_PLATFORM_WIN32_NT, 0, 0 }
 
VersionLieInfo g_Win2k19RTM = { 0x4563000a, 10, 0, 17763, VER_PLATFORM_WIN32_NT, 0, 0 }
 

Macro Definition Documentation

◆ FLAG_AlternateHookOrder

#define FLAG_AlternateHookOrder   2

Definition at line 27 of file versionlie.c.

◆ FLAG_BUGGY_ServicePackMajorMinor

#define FLAG_BUGGY_ServicePackMajorMinor   1

Definition at line 26 of file versionlie.c.

◆ verify_shim

#define verify_shim   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shim_imp

Definition at line 207 of file versionlie.c.

◆ verify_shima

#define verify_shima   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shima_imp

Definition at line 205 of file versionlie.c.

◆ verify_shimw

#define verify_shimw   (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : verify_shimw_imp

Definition at line 206 of file versionlie.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 9 of file versionlie.c.

Typedef Documentation

◆ GETVERSIONEXAPROC

typedef BOOL(WINAPI * GETVERSIONEXAPROC) (LPOSVERSIONINFOEXA)

Definition at line 41 of file versionlie.c.

◆ GETVERSIONEXWPROC

typedef BOOL(WINAPI * GETVERSIONEXWPROC) (LPOSVERSIONINFOEXW)

Definition at line 42 of file versionlie.c.

◆ GETVERSIONPROC

typedef DWORD(WINAPI * GETVERSIONPROC) (void)

Definition at line 43 of file versionlie.c.

◆ VersionLieInfo

Function Documentation

◆ expect_shim_imp()

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

Definition at line 45 of file versionlie.c.

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

◆ get_host_winver()

DWORD get_host_winver ( void  )

Definition at line 296 of file versionlie.c.

297{
298 RTL_OSVERSIONINFOEXW rtlinfo = {0};
299 void (__stdcall* pRtlGetVersion)(RTL_OSVERSIONINFOEXW*);
300 pRtlGetVersion = (void (__stdcall*)(RTL_OSVERSIONINFOEXW*))GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
301
302 rtlinfo.dwOSVersionInfoSize = sizeof(rtlinfo);
303 pRtlGetVersion(&rtlinfo);
304 return (rtlinfo.dwMajorVersion << 8) | rtlinfo.dwMinorVersion;
305}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
ULONG dwMajorVersion
Definition: rtltypes.h:270
ULONG dwMinorVersion
Definition: rtltypes.h:271
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:269
#define __stdcall
Definition: typedefs.h:25

Referenced by START_TEST().

◆ LoadShimDLL()

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

Definition at line 307 of file versionlie.c.

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

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

◆ LoadShimDLL2()

tGETHOOKAPIS LoadShimDLL2 ( PCWSTR  ShimDll)

Definition at line 369 of file versionlie.c.

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

Referenced by START_TEST().

◆ run_test()

static void run_test ( LPCSTR  shim,
const VersionLieInfo info 
)
static

Definition at line 212 of file versionlie.c.

213{
214 DWORD num_shims = 0;
215 WCHAR wide_shim[50] = { 0 };
217 DWORD ver;
218 MultiByteToWideChar(CP_ACP, 0, shim, -1, wide_shim, 50);
219 hook = pGetHookAPIs("", wide_shim, &num_shims);
220 ver = (info->dwMajorVersion << 8) | info->dwMinorVersion;
221 if (hook == NULL)
222 {
223 skip("Skipping tests for layers (%s) not present in this os (0x%x)\n", shim, g_WinVersion);
224 return;
225 }
226 ok(hook != NULL, "Expected hook to be a valid pointer for %s\n", shim);
227 if (info->wFlags & FLAG_AlternateHookOrder)
228 {
229 ok(num_shims == 3, "Expected num_shims to be 3, was: %u for %s\n", num_shims, shim);
230 if (hook && num_shims == 3)
231 {
232 int same = 0;
233 expect_shim(hook + 0, "KERNEL32.DLL", "GetVersion", shim, &same);
234 verify_shim(hook + 0, info, shim, same);
235 expect_shim(hook + 1, "KERNEL32.DLL", "GetVersionExA", shim, &same);
236 verify_shima(hook + 1, info, shim, same);
237 expect_shim(hook + 2, "KERNEL32.DLL", "GetVersionExW", shim, &same);
238 verify_shimw(hook + 2, info, shim, same, 0);
239 }
240 }
241 else
242 {
243 int shimnum_ok = num_shims == 4 || ((ver < _WIN32_WINNT_WINXP) && (num_shims == 3));
244 ok(shimnum_ok, "Expected num_shims to be 4%s, was: %u for %s\n", ((ver < _WIN32_WINNT_WINXP) ? " or 3":""), num_shims, shim);
245 if (hook && shimnum_ok)
246 {
247 int same = 0;
248 expect_shim(hook + 0, "KERNEL32.DLL", "GetVersionExA", shim, &same);
249 verify_shima(hook + 0, info, shim, same);
250 expect_shim(hook + 1, "KERNEL32.DLL", "GetVersionExW", shim, &same);
251 verify_shimw(hook + 1, info, shim, same, 0);
252 expect_shim(hook + 2, "KERNEL32.DLL", "GetVersion", shim, &same);
253 verify_shim(hook + 2, info, shim, same);
254 if (num_shims == 4)
255 {
256 expect_shim(hook + 3, "NTDLL.DLL", "RtlGetVersion", shim, &same);
257 verify_shimw(hook + 3, info, shim, same, 1);
258 }
259 }
260 }
261}
#define expect_shim
#define ok(value,...)
Definition: atltest.h:57
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
if(dx< 0)
Definition: linetemp.h:194
#define verify_shima
Definition: versionlie.c:205
#define FLAG_AlternateHookOrder
Definition: versionlie.c:27
#define verify_shim
Definition: versionlie.c:207
static DWORD g_WinVersion
Definition: versionlie.c:24
#define verify_shimw
Definition: versionlie.c:206
#define _WIN32_WINNT_WINXP
Definition: sdkddkver.h:22

◆ START_TEST()

START_TEST ( versionlie  )

Definition at line 384 of file versionlie.c.

385{
386 pGetHookAPIs = LoadShimDLL2(L"aclayers.dll");
387
388 if (!pGetHookAPIs)
389 return;
390
392
393 run_test("Win95VersionLie", &g_Win95);
394 run_test("WinNT4SP5VersionLie", &g_WinNT4SP5);
395 run_test("Win98VersionLie", &g_Win98);
396 run_test("Win2000VersionLie", &g_Win2000);
397 run_test("Win2000SP1VersionLie", &g_Win2000SP1);
398 run_test("Win2000SP2VersionLie", &g_Win2000SP2);
399 run_test("Win2000SP3VersionLie", &g_Win2000SP3);
400 run_test("WinXPVersionLie", &g_WinXP);
401 run_test("WinXPSP1VersionLie", &g_WinXPSP1);
402 run_test("WinXPSP2VersionLie", &g_WinXPSP2);
403 run_test("WinXPSP3VersionLie", &g_WinXPSP3);
404 run_test("Win2k3RTMVersionLie", &g_Win2k3RTM);
405 run_test("Win2k3SP1VersionLie", &g_Win2k3SP1);
406 run_test("VistaRTMVersionLie", &g_WinVistaRTM);
407 run_test("VistaSP1VersionLie", &g_WinVistaSP1);
408 run_test("VistaSP2VersionLie", &g_WinVistaSP2);
409 run_test("Win7RTMVersionLie", &g_Win7RTM);
410 run_test("Win7SP1VersionLie", &g_Win7SP1); /* ReactOS specific. Windows does not have this version lie */
411 run_test("Win8RTMVersionLie", &g_Win8RTM);
412 run_test("Win81RTMVersionLie", &g_Win81RTM);
413 run_test("Win10RTMVersionLie", &g_Win10RTM); /* ReactOS specific. Windows does not have this version lie */
414 run_test("Win2k16RTMVersionLie", &g_Win2k16RTM); /* ReactOS specific. Windows does not have this version lie */
415 run_test("Win2k19RTMVersionLie", &g_Win2k19RTM); /* ReactOS specific. Windows does not have this version lie */
416}
VersionLieInfo g_Win95
Definition: versionlie.c:28
VersionLieInfo g_Win8RTM
Definition: versionlie.c:288
VersionLieInfo g_Win2000
Definition: versionlie.c:268
DWORD get_host_winver(void)
Definition: versionlie.c:296
VersionLieInfo g_Win2k3SP1
Definition: versionlie.c:279
VersionLieInfo g_Win2000SP2
Definition: versionlie.c:270
VersionLieInfo g_WinNT4SP5
Definition: versionlie.c:265
VersionLieInfo g_WinVistaRTM
Definition: versionlie.c:281
VersionLieInfo g_WinXPSP1
Definition: versionlie.c:274
VersionLieInfo g_Win7SP1
Definition: versionlie.c:286
VersionLieInfo g_WinXP
Definition: versionlie.c:273
VersionLieInfo g_Win7RTM
Definition: versionlie.c:285
VersionLieInfo g_Win2000SP1
Definition: versionlie.c:269
VersionLieInfo g_Win81RTM
Definition: versionlie.c:289
VersionLieInfo g_Win10RTM
Definition: versionlie.c:291
VersionLieInfo g_Win2k19RTM
Definition: versionlie.c:294
VersionLieInfo g_Win98
Definition: versionlie.c:266
VersionLieInfo g_Win2k16RTM
Definition: versionlie.c:293
VersionLieInfo g_Win2k3RTM
Definition: versionlie.c:278
VersionLieInfo g_WinXPSP2
Definition: versionlie.c:275
tGETHOOKAPIS LoadShimDLL2(PCWSTR ShimDll)
Definition: versionlie.c:369
VersionLieInfo g_Win2000SP3
Definition: versionlie.c:271
VersionLieInfo g_WinVistaSP2
Definition: versionlie.c:283
VersionLieInfo g_WinXPSP3
Definition: versionlie.c:276
VersionLieInfo g_WinVistaSP1
Definition: versionlie.c:282
#define run_test(test)
Definition: ms_seh.c:71

◆ verify_shim_imp()

static void verify_shim_imp ( PHOOKAPI  hook,
const VersionLieInfo info,
PCSTR  shim,
int  same 
)
static

Definition at line 192 of file versionlie.c.

193{
194 DWORD ver;
195 if (!same)
196 {
197 skip("Skipping implementation tests for %s\n", shim);
198 return;
199 }
200 ver = ((GETVERSIONPROC)hook->ReplacementFunction)();
201 winetest_ok(info->FullVersion == ver, "Expected GetVersion to return 0x%x, was: 0x%x for %s\n", info->FullVersion, ver, shim);
202}
DWORD(WINAPI * GETVERSIONPROC)(void)
Definition: versionlie.c:43

◆ verify_shima_imp()

static void verify_shima_imp ( PHOOKAPI  hook,
const VersionLieInfo info,
PCSTR  shim,
int  same 
)
static

Definition at line 54 of file versionlie.c.

55{
56 OSVERSIONINFOEXA v1 = { sizeof(v1), 0 }, v2 = { sizeof(v2), 0 };
57 BOOL ok1, ok2;
58
59 if (!same)
60 {
61 skip("Skipping implementation tests for %s\n", shim);
62 return;
63 }
64
65 while (v1.dwOSVersionInfoSize)
66 {
68 hook->OriginalFunction = GetVersionExA;
69
70 ok2 = ((GETVERSIONEXAPROC)hook->ReplacementFunction)(&v2);
71
72 winetest_ok(ok1 == ok2, "Expected ok1 to equal ok2, was: %i, %i for %s\n", ok1, ok2, shim);
73 if (ok1 && ok2)
74 {
75 char szCSDVersion[128] = "";
76 winetest_ok(v1.dwOSVersionInfoSize == v2.dwOSVersionInfoSize, "Expected dwOSVersionInfoSize to be equal, was: %u, %u for %s\n", v1.dwOSVersionInfoSize, v2.dwOSVersionInfoSize, shim);
77 winetest_ok(info->dwMajorVersion == v2.dwMajorVersion, "Expected dwMajorVersion to be equal, was: %u, %u for %s\n", info->dwMajorVersion, v2.dwMajorVersion, shim);
78 winetest_ok(info->dwMinorVersion == v2.dwMinorVersion, "Expected dwMinorVersion to be equal, was: %u, %u for %s\n", info->dwMinorVersion, v2.dwMinorVersion, shim);
79 winetest_ok(info->dwBuildNumber == v2.dwBuildNumber, "Expected dwBuildNumber to be equal, was: %u, %u for %s\n", info->dwBuildNumber, v2.dwBuildNumber, shim);
80 winetest_ok(info->dwPlatformId == v2.dwPlatformId, "Expected dwPlatformId to be equal, was: %u, %u for %s\n", info->dwPlatformId, v2.dwPlatformId, shim);
81
82 if (info->wServicePackMajor)
83 StringCchPrintfA(szCSDVersion, _countof(szCSDVersion), "Service Pack %u", info->wServicePackMajor);
84 winetest_ok(lstrcmpA(szCSDVersion, v2.szCSDVersion) == 0, "Expected szCSDVersion to be equal, was: %s, %s for %s\n", szCSDVersion, v2.szCSDVersion, shim);
85
86 if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
87 {
89 {
90 winetest_ok(info->wServicePackMajor == v2.wServicePackMajor, "Expected wServicePackMajor to be equal, was: %i, %i for %s\n", info->wServicePackMajor, v2.wServicePackMajor, shim);
91 winetest_ok(info->wServicePackMinor == v2.wServicePackMinor, "Expected wServicePackMinor to be equal, was: %i, %i for %s\n", info->wServicePackMinor, v2.wServicePackMinor, shim);
92 }
93 else
94 {
95 winetest_ok(v1.wServicePackMajor == v2.wServicePackMajor, "Expected wServicePackMajor to be equal, was: %i, %i for %s\n", v1.wServicePackMajor, v2.wServicePackMajor, shim);
96 winetest_ok(v1.wServicePackMinor == v2.wServicePackMinor, "Expected wServicePackMinor to be equal, was: %i, %i for %s\n", v1.wServicePackMinor, v2.wServicePackMinor, shim);
97 }
98 winetest_ok(v1.wSuiteMask == v2.wSuiteMask, "Expected wSuiteMask to be equal, was: %i, %i for %s\n", v1.wSuiteMask, v2.wSuiteMask, shim);
99 winetest_ok(v1.wProductType == v2.wProductType, "Expected wProductType to be equal, was: %i, %i for %s\n", v1.wProductType, v2.wProductType, shim);
100 winetest_ok(v1.wReserved == v2.wReserved, "Expected wReserved to be equal, was: %i, %i for %s\n", v1.wReserved, v2.wReserved, shim);
101 }
102 else
103 {
104 winetest_ok(v1.wServicePackMajor == 0 && v2.wServicePackMajor == 0, "Expected wServicePackMajor to be 0, was: %i, %i for %s\n", v1.wServicePackMajor, v2.wServicePackMajor, shim);
105 winetest_ok(v1.wServicePackMinor == 0 && v2.wServicePackMinor == 0, "Expected wServicePackMinor to be 0, was: %i, %i for %s\n", v1.wServicePackMinor, v2.wServicePackMinor, shim);
106 winetest_ok(v1.wSuiteMask == 0 && v2.wSuiteMask == 0, "Expected wSuiteMask to be 0, was: %i, %i for %s\n", v1.wSuiteMask, v2.wSuiteMask, shim);
107 winetest_ok(v1.wProductType == 0 && v2.wProductType == 0, "Expected wProductType to be 0, was: %i, %i for %s\n", v1.wProductType, v2.wProductType, shim);
108 winetest_ok(v1.wReserved == 0 && v2.wReserved == 0, "Expected wReserved to be 0, was: %i, %i for %s\n", v1.wReserved, v2.wReserved, shim);
109 }
110 }
111
112 ZeroMemory(&v1, sizeof(v1));
113 ZeroMemory(&v2, sizeof(v2));
114 if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
115 v1.dwOSVersionInfoSize = v2.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
116 }
117}
#define ok2(expression, text, expected, got)
BOOL(WINAPI * GETVERSIONEXAPROC)(LPOSVERSIONINFOEXA)
Definition: versionlie.c:97
BOOL WINAPI GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation)
Definition: version.c:69
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
#define FLAG_BUGGY_ServicePackMajorMinor
Definition: versionlie.c:26
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
Definition: strsafe.h:520
#define ZeroMemory
Definition: winbase.h:1712
struct _OSVERSIONINFOA OSVERSIONINFOA

◆ verify_shimw_imp()

static void verify_shimw_imp ( PHOOKAPI  hook,
const VersionLieInfo info,
PCSTR  shim,
int  same,
int  first_might_be_broken 
)
static

Definition at line 119 of file versionlie.c.

120{
121 OSVERSIONINFOEXW v1 = { sizeof(v1), 0 }, v2 = { sizeof(v2), 0 };
122 BOOL ok1, ok2, first = TRUE;
123
124 if (!same)
125 {
126 skip("Skipping implementation tests for %s\n", shim);
127 return;
128 }
129
130 while (v1.dwOSVersionInfoSize)
131 {
133 hook->OriginalFunction = GetVersionExW;
134
135 ok2 = ((GETVERSIONEXWPROC)hook->ReplacementFunction)(&v2);
136
137 if (first_might_be_broken && first && ok1 == TRUE && ok2 == FALSE)
138 {
139 skip("Skipping first check because 0x%x is (falsely) not accepted by the shim %s\n", sizeof(v1), shim);
140 }
141 else
142 {
143 winetest_ok(ok1 == ok2, "Expected ok1 to equal ok2, was: %i, %i for %s(first:%d)\n", ok1, ok2, shim, first);
144 }
145 if (ok1 && ok2)
146 {
147 WCHAR szCSDVersion[128] = { 0 };
148 winetest_ok(v1.dwOSVersionInfoSize == v2.dwOSVersionInfoSize, "Expected dwOSVersionInfoSize to be equal, was: %u, %u for %s\n", v1.dwOSVersionInfoSize, v2.dwOSVersionInfoSize, shim);
149 winetest_ok(info->dwMajorVersion == v2.dwMajorVersion, "Expected dwMajorVersion to be equal, was: %u, %u for %s\n", info->dwMajorVersion, v2.dwMajorVersion, shim);
150 winetest_ok(info->dwMinorVersion == v2.dwMinorVersion, "Expected dwMinorVersion to be equal, was: %u, %u for %s\n", info->dwMinorVersion, v2.dwMinorVersion, shim);
151 winetest_ok(info->dwBuildNumber == v2.dwBuildNumber, "Expected dwBuildNumber to be equal, was: %u, %u for %s\n", info->dwBuildNumber, v2.dwBuildNumber, shim);
152 winetest_ok(info->dwPlatformId == v2.dwPlatformId, "Expected dwPlatformId to be equal, was: %u, %u for %s\n", info->dwPlatformId, v2.dwPlatformId, shim);
153
154 if (info->wServicePackMajor)
155 StringCchPrintfW(szCSDVersion, _countof(szCSDVersion), L"Service Pack %u", info->wServicePackMajor);
156 winetest_ok(lstrcmpW(szCSDVersion, v2.szCSDVersion) == 0, "Expected szCSDVersion to be equal, was: %s, %s for %s\n", wine_dbgstr_w(szCSDVersion), wine_dbgstr_w(v2.szCSDVersion), shim);
157
158 if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
159 {
160 if (!(info->wFlags & FLAG_BUGGY_ServicePackMajorMinor))
161 {
162 winetest_ok(info->wServicePackMajor == v2.wServicePackMajor, "Expected wServicePackMajor to be equal, was: %i, %i for %s\n", info->wServicePackMajor, v2.wServicePackMajor, shim);
163 winetest_ok(info->wServicePackMinor == v2.wServicePackMinor, "Expected wServicePackMinor to be equal, was: %i, %i for %s\n", info->wServicePackMinor, v2.wServicePackMinor, shim);
164 }
165 else
166 {
167 winetest_ok(v1.wServicePackMajor == v2.wServicePackMajor, "Expected wServicePackMajor to be equal, was: %i, %i for %s\n", v1.wServicePackMajor, v2.wServicePackMajor, shim);
168 winetest_ok(v1.wServicePackMinor == v2.wServicePackMinor, "Expected wServicePackMinor to be equal, was: %i, %i for %s\n", v1.wServicePackMinor, v2.wServicePackMinor, shim);
169 }
170 winetest_ok(v1.wSuiteMask == v2.wSuiteMask, "Expected wSuiteMask to be equal, was: %i, %i for %s\n", v1.wSuiteMask, v2.wSuiteMask, shim);
171 winetest_ok(v1.wProductType == v2.wProductType, "Expected wProductType to be equal, was: %i, %i for %s\n", v1.wProductType, v2.wProductType, shim);
172 winetest_ok(v1.wReserved == v2.wReserved, "Expected wReserved to be equal, was: %i, %i for %s\n", v1.wReserved, v2.wReserved, shim);
173 }
174 else
175 {
176 winetest_ok(v1.wServicePackMajor == 0 && v2.wServicePackMajor == 0, "Expected wServicePackMajor to be 0, was: %i, %i for %s\n", v1.wServicePackMajor, v2.wServicePackMajor, shim);
177 winetest_ok(v1.wServicePackMinor == 0 && v2.wServicePackMinor == 0, "Expected wServicePackMinor to be 0, was: %i, %i for %s\n", v1.wServicePackMinor, v2.wServicePackMinor, shim);
178 winetest_ok(v1.wSuiteMask == 0 && v2.wSuiteMask == 0, "Expected wSuiteMask to be 0, was: %i, %i for %s\n", v1.wSuiteMask, v2.wSuiteMask, shim);
179 winetest_ok(v1.wProductType == 0 && v2.wProductType == 0, "Expected wProductType to be 0, was: %i, %i for %s\n", v1.wProductType, v2.wProductType, shim);
180 winetest_ok(v1.wReserved == 0 && v2.wReserved == 0, "Expected wReserved to be 0, was: %i, %i for %s\n", v1.wReserved, v2.wReserved, shim);
181 }
182 }
183
184 ZeroMemory(&v1, sizeof(v1));
185 ZeroMemory(&v2, sizeof(v2));
186 if (v1.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
187 v1.dwOSVersionInfoSize = v2.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
188 first = FALSE;
189 }
190}
#define TRUE
Definition: types.h:120
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
const GLint * first
Definition: glext.h:5794
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL(WINAPI * GETVERSIONEXWPROC)(LPOSVERSIONINFOEXW)
Definition: versionlie.c:42
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
struct _OSVERSIONINFOW OSVERSIONINFOW

Variable Documentation

◆ g_Win10RTM

VersionLieInfo g_Win10RTM = { 0x47ba000a, 10, 0, 18362, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 291 of file versionlie.c.

◆ g_Win2000

VersionLieInfo g_Win2000 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 268 of file versionlie.c.

◆ g_Win2000SP1

VersionLieInfo g_Win2000SP1 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 1, 0 }

Definition at line 269 of file versionlie.c.

◆ g_Win2000SP2

VersionLieInfo g_Win2000SP2 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 2, 0 }

Definition at line 270 of file versionlie.c.

◆ g_Win2000SP3

VersionLieInfo g_Win2000SP3 = { 0x08930005, 5, 0, 2195, VER_PLATFORM_WIN32_NT, 3, 0 }

Definition at line 271 of file versionlie.c.

◆ g_Win2k16RTM

VersionLieInfo g_Win2k16RTM = { 0x3fab000a, 10, 0, 16299, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 293 of file versionlie.c.

◆ g_Win2k19RTM

VersionLieInfo g_Win2k19RTM = { 0x4563000a, 10, 0, 17763, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 294 of file versionlie.c.

◆ g_Win2k3RTM

VersionLieInfo g_Win2k3RTM = { 0x0ece0205, 5, 2, 3790, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 278 of file versionlie.c.

◆ g_Win2k3SP1

VersionLieInfo g_Win2k3SP1 = { 0x0ece0205, 5, 2, 3790, VER_PLATFORM_WIN32_NT, 1, 0 }

Definition at line 279 of file versionlie.c.

◆ g_Win7RTM

VersionLieInfo g_Win7RTM = { 0x1db00106, 6, 1, 7600, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 285 of file versionlie.c.

◆ g_Win7SP1

VersionLieInfo g_Win7SP1 = { 0x1db10106, 6, 1, 7601, VER_PLATFORM_WIN32_NT, 1, 0 }

Definition at line 286 of file versionlie.c.

◆ g_Win81RTM

VersionLieInfo g_Win81RTM = { 0x25800306, 6, 3, 9600, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 289 of file versionlie.c.

◆ g_Win8RTM

VersionLieInfo g_Win8RTM = { 0x23f00206, 6, 2, 9200, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 288 of file versionlie.c.

◆ g_Win95

Definition at line 264 of file versionlie.c.

◆ g_Win98

VersionLieInfo g_Win98 = { 0xC0000A04, 4, 10, 0x040A08AE, VER_PLATFORM_WIN32_WINDOWS, 0, 0, FLAG_BUGGY_ServicePackMajorMinor }

Definition at line 266 of file versionlie.c.

◆ g_WinNT4SP5

VersionLieInfo g_WinNT4SP5 = { 0x05650004, 4, 0, 1381, VER_PLATFORM_WIN32_NT, 5, 0, FLAG_BUGGY_ServicePackMajorMinor }

Definition at line 265 of file versionlie.c.

◆ g_WinVersion

DWORD g_WinVersion
static

Definition at line 24 of file versionlie.c.

Referenced by run_test(), and START_TEST().

◆ g_WinVistaRTM

VersionLieInfo g_WinVistaRTM = { 0x17700006, 6, 0, 6000, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 281 of file versionlie.c.

◆ g_WinVistaSP1

VersionLieInfo g_WinVistaSP1 = { 0x17710006, 6, 0, 6001, VER_PLATFORM_WIN32_NT, 1, 0 }

Definition at line 282 of file versionlie.c.

◆ g_WinVistaSP2

VersionLieInfo g_WinVistaSP2 = { 0x17720006, 6, 0, 6002, VER_PLATFORM_WIN32_NT, 2, 0 }

Definition at line 283 of file versionlie.c.

◆ g_WinXP

VersionLieInfo g_WinXP = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 0, 0 }

Definition at line 273 of file versionlie.c.

◆ g_WinXPSP1

VersionLieInfo g_WinXPSP1 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 1, 0 }

Definition at line 274 of file versionlie.c.

◆ g_WinXPSP2

VersionLieInfo g_WinXPSP2 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 2, 0 }

Definition at line 275 of file versionlie.c.

◆ g_WinXPSP3

VersionLieInfo g_WinXPSP3 = { 0x0a280105, 5, 1, 2600, VER_PLATFORM_WIN32_NT, 3, 0 }

Definition at line 276 of file versionlie.c.

◆ pGetHookAPIs

tGETHOOKAPIS pGetHookAPIs
static

Definition at line 21 of file versionlie.c.

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