mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
kernel32: Add some simple tests for GetVersionExA.
This commit is contained in:
parent
29d66b48ef
commit
b3a85a3fc4
@ -43,12 +43,64 @@ static void init_function_pointers(void)
|
||||
KERNEL32_GET_PROC(VerSetConditionMask);
|
||||
}
|
||||
|
||||
static void test_GetVersionEx(void)
|
||||
{
|
||||
OSVERSIONINFOA infoA;
|
||||
OSVERSIONINFOEXA infoExA;
|
||||
BOOL ret;
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Silently crashes on XP */
|
||||
ret = GetVersionExA(NULL);
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
memset(&infoA,0,sizeof infoA);
|
||||
ret = GetVersionExA(&infoA);
|
||||
ok(!ret, "Expected GetVersionExA to fail\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) / 2;
|
||||
ret = GetVersionExA(&infoA);
|
||||
ok(!ret, "Expected GetVersionExA to fail\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) * 2;
|
||||
ret = GetVersionExA(&infoA);
|
||||
ok(!ret, "Expected GetVersionExA to fail\n");
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
||||
ret = GetVersionExA(&infoA);
|
||||
ok(ret, "Expected GetVersionExA to succeed\n");
|
||||
ok(GetLastError() == 0xdeadbeef,
|
||||
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
infoExA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
|
||||
ret = GetVersionExA((OSVERSIONINFOA *)&infoExA);
|
||||
ok(ret, "Expected GetVersionExA to succeed\n");
|
||||
ok(GetLastError() == 0xdeadbeef,
|
||||
"Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
}
|
||||
|
||||
START_TEST(version)
|
||||
{
|
||||
OSVERSIONINFOEX info = { sizeof(info) };
|
||||
BOOL ret;
|
||||
|
||||
init_function_pointers();
|
||||
|
||||
test_GetVersionEx();
|
||||
|
||||
if(!pVerifyVersionInfoA || !pVerSetConditionMask)
|
||||
{
|
||||
skip("Needed functions not available\n");
|
||||
|
@ -154,6 +154,7 @@ BOOL WINAPI GetVersionExA(OSVERSIONINFOA *v)
|
||||
{
|
||||
WARN("wrong OSVERSIONINFO size from app (got: %d)\n",
|
||||
v->dwOSVersionInfoSize );
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user