Commit b3a85a3f authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

kernel32: Add some simple tests for GetVersionExA.

parent 29d66b48
...@@ -43,12 +43,64 @@ static void init_function_pointers(void) ...@@ -43,12 +43,64 @@ static void init_function_pointers(void)
KERNEL32_GET_PROC(VerSetConditionMask); 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) START_TEST(version)
{ {
OSVERSIONINFOEX info = { sizeof(info) }; OSVERSIONINFOEX info = { sizeof(info) };
BOOL ret; BOOL ret;
init_function_pointers(); init_function_pointers();
test_GetVersionEx();
if(!pVerifyVersionInfoA || !pVerSetConditionMask) if(!pVerifyVersionInfoA || !pVerSetConditionMask)
{ {
skip("Needed functions not available\n"); skip("Needed functions not available\n");
......
...@@ -154,6 +154,7 @@ BOOL WINAPI GetVersionExA(OSVERSIONINFOA *v) ...@@ -154,6 +154,7 @@ BOOL WINAPI GetVersionExA(OSVERSIONINFOA *v)
{ {
WARN("wrong OSVERSIONINFO size from app (got: %d)\n", WARN("wrong OSVERSIONINFO size from app (got: %d)\n",
v->dwOSVersionInfoSize ); v->dwOSVersionInfoSize );
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE; return FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment