Commit f3e7c538 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

version/tests: Print GetLastError() in decimal with '%u'.

parent fa053b74
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
(ERROR_BAD_PATHNAME == GetLastError()), \ (ERROR_BAD_PATHNAME == GetLastError()), \
"Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_BAD_PATHNAME (98)/" \ "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_BAD_PATHNAME (98)/" \
"ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \ "ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \
"expected, got 0x%08x\n", GetLastError()); "expected, got %u\n", GetLastError());
#define EXPECT_INVALID__NOT_FOUND \ #define EXPECT_INVALID__NOT_FOUND \
ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \ ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \
(ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \ (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
(ERROR_INVALID_PARAMETER == GetLastError()), \ (ERROR_INVALID_PARAMETER == GetLastError()), \
"Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_INVALID_PARAMETER (98)/" \ "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_INVALID_PARAMETER (98)/" \
"ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \ "ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3)" \
"expected, got 0x%08x\n", GetLastError()); "expected, got %u\n", GetLastError());
static void test_info_size(void) static void test_info_size(void)
{ DWORD hdl, retval; { DWORD hdl, retval;
...@@ -87,7 +87,7 @@ static void test_info_size(void) ...@@ -87,7 +87,7 @@ static void test_info_size(void)
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n", "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
retval); retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()), ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08x (NT4) expected, got 0x%08x\n", "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
MY_LAST_ERROR, GetLastError()); MY_LAST_ERROR, GetLastError());
hdl = 0x55555555; hdl = 0x55555555;
...@@ -97,7 +97,7 @@ static void test_info_size(void) ...@@ -97,7 +97,7 @@ static void test_info_size(void)
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n", "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
retval); retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()), ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08x (NT4) expected, got 0x%08x\n", "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
MY_LAST_ERROR, GetLastError()); MY_LAST_ERROR, GetLastError());
ok( hdl == 0L, ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08x\n", hdl); "Handle wrong! 0L expected, got 0x%08x\n", hdl);
...@@ -111,7 +111,7 @@ static void test_info_size(void) ...@@ -111,7 +111,7 @@ static void test_info_size(void)
(ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) ||
(MY_LAST_ERROR == GetLastError()), (MY_LAST_ERROR == GetLastError()),
"Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND " "Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND "
"(XP)/0x%08x (NT4) expected, got 0x%08x\n", MY_LAST_ERROR, GetLastError()); "(XP)/0x%08x (NT4) expected, got %u\n", MY_LAST_ERROR, GetLastError());
/* test a currently loaded executable */ /* test a currently loaded executable */
if(GetModuleFileNameA(NULL, mypath, MAX_PATH)) { if(GetModuleFileNameA(NULL, mypath, MAX_PATH)) {
...@@ -122,7 +122,7 @@ static void test_info_size(void) ...@@ -122,7 +122,7 @@ static void test_info_size(void)
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n", "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
retval); retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()), ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08x (NT4) expected, got 0x%08x\n", "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
MY_LAST_ERROR, GetLastError()); MY_LAST_ERROR, GetLastError());
ok( hdl == 0L, ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08x\n", hdl); "Handle wrong! 0L expected, got 0x%08x\n", hdl);
...@@ -144,7 +144,7 @@ static void test_info_size(void) ...@@ -144,7 +144,7 @@ static void test_info_size(void)
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n", "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
retval); retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()), ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08x (NT4) expected, got 0x%08x\n", "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
MY_LAST_ERROR, GetLastError()); MY_LAST_ERROR, GetLastError());
ok( hdl == 0L, ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08x\n", hdl); "Handle wrong! 0L expected, got 0x%08x\n", hdl);
...@@ -186,7 +186,7 @@ static void test_info(void) ...@@ -186,7 +186,7 @@ static void test_info(void)
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n", "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
retval); retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()), ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08x (NT4) expected, got 0x%08x\n", "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
MY_LAST_ERROR, GetLastError()); MY_LAST_ERROR, GetLastError());
ok( hdl == 0L, ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08x\n", hdl); "Handle wrong! 0L expected, got 0x%08x\n", hdl);
...@@ -204,21 +204,21 @@ static void test_info(void) ...@@ -204,21 +204,21 @@ static void test_info(void)
/* this test crashes on WinNT4 /* this test crashes on WinNT4
*/ */
boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, 0); boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, 0);
ok (!boolret, "GetFileVersionInfoA should have failed: GetLastError = %d\n", GetLastError()); ok (!boolret, "GetFileVersionInfoA should have failed: GetLastError = %u\n", GetLastError());
ok ((GetLastError() == ERROR_INVALID_DATA) || (GetLastError() == ERROR_BAD_PATHNAME) || ok ((GetLastError() == ERROR_INVALID_DATA) || (GetLastError() == ERROR_BAD_PATHNAME) ||
(GetLastError() == NO_ERROR), (GetLastError() == NO_ERROR),
"Last error wrong! ERROR_INVALID_DATA/ERROR_BAD_PATHNAME (ME)/" "Last error wrong! ERROR_INVALID_DATA/ERROR_BAD_PATHNAME (ME)/"
"NO_ERROR (95) expected, got 0x%08x\n", "NO_ERROR (95) expected, got %u\n",
GetLastError()); GetLastError());
} }
boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, pVersionInfo ); boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, pVersionInfo );
ok (boolret, "GetFileVersionInfoA failed: GetLastError = 0x%08x\n", GetLastError()); ok (boolret, "GetFileVersionInfoA failed: GetLastError = %u\n", GetLastError());
if (!boolret) if (!boolret)
goto cleanup; goto cleanup;
boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, &uiLength ); boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, &uiLength );
ok (boolret, "VerQueryValueA failed: GetLastError = 0x%08x\n", GetLastError()); ok (boolret, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
if (!boolret) if (!boolret)
goto cleanup; goto cleanup;
...@@ -234,7 +234,7 @@ static void test_info(void) ...@@ -234,7 +234,7 @@ static void test_info(void)
/* this test crashes on WinNT4 /* this test crashes on WinNT4
*/ */
boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, 0); boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, 0);
ok (boolret, "VerQueryValue failed: GetLastError = 0x%08x\n", GetLastError()); ok (boolret, "VerQueryValue failed: GetLastError = %u\n", GetLastError());
} }
cleanup: cleanup:
...@@ -355,13 +355,13 @@ static void test_32bit_win(void) ...@@ -355,13 +355,13 @@ static void test_32bit_win(void)
/* Get the VS_FIXEDFILEINFO information, this must be the same for both A- and W-Calls */ /* Get the VS_FIXEDFILEINFO information, this must be the same for both A- and W-Calls */
retA = VerQueryValueA( pVersionInfoA, rootA, (LPVOID *)&pBufA, &uiLengthA ); retA = VerQueryValueA( pVersionInfoA, rootA, (LPVOID *)&pBufA, &uiLengthA );
ok (retA, "VerQueryValueA failed: GetLastError = 0x%08x\n", GetLastError()); ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA); ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA);
if (is_unicode_enabled) if (is_unicode_enabled)
{ {
retW = VerQueryValueW( pVersionInfoW, rootW, (LPVOID *)&pBufW, &uiLengthW ); retW = VerQueryValueW( pVersionInfoW, rootW, (LPVOID *)&pBufW, &uiLengthW );
ok (retW, "VerQueryValueW failed: GetLastError = 0x%08x\n", GetLastError()); ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA); ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA);
ok( uiLengthA == uiLengthW, "The size of VS_FIXEDFILEINFO should be the same for both A/W calls, it is (%d) vs. (%d)\n", ok( uiLengthA == uiLengthW, "The size of VS_FIXEDFILEINFO should be the same for both A/W calls, it is (%d) vs. (%d)\n",
...@@ -372,13 +372,13 @@ static void test_32bit_win(void) ...@@ -372,13 +372,13 @@ static void test_32bit_win(void)
/* Get some VarFileInfo information, this must be the same for both A- and W-Calls */ /* Get some VarFileInfo information, this must be the same for both A- and W-Calls */
retA = VerQueryValueA( pVersionInfoA, varfileinfoA, (LPVOID *)&pBufA, &uiLengthA ); retA = VerQueryValueA( pVersionInfoA, varfileinfoA, (LPVOID *)&pBufA, &uiLengthA );
ok (retA, "VerQueryValueA failed: GetLastError = 0x%08x\n", GetLastError()); ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
ok( !memcmp(pBufA, WineVarFileInfoA, uiLengthA), "The VarFileInfo should have matched 0904e404 (non case sensitive)\n"); ok( !memcmp(pBufA, WineVarFileInfoA, uiLengthA), "The VarFileInfo should have matched 0904e404 (non case sensitive)\n");
if (is_unicode_enabled) if (is_unicode_enabled)
{ {
retW = VerQueryValueW( pVersionInfoW, varfileinfoW, (LPVOID *)&pBufW, &uiLengthW ); retW = VerQueryValueW( pVersionInfoW, varfileinfoW, (LPVOID *)&pBufW, &uiLengthW );
ok (retW, "VerQueryValueW failed: GetLastError = 0x%08x\n", GetLastError()); ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
ok( uiLengthA == uiLengthW, "The size of the VarFileInfo information should be the same for both A/W calls, it is (%d) vs. (%d)\n", ok( uiLengthA == uiLengthW, "The size of the VarFileInfo information should be the same for both A/W calls, it is (%d) vs. (%d)\n",
uiLengthA, uiLengthW); uiLengthA, uiLengthW);
ok( !memcmp(pBufA, pBufW, uiLengthA), "Both values should be the same, they aren't\n"); ok( !memcmp(pBufA, pBufW, uiLengthA), "Both values should be the same, they aren't\n");
...@@ -387,18 +387,18 @@ static void test_32bit_win(void) ...@@ -387,18 +387,18 @@ static void test_32bit_win(void)
/* Get some StringFileInfo information, this will be ANSI for A-Calls and Unicode for W-Calls */ /* Get some StringFileInfo information, this will be ANSI for A-Calls and Unicode for W-Calls */
retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA ); retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA );
ok (retA, "VerQueryValueA failed: GetLastError = 0x%08x\n", GetLastError()); ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
ok( !lstrcmpA(WineFileDescriptionA, pBufA), "FileDescription should have been 'Wine version test'\n"); ok( !lstrcmpA(WineFileDescriptionA, pBufA), "FileDescription should have been 'Wine version test'\n");
/* Test a second time */ /* Test a second time */
retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA ); retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA );
ok (retA, "VerQueryValueA failed: GetLastError = 0x%08x\n", GetLastError()); ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
ok( !lstrcmpA(WineFileDescriptionA, pBufA), "FileDescription should have been 'Wine version test'\n"); ok( !lstrcmpA(WineFileDescriptionA, pBufA), "FileDescription should have been 'Wine version test'\n");
if (is_unicode_enabled) if (is_unicode_enabled)
{ {
retW = VerQueryValueW( pVersionInfoW, FileDescriptionW, (LPVOID *)&pBufW, &uiLengthW ); retW = VerQueryValueW( pVersionInfoW, FileDescriptionW, (LPVOID *)&pBufW, &uiLengthW );
ok (retW, "VerQueryValueW failed: GetLastError = 0x%08x\n", GetLastError()); ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
ok( !lstrcmpW(WineFileDescriptionW, pBufW), "FileDescription should have been 'Wine version test' (unicode)\n"); ok( !lstrcmpW(WineFileDescriptionW, pBufW), "FileDescription should have been 'Wine version test' (unicode)\n");
} }
......
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