kernel32/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-09 08:19:58 +01:00 committed by Alexandre Julliard
parent b38d52cef4
commit c971429419
3 changed files with 162 additions and 159 deletions

View File

@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <stdarg.h>
@ -42,9 +43,9 @@ static void test_granted_access(HANDLE handle, ACCESS_MASK access, int line)
status = pNtQueryObject(handle, ObjectBasicInformation, &obj_info,
sizeof(obj_info), NULL);
ok_(__FILE__, line)(!status, "NtQueryObject with err: %08x\n", status);
ok_(__FILE__, line)(!status, "NtQueryObject with err: %08lx\n", status);
ok_(__FILE__, line)(obj_info.GrantedAccess == access, "Granted access should "
"be 0x%08x, instead of 0x%08x\n", access, obj_info.GrantedAccess);
"be 0x%08lx, instead of 0x%08lx\n", access, obj_info.GrantedAccess);
}
/* If you change something in these tests, please do the same
@ -185,12 +186,12 @@ static void test_CreateDirectoryA(void)
ret = CreateDirectoryA(NULL, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER),
"CreateDirectoryA(NULL): ret=%d err=%d\n", ret, GetLastError());
"CreateDirectoryA(NULL): ret=%d err=%ld\n", ret, GetLastError());
ret = CreateDirectoryA("", NULL);
ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
ret = GetSystemDirectoryA(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
@ -201,53 +202,53 @@ static void test_CreateDirectoryA(void)
ret = CreateDirectoryA(".", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
ret = CreateDirectoryA("..", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
GetTempPathA(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS ||
GetLastError() == ERROR_ACCESS_DENIED),
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
ok(ret == TRUE, "CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
lstrcatA(tmpdir, "?");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
RemoveDirectoryA(tmpdir);
tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
RemoveDirectoryA(tmpdir);
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me/Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
RemoveDirectoryA(tmpdir);
/* Test behavior with a trailing dot.
@ -257,21 +258,21 @@ static void test_CreateDirectoryA(void)
lstrcatA(tmpdir, "Please Remove Me.");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE,
"CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
lstrcatA(tmpdir, "/Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE,
"CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
/* Test behavior with two trailing dots.
* The directory should be created without the trailing dots.
@ -280,25 +281,25 @@ static void test_CreateDirectoryA(void)
lstrcatA(tmpdir, "Please Remove Me..");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE,
"CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
lstrcatA(tmpdir, "/Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE || /* On Win98 */
(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
if (ret == TRUE)
{
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
}
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
/* Test behavior with a trailing space.
* The directory should be created without the trailing space.
@ -307,25 +308,25 @@ static void test_CreateDirectoryA(void)
lstrcatA(tmpdir, "Please Remove Me ");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE,
"CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
lstrcatA(tmpdir, "/Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE || /* On Win98 */
(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
if (ret == TRUE)
{
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
}
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
/* Test behavior with a trailing space.
* The directory should be created without the trailing spaces.
@ -334,25 +335,25 @@ static void test_CreateDirectoryA(void)
lstrcatA(tmpdir, "Please Remove Me ");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE,
"CreateDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"CreateDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
lstrcatA(tmpdir, "/Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE || /* On Win98 */
(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND), /* On NT! */
"CreateDirectoryA(%s): ret=%d err=%d\n", tmpdir, ret, GetLastError());
"CreateDirectoryA(%s): ret=%d err=%ld\n", tmpdir, ret, GetLastError());
if (ret == TRUE)
{
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
}
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE,
"RemoveDirectoryA(%s) failed err=%d\n", tmpdir, GetLastError());
"RemoveDirectoryA(%s) failed err=%ld\n", tmpdir, GetLastError());
SetCurrentDirectoryW(curdir);
}
@ -375,32 +376,32 @@ static void test_CreateDirectoryW(void)
return;
}
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"should not create NULL path ret %u err %u\n", ret, GetLastError());
"should not create NULL path ret %u err %lu\n", ret, GetLastError());
ret = CreateDirectoryW(empty_strW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"should not create empty path ret %u err %u\n", ret, GetLastError());
"should not create empty path ret %u err %lu\n", ret, GetLastError());
ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
GetCurrentDirectoryW(MAX_PATH, curdir);
ret = SetCurrentDirectoryW(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory ret %u err %u\n", ret, GetLastError());
ok(ret == TRUE, "could not chdir to the System directory ret %u err %lu\n", ret, GetLastError());
ret = CreateDirectoryW(dotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
"should not create existing path ret %u err %lu\n", ret, GetLastError());
ret = CreateDirectoryW(dotdotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
"should not create existing path ret %u err %lu\n", ret, GetLastError());
GetTempPathW(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_ALREADY_EXISTS),
"should deny access to the drive root ret %u err %u\n", ret, GetLastError());
"should deny access to the drive root ret %u err %lu\n", ret, GetLastError());
GetTempPathW(MAX_PATH, tmpdir);
lstrcatW(tmpdir, tmp_dir_name);
@ -409,7 +410,7 @@ static void test_CreateDirectoryW(void)
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS,
"should not create existing path ret %u err %u\n", ret, GetLastError());
"should not create existing path ret %u err %lu\n", ret, GetLastError());
ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
@ -417,7 +418,7 @@ static void test_CreateDirectoryW(void)
lstrcatW(tmpdir, questionW);
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%d\n",
"CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE, "RemoveDirectoryW should have failed\n");
@ -425,7 +426,7 @@ static void test_CreateDirectoryW(void)
tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%d\n",
"CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE, "RemoveDirectoryW should have failed\n");
@ -436,7 +437,7 @@ static void test_CreateDirectoryW(void)
lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND,
"CreateDirectoryW with multiple nonexistent directories in path should fail ret %u err %u\n",
"CreateDirectoryW with multiple nonexistent directories in path should fail ret %u err %lu\n",
ret, GetLastError());
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE, "RemoveDirectoryW should have failed\n");
@ -461,7 +462,7 @@ static void test_RemoveDirectoryA(void)
SetLastError(0xdeadbeef);
ok(!RemoveDirectoryA(tmpdir), "RemoveDirectoryA succeeded\n");
ok(GetLastError() == ERROR_SHARING_VIOLATION,
"Expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError());
"Expected ERROR_SHARING_VIOLATION, got %lu\n", GetLastError());
TEST_GRANTED_ACCESS(NtCurrentTeb()->Peb->ProcessParameters->CurrentDirectory.Handle,
FILE_TRAVERSE | SYNCHRONIZE);
@ -474,14 +475,14 @@ static void test_RemoveDirectoryA(void)
ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"RemoveDirectoryA with ? wildcard name should fail, ret=%s error=%d\n",
"RemoveDirectoryA with ? wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && (GetLastError() == ERROR_INVALID_NAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"RemoveDirectoryA with * wildcard name should fail, ret=%s error=%d\n",
"RemoveDirectoryA with * wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
}
@ -510,7 +511,7 @@ static void test_RemoveDirectoryW(void)
SetLastError(0xdeadbeef);
ok(!RemoveDirectoryW(tmpdir), "RemoveDirectoryW succeeded\n");
ok(GetLastError() == ERROR_SHARING_VIOLATION,
"Expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError());
"Expected ERROR_SHARING_VIOLATION, got %lu\n", GetLastError());
TEST_GRANTED_ACCESS(NtCurrentTeb()->Peb->ProcessParameters->CurrentDirectory.Handle,
FILE_TRAVERSE | SYNCHRONIZE);
@ -522,13 +523,13 @@ static void test_RemoveDirectoryW(void)
lstrcatW(tmpdir, questionW);
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%d\n",
"RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%d\n",
"RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
}
@ -536,9 +537,9 @@ static void test_SetCurrentDirectoryA(void)
{
SetLastError(0);
ok( !SetCurrentDirectoryA( "\\some_dummy_dir" ), "SetCurrentDirectoryA succeeded\n" );
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %d\n", GetLastError() );
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %ld\n", GetLastError() );
ok( !SetCurrentDirectoryA( "\\some_dummy\\subdir" ), "SetCurrentDirectoryA succeeded\n" );
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "wrong error %d\n", GetLastError() );
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "wrong error %ld\n", GetLastError() );
}
static void test_CreateDirectory_root(void)
@ -551,7 +552,7 @@ static void test_CreateDirectory_root(void)
GetCurrentDirectoryA(sizeof(curdir), curdir);
ret = SetCurrentDirectoryA("C:\\");
ok(ret, "SetCurrentDirectory error %u\n", GetLastError());
ok(ret, "SetCurrentDirectory error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CreateDirectoryA("C:\\", NULL);
@ -562,22 +563,22 @@ static void test_CreateDirectory_root(void)
SetCurrentDirectoryA(curdir);
return;
}
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %u\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CreateDirectoryA("C:", NULL);
ok(!ret, "CreateDirectory should fail\n");
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %u\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CreateDirectoryW(drive_c_root, NULL);
ok(!ret, "CreateDirectory should fail\n");
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %u\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CreateDirectoryW(drive_c, NULL);
ok(!ret, "CreateDirectory should fail\n");
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %u\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_EXISTS, "got %lu\n", GetLastError());
SetCurrentDirectoryA(curdir);
}

View File

@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include <stdarg.h>
@ -109,11 +110,11 @@ static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter)
SetLastError( 0xdeadbeef );
ret = pFlsGetValue(fls_index_to_set);
ok(ret == NULL, "FlsGetValue returned %p, expected NULL\n", ret);
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %u.\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %lu.\n", GetLastError());
/* Set the FLS value */
bret = pFlsSetValue(fls_index_to_set, fls_value_to_set);
ok(bret, "FlsSetValue failed with error %u\n", GetLastError());
ok(bret, "FlsSetValue failed with error %lu\n", GetLastError());
ok(!!teb->FlsSlots, "Got unexpected FlsSlots %p.\n", teb->FlsSlots);
@ -121,7 +122,7 @@ static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter)
SetLastError( 0xdeadbeef );
ret = pFlsGetValue(fls_index_to_set);
ok(ret == fls_value_to_set, "FlsGetValue returned %p, expected %p\n", ret, fls_value_to_set);
ok(GetLastError() == ERROR_SUCCESS, "FlsGetValue error %u\n", GetLastError());
ok(GetLastError() == ERROR_SUCCESS, "FlsGetValue error %lu\n", GetLastError());
}
pSwitchToFiber(fibers[0]);
}
@ -133,12 +134,12 @@ static void test_ConvertThreadToFiber(void)
if (pConvertThreadToFiber)
{
fibers[0] = pConvertThreadToFiber(&testparam);
ok(fibers[0] != NULL, "ConvertThreadToFiber failed with error %u\n", GetLastError());
ok(fibers[0] != NULL, "ConvertThreadToFiber failed with error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pConvertThreadToFiber(&testparam);
ok(!ret, "Got non NULL ret.\n");
ok(GetLastError() == ERROR_ALREADY_FIBER, "Got unexpected error %u.\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_FIBER, "Got unexpected error %lu.\n", GetLastError());
}
else
{
@ -153,12 +154,12 @@ static void test_ConvertThreadToFiberEx(void)
if (pConvertThreadToFiberEx)
{
fibers[0] = pConvertThreadToFiberEx(&testparam, 0);
ok(fibers[0] != NULL, "ConvertThreadToFiberEx failed with error %u\n", GetLastError());
ok(fibers[0] != NULL, "ConvertThreadToFiberEx failed with error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pConvertThreadToFiberEx(&testparam, 0);
ok(!ret, "Got non NULL ret.\n");
ok(GetLastError() == ERROR_ALREADY_FIBER, "Got unexpected error %u.\n", GetLastError());
ok(GetLastError() == ERROR_ALREADY_FIBER, "Got unexpected error %lu.\n", GetLastError());
}
else
{
@ -171,7 +172,7 @@ static void test_ConvertFiberToThread(void)
if (pConvertFiberToThread)
{
BOOL ret = pConvertFiberToThread();
ok(ret, "ConvertFiberToThread failed with error %u\n", GetLastError());
ok(ret, "ConvertFiberToThread failed with error %lu\n", GetLastError());
}
else
{
@ -183,7 +184,7 @@ static void test_FiberHandling(void)
{
fiberCount = 0;
fibers[0] = pCreateFiber(0,FiberMainProc,&testparam);
ok(fibers[0] != NULL, "CreateFiber failed with error %u\n", GetLastError());
ok(fibers[0] != NULL, "CreateFiber failed with error %lu\n", GetLastError());
pDeleteFiber(fibers[0]);
test_ConvertThreadToFiber();
@ -194,7 +195,7 @@ static void test_FiberHandling(void)
test_ConvertThreadToFiber();
fibers[1] = pCreateFiber(0,FiberMainProc,&testparam);
ok(fibers[1] != NULL, "CreateFiber failed with error %u\n", GetLastError());
ok(fibers[1] != NULL, "CreateFiber failed with error %lu\n", GetLastError());
pSwitchToFiber(fibers[1]);
ok(fiberCount == 1, "Wrong fiber count: %d\n", fiberCount);
@ -203,7 +204,7 @@ static void test_FiberHandling(void)
if (pCreateFiberEx)
{
fibers[1] = pCreateFiberEx(0,0,0,FiberMainProc,&testparam);
ok(fibers[1] != NULL, "CreateFiberEx failed with error %u\n", GetLastError());
ok(fibers[1] != NULL, "CreateFiberEx failed with error %lu\n", GetLastError());
pSwitchToFiber(fibers[1]);
ok(fiberCount == 2, "Wrong fiber count: %d\n", fiberCount);
@ -301,7 +302,7 @@ static void test_FiberLocalStorage(void)
if (pRtlFlsGetValue)
{
status = pRtlFlsGetValue(0, NULL);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
}
else
{
@ -312,16 +313,16 @@ static void test_FiberLocalStorage(void)
{
fls_indices[i] = 0xdeadbeef;
status = pRtlFlsAlloc(test_fls_callback, &fls_indices[i]);
ok(!status || status == STATUS_NO_MEMORY, "Got unexpected status %#x.\n", status);
ok(!status || status == STATUS_NO_MEMORY, "Got unexpected status %#lx.\n", status);
if (status)
{
ok(fls_indices[i] == 0xdeadbeef, "Got unexpected index %#x.\n", fls_indices[i]);
ok(fls_indices[i] == 0xdeadbeef, "Got unexpected index %#lx.\n", fls_indices[i]);
break;
}
if (pRtlFlsSetValue)
{
status = pRtlFlsSetValue(fls_indices[i], (void *)(ULONG_PTR)(i + 1));
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
}
}
count = i;
@ -336,7 +337,7 @@ static void test_FiberLocalStorage(void)
ok(pRtlFlsSetValue && pRtlFlsGetValue, "Missing RtlFlsGetValue / RtlFlsSetValue.\n");
ok(!peb->FlsBitmap, "Got unexpected FlsBitmap %p.\n", peb->FlsBitmap);
ok(!peb->FlsListHead.Flink && !peb->FlsListHead.Blink, "Got nonzero FlsListHead.\n");
ok(!peb->FlsHighIndex, "Got unexpected FlsHighIndex %u.\n", peb->FlsHighIndex);
ok(!peb->FlsHighIndex, "Got unexpected FlsHighIndex %lu.\n", peb->FlsHighIndex);
fls_list_head = fls_data->fls_list_entry.Flink;
@ -346,13 +347,13 @@ static void test_FiberLocalStorage(void)
g_fls_data = CONTAINING_RECORD(fls_list_head, GLOBAL_FLS_DATA, fls_list_head);
ok(g_fls_data->fls_high_index == 0xfef, "Got unexpected fls_high_index %#x.\n", g_fls_data->fls_high_index);
ok(g_fls_data->fls_high_index == 0xfef, "Got unexpected fls_high_index %#lx.\n", g_fls_data->fls_high_index);
for (i = 0; i < 8; ++i)
{
ok(!!g_fls_data->fls_callback_chunks[i], "Got zero fls_callback_chunks[%u].\n", i);
ok(g_fls_data->fls_callback_chunks[i]->count == test_fls_chunk_size(i),
"Got unexpected g_fls_data->fls_callback_chunks[%u]->count %u.\n",
"Got unexpected g_fls_data->fls_callback_chunks[%u]->count %lu.\n",
i, g_fls_data->fls_callback_chunks[i]->count);
size = HeapSize(GetProcessHeap(), 0, g_fls_data->fls_callback_chunks[i]);
@ -392,12 +393,12 @@ static void test_FiberLocalStorage(void)
j = test_fls_chunk_index_from_index(fls_indices[0x10], &index);
g_fls_data->fls_callback_chunks[j]->callbacks[index].callback = NULL;
status = pRtlFlsFree(fls_indices[0x10]);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
g_fls_data->fls_callback_chunks[j]->callbacks[index].callback = test_fls_callback;
test_fls_callback_call_count = 0;
status = pRtlFlsFree(fls_indices[0x10]);
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
ok(test_fls_callback_call_count == 1, "Got unexpected callback call count %u.\n",
test_fls_callback_call_count);
@ -409,26 +410,26 @@ static void test_FiberLocalStorage(void)
fls_data->fls_data_chunks[j][index + 1] = (void *)(ULONG_PTR)0x28;
status = pRtlFlsAlloc(test_fls_callback, &index2);
ok(!status, "Got unexpected status %#x.\n", status);
ok(index2 == fls_indices[0x10], "Got unexpected index %u.\n", index2);
ok(!status, "Got unexpected status %#lx.\n", status);
ok(index2 == fls_indices[0x10], "Got unexpected index %lu.\n", index2);
ok(fls_data->fls_data_chunks[j][index + 1] == (void *)(ULONG_PTR)0x28, "Got unexpected data %p.\n",
fls_data->fls_data_chunks[j][index + 1]);
status = pRtlFlsSetValue(index2, (void *)(ULONG_PTR)0x11);
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
teb->FlsSlots = NULL;
val = (void *)0xdeadbeef;
status = pRtlFlsGetValue(fls_indices[1], &val);
new_fls_data = teb->FlsSlots;
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
ok(val == (void *)0xdeadbeef, "Got unexpected val %p.\n", val);
ok(!new_fls_data, "Got unexpected teb->FlsSlots %p.\n", new_fls_data);
status = pRtlFlsSetValue(fls_indices[1], (void *)(ULONG_PTR)0x28);
new_fls_data = teb->FlsSlots;
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
ok(!!new_fls_data, "Got unexpected teb->FlsSlots %p.\n", new_fls_data);
entry_count = check_linked_list(fls_list_head, &fls_data->fls_list_entry, &index);
@ -439,7 +440,7 @@ static void test_FiberLocalStorage(void)
val = (void *)0xdeadbeef;
status = pRtlFlsGetValue(fls_indices[2], &val);
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
ok(!val, "Got unexpected val %p.\n", val);
@ -468,7 +469,7 @@ static void test_FiberLocalStorage(void)
hthread = CreateThread(NULL, 0, test_FiberLocalStorage_thread, NULL, 0, NULL);
ok(!!hthread, "CreateThread failed.\n");
result = WaitForSingleObject(test_fiberlocalstorage_peb_locked_event, INFINITE);
ok(result == WAIT_OBJECT_0, "Got unexpected result %u.\n", result);
ok(result == WAIT_OBJECT_0, "Got unexpected result %lu.\n", result);
teb->FlsSlots = NULL;
test_fls_callback_call_count = 0;
@ -526,17 +527,17 @@ static void test_FiberLocalStorage(void)
if (pRtlFlsGetValue)
{
status = pRtlFlsGetValue(fls_indices[i], &val);
ok(!status, "Got unexpected status %#x.\n", status);
ok(!status, "Got unexpected status %#lx.\n", status);
ok(val == (void *)(ULONG_PTR)(i + 1), "Got unexpected val %p, i %u.\n", val, i);
}
status = pRtlFlsFree(fls_indices[i]);
ok(!status, "Got unexpected status %#x, i %u.\n", status, i);
ok(!status, "Got unexpected status %#lx, i %u.\n", status, i);
}
if (!peb->FlsCallback)
{
ok(g_fls_data->fls_high_index == 0xfef, "Got unexpected fls_high_index %#x.\n",
ok(g_fls_data->fls_high_index == 0xfef, "Got unexpected fls_high_index %#lx.\n",
g_fls_data->fls_high_index);
for (i = 0; i < 8; ++i)
@ -559,34 +560,34 @@ static void test_FiberLocalStorage(void)
ret = pFlsFree( 127 );
ok( !ret, "freeing fls index 127 (unallocated) succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER,
"freeing fls index 127 (unallocated) wrong error %u\n", GetLastError() );
"freeing fls index 127 (unallocated) wrong error %lu\n", GetLastError() );
val = pFlsGetValue( 127 );
ok( val == NULL,
"getting fls index 127 (unallocated) failed with error %u\n", GetLastError() );
"getting fls index 127 (unallocated) failed with error %lu\n", GetLastError() );
if (pRtlFlsGetValue)
{
val = (void *)0xdeadbeef;
status = pRtlFlsGetValue(127, &val);
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( !val, "Got unexpected val %p.\n", val );
}
ret = pFlsSetValue( 127, (void*) 0x217 );
ok( ret, "setting fls index 127 (unallocated) failed with error %u\n", GetLastError() );
ok( ret, "setting fls index 127 (unallocated) failed with error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
val = pFlsGetValue( 127 );
ok( val == (void*) 0x217, "fls index 127 (unallocated) wrong value %p\n", val );
ok( GetLastError() == ERROR_SUCCESS,
"getting fls index 127 (unallocated) failed with error %u\n", GetLastError() );
"getting fls index 127 (unallocated) failed with error %lu\n", GetLastError() );
if (pRtlFlsGetValue)
{
val = (void *)0xdeadbeef;
status = pRtlFlsGetValue(127, &val);
ok( !status, "Got unexpected status %#x.\n", status );
ok( !status, "Got unexpected status %#lx.\n", status );
ok( val == (void*)0x217, "Got unexpected val %p.\n", val );
}
@ -597,86 +598,86 @@ static void test_FiberLocalStorage(void)
ret = pFlsFree( 128 );
ok( !ret, "freeing fls index 128 (out of bounds) succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER,
"freeing fls index 128 (out of bounds) wrong error %u\n", GetLastError() );
"freeing fls index 128 (out of bounds) wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pFlsSetValue( 128, (void*) 0x217 );
ok( ret || GetLastError() == ERROR_INVALID_PARAMETER,
"setting fls index 128 (out of bounds) wrong error %u\n", GetLastError() );
"setting fls index 128 (out of bounds) wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
val = pFlsGetValue( 128 );
ok( GetLastError() == ERROR_INVALID_PARAMETER || val == (void *)0x217,
"getting fls index 128 (out of bounds) wrong error %u\n", GetLastError() );
"getting fls index 128 (out of bounds) wrong error %lu\n", GetLastError() );
/* Test index 0 */
SetLastError( 0xdeadbeef );
val = pFlsGetValue( 0 );
ok( !val, "fls index 0 set to %p\n", val );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %lu\n", GetLastError() );
if (pRtlFlsGetValue)
{
val = (void *)0xdeadbeef;
status = pRtlFlsGetValue(0, &val);
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status );
ok( val == (void*)0xdeadbeef, "Got unexpected val %p.\n", val );
}
SetLastError( 0xdeadbeef );
ret = pFlsSetValue( 0, (void *)0xdeadbeef );
ok( !ret, "setting fls index 0 succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %lu\n", GetLastError() );
if (pRtlFlsSetValue)
{
status = pRtlFlsSetValue( 0, (void *)0xdeadbeef );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status );
ok( status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status );
}
SetLastError( 0xdeadbeef );
val = pFlsGetValue( 0 );
ok( !val, "fls index 0 wrong value %p\n", val );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %u\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "setting fls index wrong error %lu\n", GetLastError() );
/* Test creating an FLS index */
fls = pFlsAlloc( NULL );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed\n" );
ok( fls != 0, "fls index 0 allocated\n" );
val = pFlsGetValue( fls );
ok( !val, "fls index %u wrong value %p\n", fls, val );
ok( !val, "fls index %lu wrong value %p\n", fls, val );
SetLastError( 0xdeadbeef );
ret = pFlsSetValue( fls, (void *)0xdeadbeef );
ok( ret, "setting fls index %u failed\n", fls );
ok( GetLastError() == 0xdeadbeef, "setting fls index wrong error %u\n", GetLastError() );
ok( ret, "setting fls index %lu failed\n", fls );
ok( GetLastError() == 0xdeadbeef, "setting fls index wrong error %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
val = pFlsGetValue( fls );
ok( val == (void *)0xdeadbeef, "fls index %u wrong value %p\n", fls, val );
ok( val == (void *)0xdeadbeef, "fls index %lu wrong value %p\n", fls, val );
ok( GetLastError() == ERROR_SUCCESS,
"getting fls index %u failed with error %u\n", fls, GetLastError() );
"getting fls index %lu failed with error %lu\n", fls, GetLastError() );
pFlsFree( fls );
/* Undefined behavior: verify the value is NULL after it the slot is freed */
SetLastError( 0xdeadbeef );
val = pFlsGetValue( fls );
ok( val == NULL, "fls index %u wrong value %p\n", fls, val );
ok( val == NULL, "fls index %lu wrong value %p\n", fls, val );
ok( GetLastError() == ERROR_SUCCESS,
"getting fls index %u failed with error %u\n", fls, GetLastError() );
"getting fls index %lu failed with error %lu\n", fls, GetLastError() );
/* Undefined behavior: verify the value is settable after the slot is freed */
ret = pFlsSetValue( fls, (void *)0xdeadbabe );
ok( ret, "setting fls index %u failed\n", fls );
ok( ret, "setting fls index %lu failed\n", fls );
val = pFlsGetValue( fls );
ok( val == (void *)0xdeadbabe, "fls index %u wrong value %p\n", fls, val );
ok( val == (void *)0xdeadbabe, "fls index %lu wrong value %p\n", fls, val );
/* Try to create the same FLS index again, and verify that is initialized to NULL */
fls_2 = pFlsAlloc( NULL );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %u\n", GetLastError() );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %lu\n", GetLastError() );
/* If this fails it is not an API error, but the test will be inconclusive */
ok( fls_2 == fls, "different FLS index allocated, was %u, now %u\n", fls, fls_2 );
ok( fls_2 == fls, "different FLS index allocated, was %lu, now %lu\n", fls, fls_2 );
SetLastError( 0xdeadbeef );
val = pFlsGetValue( fls_2 );
ok( val == NULL || val == (void *)0xdeadbabe, "fls index %u wrong value %p\n", fls, val );
ok( val == NULL || val == (void *)0xdeadbabe, "fls index %lu wrong value %p\n", fls, val );
ok( GetLastError() == ERROR_SUCCESS,
"getting fls index %u failed with error %u\n", fls_2, GetLastError() );
"getting fls index %lu failed with error %lu\n", fls_2, GetLastError() );
pFlsFree( fls_2 );
}
@ -695,30 +696,30 @@ static void test_FiberLocalStorageCallback(PFLS_CALLBACK_FUNCTION cbfunc)
/* Test that the callback is executed */
cbCount = 0;
fls = pFlsAlloc( cbfunc );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %u\n", GetLastError() );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %lu\n", GetLastError() );
val = (void*) 0x1587;
fls_value_to_set = val;
ret = pFlsSetValue( fls, val );
ok(ret, "FlsSetValue failed with error %u\n", GetLastError() );
ok(ret, "FlsSetValue failed with error %lu\n", GetLastError() );
val2 = pFlsGetValue( fls );
ok(val == val2, "FlsGetValue returned %p, expected %p\n", val2, val);
ret = pFlsFree( fls );
ok(ret, "FlsFree failed with error %u\n", GetLastError() );
ok(ret, "FlsFree failed with error %lu\n", GetLastError() );
ok( cbCount == 1, "Wrong callback count: %d\n", cbCount );
/* Test that callback is not executed if value is NULL */
cbCount = 0;
fls = pFlsAlloc( cbfunc );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %u\n", GetLastError() );
ok( fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %lu\n", GetLastError() );
ret = pFlsSetValue( fls, NULL );
ok( ret, "FlsSetValue failed with error %u\n", GetLastError() );
ok( ret, "FlsSetValue failed with error %lu\n", GetLastError() );
pFlsFree( fls );
ok( ret, "FlsFree failed with error %u\n", GetLastError() );
ok( ret, "FlsFree failed with error %lu\n", GetLastError() );
ok( cbCount == 0, "Wrong callback count: %d\n", cbCount );
}
@ -735,7 +736,7 @@ static void test_FiberLocalStorageWithFibers(PFLS_CALLBACK_FUNCTION cbfunc)
}
fls_index_to_set = pFlsAlloc(cbfunc);
ok(fls_index_to_set != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %u\n", GetLastError());
ok(fls_index_to_set != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %lu\n", GetLastError());
test_ConvertThreadToFiber();
@ -743,8 +744,8 @@ static void test_FiberLocalStorageWithFibers(PFLS_CALLBACK_FUNCTION cbfunc)
cbCount = 0;
fibers[1] = pCreateFiber(0,FiberMainProc,&testparam);
fibers[2] = pCreateFiber(0,FiberMainProc,&testparam);
ok(fibers[1] != NULL, "CreateFiber failed with error %u\n", GetLastError());
ok(fibers[2] != NULL, "CreateFiber failed with error %u\n", GetLastError());
ok(fibers[1] != NULL, "CreateFiber failed with error %lu\n", GetLastError());
ok(fibers[2] != NULL, "CreateFiber failed with error %lu\n", GetLastError());
ok(fiberCount == 0, "Wrong fiber count: %d\n", fiberCount);
ok(cbCount == 0, "Wrong callback count: %d\n", cbCount);
@ -841,7 +842,7 @@ static void test_fls_exit_deadlock(void)
winetest_get_mainargs(&argv);
sprintf(cmdline, "%s %s fls_exit_deadlock", argv[0], argv[1]);
ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
ok(ret, "failed to create child, error %u\n", GetLastError());
ok(ret, "failed to create child, error %lu\n", GetLastError());
ret = WaitForSingleObject(pi.hProcess, 1000);
ok(!ret, "wait failed\n");
CloseHandle(pi.hProcess);

View File

@ -17,6 +17,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include "wine/test.h"
#include "winbase.h"
@ -93,10 +94,10 @@ static void test_GetProductInfo(void)
if (entry[0] >= 6)
ok(res && (product > PRODUCT_UNDEFINED) && (product <= PRODUCT_ENTERPRISE_S_N_EVALUATION),
"got %d and 0x%x (expected TRUE and a valid PRODUCT_* value)\n", res, product);
"got %ld and 0x%lx (expected TRUE and a valid PRODUCT_* value)\n", res, product);
else
ok(!res && !product && (GetLastError() == 0xdeadbeef),
"got %d and 0x%x with 0x%x (expected FALSE and PRODUCT_UNDEFINED with LastError untouched)\n",
"got %ld and 0x%lx with 0x%lx (expected FALSE and PRODUCT_UNDEFINED with LastError untouched)\n",
res, product, GetLastError());
entry+= 4;
@ -106,7 +107,7 @@ static void test_GetProductInfo(void)
SetLastError(0xdeadbeef);
res = pGetProductInfo(6, 1, 0, 0, NULL);
ok( (!res) && (GetLastError() == 0xdeadbeef),
"got %d with 0x%x (expected FALSE with LastError untouched\n", res, GetLastError());
"got %ld with 0x%lx (expected FALSE with LastError untouched\n", res, GetLastError());
}
static void test_GetVersionEx(void)
@ -127,7 +128,7 @@ static void test_GetVersionEx(void)
ok(!ret, "Expected GetVersionExA to fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == 0xdeadbeef /* Win9x */,
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %ld\n",
GetLastError());
SetLastError(0xdeadbeef);
@ -136,7 +137,7 @@ static void test_GetVersionEx(void)
ok(!ret, "Expected GetVersionExA to fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == 0xdeadbeef /* Win9x */,
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %ld\n",
GetLastError());
SetLastError(0xdeadbeef);
@ -145,7 +146,7 @@ static void test_GetVersionEx(void)
ok(!ret, "Expected GetVersionExA to fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == 0xdeadbeef /* Win9x */,
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
"Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %ld\n",
GetLastError());
SetLastError(0xdeadbeef);
@ -153,7 +154,7 @@ static void test_GetVersionEx(void)
ret = GetVersionExA(&infoA);
ok(ret, "Expected GetVersionExA to succeed\n");
ok(GetLastError() == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", GetLastError());
"Expected 0xdeadbeef, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
infoExA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@ -665,7 +666,7 @@ static void test_VerifyVersionInfo(void)
ret = VerifyVersionInfoA(&info, test->verifymask, mask);
ok(test->err ? !ret : ret, "%u: unexpected return value %d.\n", i, ret);
if (!ret)
ok(GetLastError() == test->err, "%u: unexpected error code %d, expected %d.\n", i, GetLastError(), test->err);
ok(GetLastError() == test->err, "%u: unexpected error code %ld, expected %ld.\n", i, GetLastError(), test->err);
}
/* test handling of version numbers */
@ -676,21 +677,21 @@ static void test_VerifyVersionInfo(void)
ret = VerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
info.dwMinorVersion = 0;
info.wServicePackMajor = 10;
ret = VerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
info.wServicePackMajor = 0;
info.wServicePackMinor = 10;
ret = VerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
VerSetConditionMask(VerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
/* test bad dwOSVersionInfoSize */
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
@ -698,7 +699,7 @@ static void test_VerifyVersionInfo(void)
info.dwOSVersionInfoSize = 0;
ret = VerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
}
static void test_GetSystemFirmwareTable(void)
@ -733,11 +734,11 @@ static void test_GetSystemFirmwareTable(void)
expected_len -= min_sfti_len;
len = pGetSystemFirmwareTable(RSMB, 0, NULL, 0);
ok(len == expected_len, "Expected length %u, got %u\n", expected_len, len);
ok(len == expected_len, "Expected length %lu, got %u\n", expected_len, len);
smbios_table = HeapAlloc(GetProcessHeap(), 0, expected_len);
len = pGetSystemFirmwareTable(RSMB, 0, smbios_table, expected_len);
ok(len == expected_len, "Expected length %u, got %u\n", expected_len, len);
ok(len == expected_len, "Expected length %lu, got %u\n", expected_len, len);
ok(len == 0 || !memcmp(smbios_table, sfti->TableBuffer, 6),
"Expected prologue %02x %02x %02x %02x %02x %02x, got %02x %02x %02x %02x %02x %02x\n",
sfti->TableBuffer[0], sfti->TableBuffer[1], sfti->TableBuffer[2],
@ -826,7 +827,7 @@ static void test_PackageIdFromFullName(void)
expected_size = get_package_id_size(&test_package_id);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(fullname, 0, &size, id_buffer);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %lu.\n", ret);
ok(size == expected_size, "Got unexpected length %u, expected %u.\n", size, expected_size);
ok(!lstrcmpW(id->name, test_package_id.name), "Got unexpected name %s.\n", debugstr_w(id->name));
ok(!lstrcmpW(id->resourceId, test_package_id.resourceId), "Got unexpected resourceId %s.\n",
@ -845,31 +846,31 @@ static void test_PackageIdFromFullName(void)
"Got unexpected publisherId %p, buffer %p.\n", id->resourceId, id_buffer);
ret = pPackageIdFromFullName(fullname, 0, NULL, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(NULL, 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret);
ok(size == sizeof(id_buffer), "Got unexpected size %u.\n", size);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(fullname, 0, &size, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret);
ok(size == sizeof(id_buffer), "Got unexpected size %u.\n", size);
size = expected_size - 1;
ret = pPackageIdFromFullName(fullname, 0, &size, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %ld.\n", ret);
ok(size == expected_size - 1, "Got unexpected size %u.\n", size);
size = expected_size - 1;
ret = pPackageIdFromFullName(fullname, 0, &size, id_buffer);
ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %ld.\n", ret);
ok(size == expected_size, "Got unexpected size %u.\n", size);
size = 0;
ret = pPackageIdFromFullName(fullname, 0, &size, NULL);
ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %d.\n", ret);
ok(ret == ERROR_INSUFFICIENT_BUFFER, "Got unexpected ret %ld.\n", ret);
ok(size == expected_size, "Got unexpected size %u.\n", size);
for (i = 0; i < ARRAY_SIZE(arch_data); ++i)
@ -880,7 +881,7 @@ static void test_PackageIdFromFullName(void)
size = expected_size;
ret = pPackageIdFromFullName(fullname, 0, &size, id_buffer);
ok(ret == ERROR_SUCCESS || broken(arch_data[i].broken && ret == ERROR_INVALID_PARAMETER),
"Got unexpected ret %u.\n", ret);
"Got unexpected ret %lu.\n", ret);
if (ret != ERROR_SUCCESS)
continue;
ok(size == expected_size, "Got unexpected length %u, expected %u.\n", size, expected_size);
@ -890,32 +891,32 @@ static void test_PackageIdFromFullName(void)
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_TestResourceId_0abcdefghjkme", 0, &size, id_buffer);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %lu.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_TestResourceId_abcdefghjkme", 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_TestResourceId_0abcdefghjkmee", 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3_X86_TestResourceId_0abcdefghjkme", 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_TestResourceId_0abcdefghjkme_", 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret);
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86__0abcdefghjkme", 0, &size, id_buffer);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_SUCCESS, "Got unexpected ret %lu.\n", ret);
ok(!lstrcmpW(id->resourceId, L""), "Got unexpected resourceId %s.\n", debugstr_w(id->resourceId));
size = sizeof(id_buffer);
ret = pPackageIdFromFullName(L"TestPackage_1.2.3.4_X86_0abcdefghjkme", 0, &size, id_buffer);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %u.\n", ret);
ok(ret == ERROR_INVALID_PARAMETER, "Got unexpected ret %lu.\n", ret);
}
#define TEST_VERSION_WIN7 1
@ -951,12 +952,12 @@ static void test_pe_os_version_child(unsigned int test)
info.dwOSVersionInfoSize = sizeof(info);
ret = GetVersionExA((OSVERSIONINFOA *)&info);
ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
ok(info.dwMajorVersion == test_pe_os_version_tests[test].expected_major,
"Test %u, expected major version %u, got %u.\n", test, test_pe_os_version_tests[test].expected_major,
"Test %u, expected major version %u, got %lu.\n", test, test_pe_os_version_tests[test].expected_major,
info.dwMajorVersion);
ok(info.dwMinorVersion == test_pe_os_version_tests[test].expected_minor,
"Test %u, expected minor version %u, got %u.\n", test, test_pe_os_version_tests[test].expected_minor,
"Test %u, expected minor version %u, got %lu.\n", test, test_pe_os_version_tests[test].expected_minor,
info.dwMinorVersion);
}
@ -1003,12 +1004,12 @@ static void test_pe_os_version(void)
ok(!pRtlGetVersion(&rtlinfo), "RtlGetVersion failed.\n");
if (rtlinfo.dwMajorVersion < 10)
{
skip("Too old Windows version %u.%u, skipping tests.\n", rtlinfo.dwMajorVersion, rtlinfo.dwMinorVersion);
skip("Too old Windows version %lu.%lu, skipping tests.\n", rtlinfo.dwMajorVersion, rtlinfo.dwMinorVersion);
return;
}
file = CreateFileA(argv[0], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %u.\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %lu.\n", GetLastError());
SetFilePointer(file, 0x3c, NULL, FILE_BEGIN);
ReadFile(file, &hdr_offset, sizeof(hdr_offset), &size, NULL);
CloseHandle(file);
@ -1024,10 +1025,10 @@ static void test_pe_os_version(void)
{
sprintf(tmp_exe_name, "tmp%u.exe", i);
ret = CopyFileA(argv[0], tmp_exe_name, FALSE);
ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
file = CreateFileA(tmp_exe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %u.\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %lu.\n", GetLastError());
SetFilePointer(file, offset_major, NULL, FILE_BEGIN);
WriteFile(file, &test_pe_os_version_tests[i].pe_version_major,
@ -1040,7 +1041,7 @@ static void test_pe_os_version(void)
sprintf(str, "%s.manifest", tmp_exe_name);
file = CreateFileA(str, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %u.\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed, GetLastError() %lu.\n", GetLastError());
WriteFile(file, manifest_header, strlen(manifest_header), &size, NULL);
for (j = 0; j < ARRAY_SIZE(version_guids); ++j)
@ -1058,13 +1059,13 @@ static void test_pe_os_version(void)
sprintf(str, "%s version pe_os_version %u", tmp_exe_name, i);
ret = CreateProcessA(NULL, str, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
CloseHandle(pi.hThread);
result = WaitForSingleObject(pi.hProcess, 10000);
ok(result == WAIT_OBJECT_0, "Got unexpected result %#x.\n", result);
ok(result == WAIT_OBJECT_0, "Got unexpected result %#lx.\n", result);
ret = GetExitCodeProcess(pi.hProcess, &code);
ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
ok(!code, "Test %u failed.\n", i);
CloseHandle(pi.hProcess);