Commit 8218440c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

kernel32/tests: Win64 printf format warning fixes.

parent dbd2c6eb
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = kernel32.dll
IMPORTS = kernel32
EXTRADEFS = -DWINE_NO_LONG_AS_INT
CTESTS = \
alloc.c \
......
......@@ -188,7 +188,7 @@ static void test_Global(void)
/* Check that a 'zeroing' alloc works */
mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk);
ok(mem2!=NULL,"GlobalAlloc failed: error=%ld\n",GetLastError());
ok(mem2!=NULL,"GlobalAlloc failed: error=%d\n",GetLastError());
if(mem2) {
ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n");
mem2ptr=GlobalLock(mem2);
......@@ -272,18 +272,18 @@ static void test_Local(void)
/* Check that a normal alloc works */
mem1=LocalAlloc(0,memchunk);
ok(mem1!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
ok(mem1!=NULL,"LocalAlloc failed: error=%d\n",GetLastError());
if(mem1) {
ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block\n");
}
/* Check that a 'zeroing' and lock alloc works */
mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk);
ok(mem2!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
ok(mem2!=NULL,"LocalAlloc failed: error=%d\n",GetLastError());
if(mem2) {
ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n");
mem2ptr=LocalLock(mem2);
ok(mem2ptr!=NULL,"LocalLock: error=%ld\n",GetLastError());
ok(mem2ptr!=NULL,"LocalLock: error=%d\n",GetLastError());
if(mem2ptr) {
error=0;
for(i=0;i<memchunk;i++) {
......@@ -295,7 +295,7 @@ static void test_Local(void)
SetLastError(0);
error=LocalUnlock(mem2);
ok(error==0 && GetLastError()==NO_ERROR,
"LocalUnlock Failed: rc=%d err=%ld\n",error,GetLastError());
"LocalUnlock Failed: rc=%d err=%d\n",error,GetLastError());
}
}
mem2a=LocalFree(mem2);
......@@ -303,11 +303,11 @@ static void test_Local(void)
/* Reallocate mem2 as moveable memory */
mem2=LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,memchunk);
ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%ld\n",GetLastError());
ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%d\n",GetLastError());
/* Check that ReAllocing memory works as expected */
mem2a=LocalReAlloc(mem2,2*memchunk,LMEM_MOVEABLE | LMEM_ZEROINIT);
ok(mem2a!=NULL,"LocalReAlloc failed, error=%ld\n",GetLastError());
ok(mem2a!=NULL,"LocalReAlloc failed, error=%d\n",GetLastError());
if(mem2a) {
ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed\n");
mem2ptr=LocalLock(mem2a);
......
......@@ -211,12 +211,12 @@ static void test_get_atom_name(void)
{
ok(GetLastError() == (i ? ERROR_MORE_DATA : ERROR_INVALID_PARAMETER) ||
GetLastError() == 0xdeadbeef, /* the Win 9x way */
"wrong error conditions %lu for %u\n", GetLastError(), i);
"wrong error conditions %u for %u\n", GetLastError(), i);
}
else /* the Win 9x way */
{
ok(GetLastError() == 0xdeadbeef,
"wrong error conditions %lu for %u\n", GetLastError(), i);
"wrong error conditions %u for %u\n", GetLastError(), i);
}
}
......@@ -251,11 +251,11 @@ static void test_get_atom_name(void)
len = GlobalGetAtomNameA(atom, out, 10);
if (!len) /* the NT way */
{
ok(GetLastError() == ERROR_MORE_DATA, "wrong error code (%lu instead of %u)\n", GetLastError(), ERROR_MORE_DATA);
ok(GetLastError() == ERROR_MORE_DATA, "wrong error code (%u instead of %u)\n", GetLastError(), ERROR_MORE_DATA);
}
else /* the Win9x way */
{
ok(GetLastError() == 0xdeadbeef, "wrong error code (%lu instead of %u)\n", GetLastError(), 0xdeadbeef);
ok(GetLastError() == 0xdeadbeef, "wrong error code (%u instead of %u)\n", GetLastError(), 0xdeadbeef);
}
for (i = 0; i < 9; i++)
{
......@@ -292,7 +292,7 @@ static void test_get_atom_name(void)
{
/* len == 0 with ERROR_MORE_DATA is on NT3.51 */
ok(len == 1 || (len == 0 && GetLastError() == ERROR_MORE_DATA),
"0x%04x: got %u with %ld (excepted '1' or '0' with " \
"0x%04x: got %u with %d (excepted '1' or '0' with " \
"ERROR_MORE_DATA)\n", i, len, GetLastError());
ok(outW[1] == DOUBLE('.'), "buffer overwrite\n");
}
......@@ -499,12 +499,12 @@ static void test_local_get_atom_name(void)
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
GetLastError() == ERROR_MORE_DATA ||
GetLastError() == 0xdeadbeef, /* the Win 9x way */
"wrong error conditions %lu for %u\n", GetLastError(), i);
"wrong error conditions %u for %u\n", GetLastError(), i);
else
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_MORE_DATA ||
GetLastError() == 0xdeadbeef, /* the Win 9x way */
"wrong error conditions %lu for %u\n", GetLastError(), i);
"wrong error conditions %u for %u\n", GetLastError(), i);
}
/* test string limits & overflow */
do_initA(in, "abcdefghij", 255);
......@@ -534,7 +534,7 @@ static void test_local_get_atom_name(void)
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_MORE_DATA ||
GetLastError() == 0xdeadbeef, /* the Win 9x way */
"wrong error code (%lu)\n", GetLastError());
"wrong error code (%u)\n", GetLastError());
if (unicode_OS)
{
......@@ -561,7 +561,7 @@ static void test_local_get_atom_name(void)
/* ERROR_MORE_DATA is on nt3.51 sp5 */
ok(GetLastError() == ERROR_MORE_DATA ||
GetLastError() == (i ? ERROR_INSUFFICIENT_BUFFER : ERROR_INVALID_PARAMETER),
"wrong error conditions %lu for %u\n", GetLastError(), i);
"wrong error conditions %u for %u\n", GetLastError(), i);
}
do_initW(inW, "abcdefghij", 255);
atom = AddAtomW(inW);
......@@ -589,7 +589,7 @@ static void test_local_get_atom_name(void)
/* ERROR_MORE_DATA is on nt3.51 sp5 */
ok(GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_MORE_DATA,
"wrong error code (%lu)\n", GetLastError());
"wrong error code (%u)\n", GetLastError());
}
}
......
......@@ -36,7 +36,7 @@ static void test_destination_buffer(void)
SetLastError(0xdeadbeef);
needed = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, 0, NULL, NULL);
ok( (needed > 0), "returned %d with 0x%lx/%ld (expected '> 0')\n",
ok( (needed > 0), "returned %d with 0x%x/%d (expected '> 0')\n",
needed, GetLastError(), GetLastError());
maxsize = needed*2;
......@@ -48,14 +48,14 @@ static void test_destination_buffer(void)
buffer[maxsize] = '\0';
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed+1, NULL, NULL);
ok( (len > 0), "returned %d with 0x%lx/%ld and '%s' (expected '> 0')\n",
ok( (len > 0), "returned %d with 0x%x/%d and '%s' (expected '> 0')\n",
len, GetLastError(), GetLastError(), buffer);
memset(buffer, 'x', maxsize);
buffer[maxsize] = '\0';
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed, NULL, NULL);
ok( (len > 0), "returned %d with 0x%lx/%ld and '%s' (expected '> 0')\n",
ok( (len > 0), "returned %d with 0x%x/%d and '%s' (expected '> 0')\n",
len, GetLastError(), GetLastError(), buffer);
memset(buffer, 'x', maxsize);
......@@ -63,7 +63,7 @@ static void test_destination_buffer(void)
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, needed-1, NULL, NULL);
ok( !len && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
"returned %d with 0x%lx/%ld and '%s' (expected '0' with " \
"returned %d with 0x%x/%d and '%s' (expected '0' with " \
"ERROR_INSUFFICIENT_BUFFER)\n", len, GetLastError(), GetLastError(), buffer);
memset(buffer, 'x', maxsize);
......@@ -71,18 +71,18 @@ static void test_destination_buffer(void)
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, 1, NULL, NULL);
ok( !len && (GetLastError() == ERROR_INSUFFICIENT_BUFFER),
"returned %d with 0x%lx/%ld and '%s' (expected '0' with " \
"returned %d with 0x%x/%d and '%s' (expected '0' with " \
"ERROR_INSUFFICIENT_BUFFER)\n", len, GetLastError(), GetLastError(), buffer);
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, buffer, 0, NULL, NULL);
ok( (len > 0), "returned %d with 0x%lx/%ld (expected '> 0')\n",
ok( (len > 0), "returned %d with 0x%x/%d (expected '> 0')\n",
len, GetLastError(), GetLastError());
SetLastError(0xdeadbeef);
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -1, NULL, needed, NULL, NULL);
ok( !len && (GetLastError() == ERROR_INVALID_PARAMETER),
"returned %d with 0x%lx/%ld (expected '0' with " \
"returned %d with 0x%x/%d (expected '0' with " \
"ERROR_INVALID_PARAMETER)\n", len, GetLastError(), GetLastError());
HeapFree(GetProcessHeap(), 0, buffer);
......@@ -99,7 +99,7 @@ static void test_null_source(void)
len = WideCharToMultiByte(CP_ACP, 0, NULL, 0, NULL, 0, NULL, NULL);
GLE = GetLastError();
ok(!len && GLE == ERROR_INVALID_PARAMETER,
"WideCharToMultiByte returned %d with GLE=%ld (expected 0 with ERROR_INVALID_PARAMETER)\n",
"WideCharToMultiByte returned %d with GLE=%d (expected 0 with ERROR_INVALID_PARAMETER)\n",
len, GLE);
}
......@@ -124,13 +124,13 @@ static void test_negative_source_length(void)
memset(buf,'x',sizeof(buf));
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL);
ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef,
"WideCharToMultiByte(-2002): len=%d error=%ld\n",len,GetLastError());
"WideCharToMultiByte(-2002): len=%d error=%d\n",len,GetLastError());
SetLastError( 0xdeadbeef );
memset(bufW,'x',sizeof(bufW));
len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10);
ok(len == 7 && !mylstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
"MultiByteToWideChar(-2002): len=%d error=%ld\n",len,GetLastError());
"MultiByteToWideChar(-2002): len=%d error=%d\n",len,GetLastError());
}
static void test_overlapped_buffers(void)
......
......@@ -74,7 +74,7 @@ static void testCursor(HANDLE hCon, COORD sbSize)
c.X = c.Y = 0;
ok(SetConsoleCursorPosition(0, c) == 0, "No handle\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu\n",
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %u\n",
ERROR_INVALID_HANDLE, GetLastError());
c.X = c.Y = 0;
......@@ -89,25 +89,25 @@ static void testCursor(HANDLE hCon, COORD sbSize)
c.X = sbSize.X;
c.Y = sbSize.Y - 1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %u\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = sbSize.X - 1;
c.Y = sbSize.Y;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %u\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = -1;
c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %u\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = 0;
c.Y = -1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %u\n",
ERROR_INVALID_PARAMETER, GetLastError());
}
......@@ -150,7 +150,7 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ret = WriteConsole(hCon, mytest, mylen, &len, NULL);
ok(ret != 0 && len == mylen, "Couldn't write, ret = %d, len = %ld\n", ret, len);
ok(ret != 0 && len == mylen, "Couldn't write, ret = %d, len = %d\n", ret, len);
c.Y = 0;
for (p = mylen - 3; p < mylen; p++)
{
......@@ -524,7 +524,7 @@ static BOOL WINAPI mch(DWORD event)
static void testCtrlHandler(void)
{
ok(!SetConsoleCtrlHandler(mch, FALSE), "Shouldn't succeed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Bad error %lu\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Bad error %u\n", GetLastError());
ok(SetConsoleCtrlHandler(mch, TRUE), "Couldn't set handler\n");
/* wine requires the event for the test, as we cannot insure, so far, that event
* are processed synchronously in GenerateConsoleCtrlEvent()
......@@ -549,7 +549,7 @@ static void testCtrlHandler(void)
CloseHandle(mch_event);
ok(SetConsoleCtrlHandler(mch, FALSE), "Couldn't remove handler\n");
ok(!SetConsoleCtrlHandler(mch, FALSE), "Shouldn't succeed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Bad error %lu\n", GetLastError());
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Bad error %u\n", GetLastError());
}
START_TEST(console)
......
......@@ -34,7 +34,7 @@ static void test_GetDriveTypeA(void)
UINT type;
logical_drives = GetLogicalDrives();
ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError());
ok(logical_drives != 0, "GetLogicalDrives error %d\n", GetLastError());
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
{
......@@ -57,7 +57,7 @@ static void test_GetDriveTypeW(void)
UINT type;
logical_drives = GetLogicalDrives();
ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError());
ok(logical_drives != 0, "GetLogicalDrives error %d\n", GetLastError());
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
{
......@@ -86,21 +86,21 @@ static void test_GetDiskFreeSpaceA(void)
DWORD logical_drives;
ret = GetDiskFreeSpaceA(NULL, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceA error %d\n", GetLastError());
ret = GetDiskFreeSpaceA("", &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND || GetLastError() == ERROR_INVALID_NAME),
"GetDiskFreeSpaceA(\"\"): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceA(\"\"): ret=%d GetLastError=%d\n",
ret, GetLastError());
ret = GetDiskFreeSpaceA("\\", &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceA error %d\n", GetLastError());
ret = GetDiskFreeSpaceA("/", &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(ret, "GetDiskFreeSpaceA error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceA error %d\n", GetLastError());
logical_drives = GetLogicalDrives();
ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError());
ok(logical_drives != 0, "GetLogicalDrives error %d\n", GetLastError());
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
{
......@@ -113,18 +113,18 @@ static void test_GetDiskFreeSpaceA(void)
ret = GetDiskFreeSpaceA(drive, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
if (!(logical_drives & 1))
ok(!ret && (GetLastError() == ERROR_PATH_NOT_FOUND || GetLastError() == ERROR_INVALID_DRIVE),
"GetDiskFreeSpaceA(%s): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceA(%s): ret=%d GetLastError=%d\n",
drive, ret, GetLastError());
else
{
ok(ret ||
(!ret && (GetLastError() == ERROR_NOT_READY || GetLastError() == ERROR_INVALID_DRIVE)),
"GetDiskFreeSpaceA(%s): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceA(%s): ret=%d GetLastError=%d\n",
drive, ret, GetLastError());
if( GetVersion() & 0x80000000)
/* win3.0 thru winME */
ok( total_clusters <= 65535,
"total clusters is %ld > 65535\n", total_clusters);
"total clusters is %d > 65535\n", total_clusters);
else if (pGetDiskFreeSpaceExA) {
/* NT, 2k, XP : GetDiskFreeSpace shoud be accurate */
ULARGE_INTEGER totEx, tot, d;
......@@ -133,7 +133,7 @@ static void test_GetDiskFreeSpaceA(void)
tot.QuadPart = (tot.QuadPart * bytes_per_sector) * total_clusters;
ret = pGetDiskFreeSpaceExA( drive, &d, &totEx, NULL);
ok( ret || (!ret && ERROR_NOT_READY == GetLastError()),
"GetDiskFreeSpaceExA( %s ) failed. GetLastError=%ld\n", drive, GetLastError());
"GetDiskFreeSpaceExA( %s ) failed. GetLastError=%d\n", drive, GetLastError());
ok( bytes_per_sector == 0 || /* empty cd rom drive */
totEx.QuadPart <= tot.QuadPart,
"GetDiskFreeSpaceA should report at least as much bytes on disk %s as GetDiskFreeSpaceExA\n", drive);
......@@ -160,21 +160,21 @@ static void test_GetDiskFreeSpaceW(void)
/* Must be Win9x which doesn't support the Unicode functions */
return;
}
ok(ret, "GetDiskFreeSpaceW error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceW error %d\n", GetLastError());
ret = GetDiskFreeSpaceW(empty_pathW, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"GetDiskFreeSpaceW(\"\"): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceW(\"\"): ret=%d GetLastError=%d\n",
ret, GetLastError());
ret = GetDiskFreeSpaceW(root_pathW, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(ret, "GetDiskFreeSpaceW(\"\") error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceW(\"\") error %d\n", GetLastError());
ret = GetDiskFreeSpaceW(unix_style_root_pathW, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
ok(ret, "GetDiskFreeSpaceW error %ld\n", GetLastError());
ok(ret, "GetDiskFreeSpaceW error %d\n", GetLastError());
logical_drives = GetLogicalDrives();
ok(logical_drives != 0, "GetLogicalDrives error %ld\n", GetLastError());
ok(logical_drives != 0, "GetLogicalDrives error %d\n", GetLastError());
for (drive[0] = 'A'; drive[0] <= 'Z'; drive[0]++)
{
......@@ -185,11 +185,11 @@ static void test_GetDiskFreeSpaceW(void)
ret = GetDiskFreeSpaceW(drive, &sectors_per_cluster, &bytes_per_sector, &free_clusters, &total_clusters);
if (!(logical_drives & 1))
ok(!ret && GetLastError() == ERROR_PATH_NOT_FOUND,
"GetDiskFreeSpaceW(%c): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceW(%c): ret=%d GetLastError=%d\n",
drive[0], ret, GetLastError());
else
ok(ret || GetLastError() == ERROR_NOT_READY,
"GetDiskFreeSpaceW(%c): ret=%d GetLastError=%ld\n",
"GetDiskFreeSpaceW(%c): ret=%d GetLastError=%d\n",
drive[0], ret, GetLastError());
}
logical_drives >>= 1;
......
......@@ -48,176 +48,176 @@ static void test_message_from_string(void)
r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0,
0, out, sizeof(out)/sizeof(CHAR),NULL);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* using the format feature */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* no format */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* two pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%2", 0,
0, out, sizeof(out)/sizeof(CHAR), "te","st");
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* three pieces */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1%3%2%1", 0,
0, out, sizeof(out)/sizeof(CHAR), "t","s","e");
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* s doesn't seem to work in format strings */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%!s!", 0,
0, out, sizeof(out)/sizeof(CHAR), "test");
ok(!strcmp("!s!", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
ok(r==3,"failed: r=%d\n",r);
/* S is unicode */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!S!", 0,
0, out, sizeof(out)/sizeof(CHAR), szwTest);
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* as characters */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!c!%2!c!%3!c!%1!c!", 0,
0, out, sizeof(out)/sizeof(CHAR), 't','e','s');
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* some numbers */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!d!%2!d!%3!d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1,2,3);
ok(!strcmp("123", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
ok(r==3,"failed: r=%d\n",r);
/* a single digit with some spacing */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp(" 1", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* a single digit, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 1);
ok(!strcmp("1 ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* two digit decimal number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" 11", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* a hex number */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4x!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" b", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* a hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp(" B", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* a hex number, upper case, left justified */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!-4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 11);
ok(!strcmp("B ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* a long hex number, upper case */
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4X!", 0,
0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" 1AB", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* two percent... */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %%%% ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" %% ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* periods are special cases */
r = doit(FORMAT_MESSAGE_FROM_STRING, " %.%. %1!d!", 0,
0, out, sizeof(out)/sizeof(CHAR), 0x1ab);
ok(!strcmp(" .. 427", out),"failed out=[%s]\n",out);
ok(r==7,"failed: r=%ld\n",r);
ok(r==7,"failed: r=%d\n",r);
/* %0 ends the line */
r = doit(FORMAT_MESSAGE_FROM_STRING, "test%0test", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("test", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* %! prints an exclaimation */
r = doit(FORMAT_MESSAGE_FROM_STRING, "yah%!%0 ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("yah!", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* %space */
r = doit(FORMAT_MESSAGE_FROM_STRING, "% % ", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n", out),"failed out=[%s]\n",out);
ok(r==2,"failed: r=%ld\n",r);
ok(r==2,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING, "\r\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("\r\n\r\n", out),"failed out=[%s]\n",out);
ok(r==4,"failed: r=%ld\n",r);
ok(r==4,"failed: r=%d\n",r);
/* change of pace... test the low byte of dwflags */
/* line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out) || !strcmp("hi\r\n", out),"failed out=[%s]\n",out);
ok(r==3 || r==4,"failed: r=%ld\n",r);
ok(r==3 || r==4,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "hi\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp("hi ", out),"failed out=[%s]\n",out);
ok(r==3,"failed: r=%ld\n",r);
ok(r==3,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==1,"failed: r=%ld\n",r);
ok(r==1,"failed: r=%d\n",r);
/* carriage return line feed */
r = doit(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_MAX_WIDTH_MASK, "\r\r\n", 0,
0, out, sizeof(out)/sizeof(CHAR));
ok(!strcmp(" ", out),"failed out=[%s]\n",out);
ok(r==2,"failed: r=%ld\n",r);
ok(r==2,"failed: r=%d\n",r);
}
START_TEST(format_msg)
......
......@@ -87,39 +87,39 @@ START_TEST(heap)
SetLastError(MAGIC_DEAD);
mem = GlobalLock(gbl); /* #1 */
ok(mem != NULL, "returned %p with %ld (expected '!= NULL')\n", mem, GetLastError());
ok(mem != NULL, "returned %p with %d (expected '!= NULL')\n", mem, GetLastError());
SetLastError(MAGIC_DEAD);
flags = GlobalFlags(gbl);
ok( flags == 1, "returned 0x%04x with %ld (expected '0x0001')\n",
ok( flags == 1, "returned 0x%04x with %d (expected '0x0001')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
msecond = GlobalLock(gbl); /* #2 */
ok( msecond == mem, "returned %p with %ld (expected '%p')\n",
ok( msecond == mem, "returned %p with %d (expected '%p')\n",
msecond, GetLastError(), mem);
SetLastError(MAGIC_DEAD);
flags = GlobalFlags(gbl);
ok( flags == 2, "returned 0x%04x with %ld (expected '0x0002')\n",
ok( flags == 2, "returned 0x%04x with %d (expected '0x0002')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
SetLastError(MAGIC_DEAD);
res = GlobalUnlock(gbl); /* #1 */
ok(res, "returned %ld with %ld (expected '!= 0')\n", res, GetLastError());
ok(res, "returned %d with %d (expected '!= 0')\n", res, GetLastError());
SetLastError(MAGIC_DEAD);
flags = GlobalFlags(gbl);
ok( flags , "returned 0x%04x with %ld (expected '!= 0')\n",
ok( flags , "returned 0x%04x with %d (expected '!= 0')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
res = GlobalUnlock(gbl); /* #0 */
/* NT: ERROR_SUCCESS (documented on MSDN), 9x: untouched */
ok(!res && ((GetLastError() == ERROR_SUCCESS) || (GetLastError() == MAGIC_DEAD)),
"returned %ld with %ld (expected '0' with: ERROR_SUCCESS or " \
"returned %d with %d (expected '0' with: ERROR_SUCCESS or " \
"MAGIC_DEAD)\n", res, GetLastError());
SetLastError(MAGIC_DEAD);
flags = GlobalFlags(gbl);
ok( !flags , "returned 0x%04x with %ld (expected '0')\n",
ok( !flags , "returned 0x%04x with %d (expected '0')\n",
flags, GetLastError());
/* Unlock an already unlocked Handle */
......@@ -128,7 +128,7 @@ START_TEST(heap)
/* NT: ERROR_NOT_LOCKED, 9x: untouched */
ok( !res &&
((GetLastError() == ERROR_NOT_LOCKED) || (GetLastError() == MAGIC_DEAD)),
"returned %ld with %ld (expected '0' with: ERROR_NOT_LOCKED or " \
"returned %d with %d (expected '0' with: ERROR_NOT_LOCKED or " \
"MAGIC_DEAD)\n", res, GetLastError());
GlobalFree(gbl);
......@@ -136,23 +136,23 @@ START_TEST(heap)
SetLastError(MAGIC_DEAD);
hsecond = GlobalFree(gbl); /* invalid handle: free memory twice */
ok( (hsecond == gbl) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %p with 0x%08lx (expected %p with ERROR_INVALID_HANDLE)\n",
"returned %p with 0x%08x (expected %p with ERROR_INVALID_HANDLE)\n",
hsecond, GetLastError(), gbl);
SetLastError(MAGIC_DEAD);
flags = GlobalFlags(gbl);
ok( (flags == GMEM_INVALID_HANDLE) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned 0x%04x with 0x%08lx (expected GMEM_INVALID_HANDLE with " \
"returned 0x%04x with 0x%08x (expected GMEM_INVALID_HANDLE with " \
"ERROR_INVALID_HANDLE)\n", flags, GetLastError());
SetLastError(MAGIC_DEAD);
size = GlobalSize(gbl);
ok( (size == 0) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %ld with 0x%08lx (expected '0' with ERROR_INVALID_HANDLE)\n",
"returned %ld with 0x%08x (expected '0' with ERROR_INVALID_HANDLE)\n",
size, GetLastError());
SetLastError(MAGIC_DEAD);
mem = GlobalLock(gbl);
ok( (mem == NULL) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %p with 0x%08lx (expected NULL with ERROR_INVALID_HANDLE)\n",
"returned %p with 0x%08x (expected NULL with ERROR_INVALID_HANDLE)\n",
mem, GetLastError());
/* documented on MSDN: GlobalUnlock() return FALSE on failure.
......@@ -162,7 +162,7 @@ START_TEST(heap)
SetLastError(MAGIC_DEAD);
res = GlobalUnlock(gbl);
ok(GetLastError() == ERROR_INVALID_HANDLE,
"returned %ld with %ld (expected ERROR_INVALID_HANDLE)\n",
"returned %d with %d (expected ERROR_INVALID_HANDLE)\n",
res, GetLastError());
......@@ -192,39 +192,39 @@ START_TEST(heap)
gbl = LocalAlloc(LMEM_MOVEABLE, 256);
SetLastError(MAGIC_DEAD);
mem = LocalLock(gbl); /* #1 */
ok(mem != NULL, "returned %p with %ld (expected '!= NULL')\n", mem, GetLastError());
ok(mem != NULL, "returned %p with %d (expected '!= NULL')\n", mem, GetLastError());
SetLastError(MAGIC_DEAD);
flags = LocalFlags(gbl);
ok( flags == 1, "returned 0x%04x with %ld (expected '0x0001')\n",
ok( flags == 1, "returned 0x%04x with %d (expected '0x0001')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
msecond = LocalLock(gbl); /* #2 */
ok( msecond == mem, "returned %p with %ld (expected '%p')\n",
ok( msecond == mem, "returned %p with %d (expected '%p')\n",
msecond, GetLastError(), mem);
SetLastError(MAGIC_DEAD);
flags = LocalFlags(gbl);
ok( flags == 2, "returned 0x%04x with %ld (expected '0x0002')\n",
ok( flags == 2, "returned 0x%04x with %d (expected '0x0002')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
SetLastError(MAGIC_DEAD);
res = LocalUnlock(gbl); /* #1 */
ok(res, "returned %ld with %ld (expected '!= 0')\n", res, GetLastError());
ok(res, "returned %d with %d (expected '!= 0')\n", res, GetLastError());
SetLastError(MAGIC_DEAD);
flags = LocalFlags(gbl);
ok( flags , "returned 0x%04x with %ld (expected '!= 0')\n",
ok( flags , "returned 0x%04x with %d (expected '!= 0')\n",
flags, GetLastError());
SetLastError(MAGIC_DEAD);
res = LocalUnlock(gbl); /* #0 */
/* NT: ERROR_SUCCESS (documented on MSDN), 9x: untouched */
ok(!res && ((GetLastError() == ERROR_SUCCESS) || (GetLastError() == MAGIC_DEAD)),
"returned %ld with %ld (expected '0' with: ERROR_SUCCESS or " \
"returned %d with %d (expected '0' with: ERROR_SUCCESS or " \
"MAGIC_DEAD)\n", res, GetLastError());
SetLastError(MAGIC_DEAD);
flags = LocalFlags(gbl);
ok( !flags , "returned 0x%04x with %ld (expected '0')\n",
ok( !flags , "returned 0x%04x with %d (expected '0')\n",
flags, GetLastError());
/* Unlock an already unlocked Handle */
......@@ -233,7 +233,7 @@ START_TEST(heap)
/* NT: ERROR_NOT_LOCKED, 9x: untouched */
ok( !res &&
((GetLastError() == ERROR_NOT_LOCKED) || (GetLastError() == MAGIC_DEAD)),
"returned %ld with %ld (expected '0' with: ERROR_NOT_LOCKED or " \
"returned %d with %d (expected '0' with: ERROR_NOT_LOCKED or " \
"MAGIC_DEAD)\n", res, GetLastError());
LocalFree(gbl);
......@@ -241,30 +241,30 @@ START_TEST(heap)
SetLastError(MAGIC_DEAD);
hsecond = LocalFree(gbl); /* invalid handle: free memory twice */
ok( (hsecond == gbl) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %p with 0x%08lx (expected %p with ERROR_INVALID_HANDLE)\n",
"returned %p with 0x%08x (expected %p with ERROR_INVALID_HANDLE)\n",
hsecond, GetLastError(), gbl);
SetLastError(MAGIC_DEAD);
flags = LocalFlags(gbl);
ok( (flags == LMEM_INVALID_HANDLE) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned 0x%04x with 0x%08lx (expected LMEM_INVALID_HANDLE with " \
"returned 0x%04x with 0x%08x (expected LMEM_INVALID_HANDLE with " \
"ERROR_INVALID_HANDLE)\n", flags, GetLastError());
SetLastError(MAGIC_DEAD);
size = LocalSize(gbl);
ok( (size == 0) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %ld with 0x%08lx (expected '0' with ERROR_INVALID_HANDLE)\n",
"returned %ld with 0x%08x (expected '0' with ERROR_INVALID_HANDLE)\n",
size, GetLastError());
SetLastError(MAGIC_DEAD);
mem = LocalLock(gbl);
ok( (mem == NULL) && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %p with 0x%08lx (expected NULL with ERROR_INVALID_HANDLE)\n",
"returned %p with 0x%08x (expected NULL with ERROR_INVALID_HANDLE)\n",
mem, GetLastError());
/* This Test works the same on all Systems (GlobalUnlock() is different) */
SetLastError(MAGIC_DEAD);
res = LocalUnlock(gbl);
ok(!res && (GetLastError() == ERROR_INVALID_HANDLE),
"returned %ld with %ld (expected '0' with ERROR_INVALID_HANDLE)\n",
"returned %d with %d (expected '0' with ERROR_INVALID_HANDLE)\n",
res, GetLastError());
/* trying to lock empty memory should give an error */
......@@ -275,7 +275,7 @@ START_TEST(heap)
/* NT: ERROR_DISCARDED, 9x: untouched */
ok( (mem == NULL) &&
((GetLastError() == ERROR_DISCARDED) || (GetLastError() == MAGIC_DEAD)),
"returned %p with 0x%lx/%ld (expected 'NULL' with: ERROR_DISCARDED or " \
"returned %p with 0x%x/%d (expected 'NULL' with: ERROR_DISCARDED or " \
"MAGIC_DEAD)\n", mem, GetLastError(), GetLastError());
GlobalFree(gbl);
......
......@@ -54,11 +54,11 @@ static void testGetModuleFileName(const char* name)
ok(len1W > 0, "Getting module filename for handle %p\n", hMod);
}
ok(len1A == strlen(bufA), "Unexpected length of GetModuleFilenameA (%ld/%d)\n", len1A, lstrlenA(bufA));
ok(len1A == strlen(bufA), "Unexpected length of GetModuleFilenameA (%d/%d)\n", len1A, lstrlenA(bufA));
if (is_unicode_enabled)
{
ok(len1W == lstrlenW(bufW), "Unexpected length of GetModuleFilenameW (%ld/%d)\n", len1W, lstrlenW(bufW));
ok(len1W == lstrlenW(bufW), "Unexpected length of GetModuleFilenameW (%d/%d)\n", len1W, lstrlenW(bufW));
ok(cmpStrAW(bufA, bufW, len1A, len1W), "Comparing GetModuleFilenameAW results\n");
}
......@@ -73,12 +73,12 @@ static void testGetModuleFileName(const char* name)
len2W = GetModuleFileNameW(hMod, bufW, len1W / 2);
ok(len2W > 0, "Getting module filename for handle %p\n", hMod);
ok(cmpStrAW(bufA, bufW, len2A, len2W), "Comparing GetModuleFilenameAW results with buffer too small\n" );
ok(len1W / 2 == len2W, "Correct length in GetModuleFilenameW with buffer too small (%ld/%ld)\n", len1W / 2, len2W);
ok(len1W / 2 == len2W, "Correct length in GetModuleFilenameW with buffer too small (%d/%d)\n", len1W / 2, len2W);
}
ok(len1A / 2 == len2A ||
len1A / 2 == len2A + 1, /* Win9x */
"Correct length in GetModuleFilenameA with buffer too small (%ld/%ld)\n", len1A / 2, len2A);
"Correct length in GetModuleFilenameA with buffer too small (%d/%d)\n", len1A / 2, len2A);
}
static void testGetModuleFileName_Wrong(void)
......@@ -109,11 +109,11 @@ static void testLoadLibraryA(void)
SetLastError(0xdeadbeef);
hModule = LoadLibraryA("kernel32.dll");
ok( hModule != NULL, "kernel32.dll should be loadable\n");
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08lx\n", GetLastError());
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08x\n", GetLastError());
fp = GetProcAddress(hModule, "CreateFileA");
ok( fp != NULL, "CreateFileA should be there\n");
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08lx\n", GetLastError());
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08x\n", GetLastError());
SetLastError(0xdeadbeef);
hModule1 = LoadLibraryA("kernel32 ");
......@@ -121,7 +121,7 @@ static void testLoadLibraryA(void)
if (GetLastError() != ERROR_DLL_NOT_FOUND)
{
ok( hModule1 != NULL, "\"kernel32 \" should be loadable\n");
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08lx\n", GetLastError());
ok( GetLastError() == 0xdeadbeef, "GetLastError should be 0xdeadbeef but is %08x\n", GetLastError());
ok( hModule == hModule1, "Loaded wrong module\n");
FreeLibrary(hModule1);
}
......@@ -137,7 +137,7 @@ static void testLoadLibraryA_Wrong(void)
hModule = LoadLibraryA("non_ex_pv.dll");
ok( !hModule, "non_ex_pv.dll should be not loadable\n");
ok( GetLastError() == ERROR_MOD_NOT_FOUND || GetLastError() == ERROR_DLL_NOT_FOUND,
"Expected ERROR_MOD_NOT_FOUND or ERROR_DLL_NOT_FOUND (win9x), got %08lx\n", GetLastError());
"Expected ERROR_MOD_NOT_FOUND or ERROR_DLL_NOT_FOUND (win9x), got %08x\n", GetLastError());
/* Just in case */
FreeLibrary(hModule);
......@@ -151,13 +151,13 @@ static void testGetProcAddress_Wrong(void)
fp = GetProcAddress(NULL, "non_ex_call");
ok( !fp, "non_ex_call should not be found\n");
ok( GetLastError() == ERROR_PROC_NOT_FOUND || GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_PROC_NOT_FOUND or ERROR_INVALID_HANDLE(win9x), got %08lx\n", GetLastError());
"Expected ERROR_PROC_NOT_FOUND or ERROR_INVALID_HANDLE(win9x), got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
fp = GetProcAddress((HMODULE)0xdeadbeef, "non_ex_call");
ok( !fp, "non_ex_call should not be found\n");
ok( GetLastError() == ERROR_MOD_NOT_FOUND || GetLastError() == ERROR_INVALID_HANDLE,
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_HANDLE(win9x), got %08lx\n", GetLastError());
"Expected ERROR_MOD_NOT_FOUND or ERROR_INVALID_HANDLE(win9x), got %08x\n", GetLastError());
}
START_TEST(module)
......
......@@ -330,13 +330,13 @@ static void doChild(const char* file, const char* option)
ok(SetConsoleCP(1252), "Setting CP\n");
ok(SetConsoleOutputCP(1252), "Setting SB CP\n");
ret = SetConsoleMode(hConIn, modeIn ^ 1);
ok( ret, "Setting mode (%ld)\n", GetLastError());
ok( ret, "Setting mode (%d)\n", GetLastError());
ret = SetConsoleMode(hConOut, modeOut ^ 1);
ok( ret, "Setting mode (%ld)\n", GetLastError());
ok( ret, "Setting mode (%d)\n", GetLastError());
sbi.dwCursorPosition.X ^= 1;
sbi.dwCursorPosition.Y ^= 1;
ret = SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition);
ok( ret, "Setting cursor position (%ld)\n", GetLastError());
ok( ret, "Setting cursor position (%d)\n", GetLastError());
}
if (option && strcmp(option, "stdhandle") == 0)
{
......@@ -825,7 +825,7 @@ static void test_Directory(void)
memset(&info, 0, sizeof(info));
ok(!CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L,
NULL, "non\\existent\\directory", &startup, &info), "CreateProcess\n");
ok(GetLastError() == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %ld\n", GetLastError());
ok(GetLastError() == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", GetLastError());
ok(!TerminateProcess(info.hProcess, 0), "Child process should not exist\n");
}
......@@ -1182,8 +1182,8 @@ static void test_Console(void)
okChildInt("Console", "InputMode", modeIn);
okChildInt("Console", "OutputMode", modeOut);
todo_wine ok(cpInC == 1252, "Wrong console CP (expected 1252 got %ld/%ld)\n", cpInC, cpIn);
todo_wine ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %ld/%ld)\n", cpOutC, cpOut);
todo_wine ok(cpInC == 1252, "Wrong console CP (expected 1252 got %d/%d)\n", cpInC, cpIn);
todo_wine ok(cpOutC == 1252, "Wrong console-SB CP (expected 1252 got %d/%d)\n", cpOutC, cpOut);
ok(modeInC == (modeIn ^ 1), "Wrong console mode\n");
ok(modeOutC == (modeOut ^ 1), "Wrong console-SB mode\n");
ok(sbiC.dwCursorPosition.X == (sbi.dwCursorPosition.X ^ 1), "Wrong cursor position\n");
......@@ -1220,7 +1220,7 @@ static void test_Console(void)
msg_len = strlen(msg) + 1;
ok(WriteFile(hParentOut, msg, msg_len, &w, NULL), "Writing to child\n");
ok(w == msg_len, "Should have written %u bytes, actually wrote %lu\n", msg_len, w);
ok(w == msg_len, "Should have written %u bytes, actually wrote %u\n", msg_len, w);
memset(buffer, 0, sizeof(buffer));
ok(ReadFile(hParentIn, buffer, sizeof(buffer), &w, NULL), "Reading from child\n");
ok(strcmp(buffer, msg) == 0, "Should have received '%s'\n", msg);
......
......@@ -134,19 +134,19 @@ static void test_mutex(void)
HANDLE hOpened;
hCreated = CreateMutex(NULL, FALSE, "WineTestMutex");
ok(hCreated != NULL, "CreateMutex failed with error %ld\n", GetLastError());
ok(hCreated != NULL, "CreateMutex failed with error %d\n", GetLastError());
wait_ret = WaitForSingleObject(hCreated, INFINITE);
ok(wait_ret == WAIT_OBJECT_0, "WaitForSingleObject failed with error 0x%08lx\n", wait_ret);
ok(wait_ret == WAIT_OBJECT_0, "WaitForSingleObject failed with error 0x%08x\n", wait_ret);
/* yes, opening with just READ_CONTROL access allows us to successfully
* call ReleaseMutex */
hOpened = OpenMutex(READ_CONTROL, FALSE, "WineTestMutex");
ok(hOpened != NULL, "OpenMutex failed with error %ld\n", GetLastError());
ok(hOpened != NULL, "OpenMutex failed with error %d\n", GetLastError());
ret = ReleaseMutex(hOpened);
todo_wine ok(ret, "ReleaseMutex failed with error %ld\n", GetLastError());
todo_wine ok(ret, "ReleaseMutex failed with error %d\n", GetLastError());
ret = ReleaseMutex(hCreated);
todo_wine ok(!ret && (GetLastError() == ERROR_NOT_OWNER),
"ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %ld\n", GetLastError());
"ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %d\n", GetLastError());
CloseHandle(hOpened);
CloseHandle(hCreated);
......
......@@ -246,16 +246,16 @@ static VOID test_CreateThread_basic(void)
thread[0] = CreateThread(NULL,0,threadFunc2,NULL,0,NULL);
GLE = GetLastError();
if (thread[0]) { /* NT */
ok(GLE==0xFACEaBAD, "CreateThread set last error to %ld, expected 4207848365\n", GLE);
ok(GLE==0xFACEaBAD, "CreateThread set last error to %d, expected 4207848365\n", GLE);
ret = WaitForSingleObject(thread[0],100);
ok(ret==WAIT_OBJECT_0, "threadFunc2 did not exit during 100 ms\n");
ret = GetExitCodeThread(thread[0],&exitCode);
ok(ret!=0, "GetExitCodeThread returned %ld (expected nonzero)\n", ret);
ok(exitCode==99, "threadFunc2 exited with code: %ld (expected 99)\n", exitCode);
ok(ret!=0, "GetExitCodeThread returned %d (expected nonzero)\n", ret);
ok(exitCode==99, "threadFunc2 exited with code: %d (expected 99)\n", exitCode);
ok(CloseHandle(thread[0])!=0,"Error closing thread handle\n");
}
else { /* 9x */
ok(GLE==ERROR_INVALID_PARAMETER, "CreateThread set last error to %ld, expected 87\n", GLE);
ok(GLE==ERROR_INVALID_PARAMETER, "CreateThread set last error to %d, expected 87\n", GLE);
}
}
......@@ -336,8 +336,8 @@ static VOID test_SuspendThread(void)
}
/* Trying to suspend a terminated thread should fail */
error=SuspendThread(thread);
ok(error==~0U, "wrong return code: %ld\n", error);
ok(GetLastError()==ERROR_ACCESS_DENIED || GetLastError()==ERROR_NO_MORE_ITEMS, "unexpected error code: %ld\n", GetLastError());
ok(error==~0U, "wrong return code: %d\n", error);
ok(GetLastError()==ERROR_ACCESS_DENIED || GetLastError()==ERROR_NO_MORE_ITEMS, "unexpected error code: %d\n", GetLastError());
ok(CloseHandle(thread)!=0,"CloseHandle Failed\n");
}
......@@ -481,19 +481,19 @@ static VOID test_thread_priority(void)
}
todo_wine {
ok(rc!=0,"error=%ld\n",GetLastError());
ok(rc!=0,"error=%d\n",GetLastError());
rc = pSetThreadPriorityBoost(curthread,1);
ok( rc != 0, "error=%ld\n",GetLastError());
ok( rc != 0, "error=%d\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==1,
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
"rc=%d error=%d disabled=%d\n",rc,GetLastError(),disabled);
rc = pSetThreadPriorityBoost(curthread,0);
ok( rc != 0, "error=%ld\n",GetLastError());
ok( rc != 0, "error=%d\n",GetLastError());
rc=pGetThreadPriorityBoost(curthread,&disabled);
ok(rc!=0 && disabled==0,
"rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled);
"rc=%d error=%d disabled=%d\n",rc,GetLastError(),disabled);
}
}
......@@ -555,7 +555,7 @@ static VOID test_GetThreadTimes(void)
static VOID test_thread_processor(void)
{
HANDLE curthread,curproc;
DWORD processMask,systemMask;
DWORD_PTR processMask,systemMask;
SYSTEM_INFO sysInfo;
int error=0;
......@@ -603,17 +603,17 @@ static VOID test_GetThreadExitCode(void)
HANDLE thread;
ret = GetExitCodeThread((HANDLE)0x2bad2bad,&exitCode);
ok(ret==0, "GetExitCodeThread returned non zero value: %ld\n", ret);
ok(ret==0, "GetExitCodeThread returned non zero value: %d\n", ret);
GLE = GetLastError();
ok(GLE==ERROR_INVALID_HANDLE, "GetLastError returned %ld (expected 6)\n", GLE);
ok(GLE==ERROR_INVALID_HANDLE, "GetLastError returned %d (expected 6)\n", GLE);
thread = CreateThread(NULL,0,threadFunc2,NULL,0,&threadid);
ret = WaitForSingleObject(thread,100);
ok(ret==WAIT_OBJECT_0, "threadFunc2 did not exit during 100 ms\n");
ret = GetExitCodeThread(thread,&exitCode);
ok(ret==exitCode || ret==1,
"GetExitCodeThread returned %ld (expected 1 or %ld)\n", ret, exitCode);
ok(exitCode==99, "threadFunc2 exited with code %ld (expected 99)\n", exitCode);
"GetExitCodeThread returned %d (expected 1 or %d)\n", ret, exitCode);
ok(exitCode==99, "threadFunc2 exited with code %d (expected 99)\n", exitCode);
ok(CloseHandle(thread)!=0,"Error closing thread handle\n");
}
......@@ -646,7 +646,7 @@ static void test_SetThreadContext(void)
SetLastError(0xdeadbeef);
event = CreateEvent( NULL, TRUE, FALSE, NULL );
thread = CreateThread( NULL, 0, threadFunc6, (void *)2, 0, &threadid );
ok( thread != NULL, "CreateThread failed : (%ld)\n", GetLastError() );
ok( thread != NULL, "CreateThread failed : (%d)\n", GetLastError() );
if (!thread)
{
trace("Thread creation failed, skipping rest of test\n");
......@@ -658,7 +658,7 @@ static void test_SetThreadContext(void)
ctx.ContextFlags = CONTEXT_FULL;
SetLastError(0xdeadbeef);
ok( GetThreadContext( thread, &ctx ), "GetThreadContext failed : (%ld)\n", GetLastError() );
ok( GetThreadContext( thread, &ctx ), "GetThreadContext failed : (%d)\n", GetLastError() );
/* simulate a call to set_test_val(10) */
stack = (int *)ctx.Esp;
......@@ -667,11 +667,11 @@ static void test_SetThreadContext(void)
ctx.Esp -= 2 * sizeof(int *);
ctx.Eip = (DWORD)set_test_val;
SetLastError(0xdeadbeef);
ok( SetThreadContext( thread, &ctx ), "SetThreadContext failed : (%ld)\n", GetLastError() );
ok( SetThreadContext( thread, &ctx ), "SetThreadContext failed : (%d)\n", GetLastError() );
SetLastError(0xdeadbeef);
prevcount = ResumeThread( thread );
ok ( prevcount == 1, "Previous suspend count (%ld) instead of 1, last error : (%ld)\n",
ok ( prevcount == 1, "Previous suspend count (%d) instead of 1, last error : (%d)\n",
prevcount, GetLastError() );
WaitForSingleObject( thread, INFINITE );
......@@ -708,14 +708,14 @@ static void test_QueueUserWorkItem(void)
for (i = 0; i < 100; i++)
{
BOOL ret = pQueueUserWorkItem(work_function, (void *)i, WT_EXECUTEDEFAULT);
ok(ret, "QueueUserWorkItem failed with error %ld\n", GetLastError());
ok(ret, "QueueUserWorkItem failed with error %d\n", GetLastError());
}
wait_result = WaitForSingleObject(finish_event, 10000);
after = GetTickCount();
trace("100 QueueUserWorkItem calls took %ldms\n", after - before);
ok(wait_result == WAIT_OBJECT_0, "wait failed with error 0x%lx\n", wait_result);
trace("100 QueueUserWorkItem calls took %dms\n", after - before);
ok(wait_result == WAIT_OBJECT_0, "wait failed with error 0x%x\n", wait_result);
ok(times_executed == 100, "didn't execute all of the work items\n");
}
......
......@@ -85,7 +85,7 @@ static void test_conversions(void)
SETUP_ATIME(st)
ok (SystemTimeToFileTime(&st,&ft), "Conversion Failed ATIME\n");
ok( (!((ft.dwHighDateTime != ATIME_HI) || (ft.dwLowDateTime!=ATIME_LOW))),
"Wrong time for ATIME: %08lx %08lx (correct %08x %08x)\n",
"Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
ft.dwLowDateTime, ft.dwHighDateTime, ATIME_LOW, ATIME_HI);
......@@ -94,7 +94,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime != MAYDAY_2002_HI) ||
(ft.dwLowDateTime!=MAYDAY_2002_LO))),
"Wrong time for 2002 %08lx %08lx (correct %08x %08x)\n", ft.dwLowDateTime,
"Wrong time for 2002 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
ft.dwHighDateTime, MAYDAY_2002_LO, MAYDAY_2002_HI);
......@@ -103,7 +103,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
(ft.dwLowDateTime!=NEWYEAR_1980_LO))) ,
"Wrong time for 1980 %08lx %08lx (correct %08x %08x)\n", ft.dwLowDateTime,
"Wrong time for 1980 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
ft.dwHighDateTime, NEWYEAR_1980_LO,NEWYEAR_1980_HI );
ok(DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft),
......@@ -111,7 +111,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
(ft.dwLowDateTime!=NEWYEAR_1980_LO))),
"Wrong time DosDateTimeToFileTime %08lx %08lx (correct %08x %08x)\n",
"Wrong time DosDateTimeToFileTime %08x %08x (correct %08x %08x)\n",
ft.dwHighDateTime, ft.dwLowDateTime, NEWYEAR_1980_HI, NEWYEAR_1980_LO);
}
......@@ -129,7 +129,7 @@ static void test_invalid_arg(void)
"DosDateTimeToFileTime() failed\n");
ok( (ft.dwHighDateTime==NEWYEAR_1980_HI) && (ft.dwLowDateTime==NEWYEAR_1980_LO),
"filetime for 1/1/80 00:00:00 was %08lx %08lx\n", ft.dwHighDateTime, ft.dwLowDateTime);
"filetime for 1/1/80 00:00:00 was %08x %08x\n", ft.dwHighDateTime, ft.dwLowDateTime);
/* now check SystemTimeToFileTime */
memset(&ft,0,sizeof ft);
......@@ -184,7 +184,7 @@ static void test_FileTimeToSystemTime(void)
ft.dwLowDateTime = 0;
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
"FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError());
"FileTimeToSystemTime() failed with Error 0x%08x\n",GetLastError());
ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) &&
(st.wMilliseconds == 0)),
......@@ -194,7 +194,7 @@ static void test_FileTimeToSystemTime(void)
ft.dwLowDateTime = (UINT)time;
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
"FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError());
"FileTimeToSystemTime() failed with Error 0x%08x\n",GetLastError());
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
(st.wMilliseconds == 0)),
......@@ -221,7 +221,7 @@ static void test_FileTimeToLocalFileTime(void)
ft.dwLowDateTime = (UINT)time;
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
"FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError());
"FileTimeToLocalFileTime() failed with Error 0x%08x\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
......@@ -235,7 +235,7 @@ static void test_FileTimeToLocalFileTime(void)
ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
"FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError());
"FileTimeToLocalFileTime() failed with Error 0x%08x\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
......
......@@ -120,7 +120,7 @@ static void test_process(DWORD curr_pid, DWORD sub_pcs_pid)
{
if (pe.th32ProcessID == curr_pid) found++;
if (pe.th32ProcessID == sub_pcs_pid) found++;
trace("PID=%lx %s\n", pe.th32ProcessID, pe.szExeFile);
trace("PID=%x %s\n", pe.th32ProcessID, pe.szExeFile);
num++;
} while (pProcess32Next( hSnapshot, &pe ));
}
......@@ -134,7 +134,7 @@ static void test_process(DWORD curr_pid, DWORD sub_pcs_pid)
{
if (pe.th32ProcessID == curr_pid) found++;
if (pe.th32ProcessID == sub_pcs_pid) found++;
trace("PID=%lx %s\n", pe.th32ProcessID, pe.szExeFile);
trace("PID=%x %s\n", pe.th32ProcessID, pe.szExeFile);
num--;
} while (pProcess32Next( hSnapshot, &pe ));
}
......@@ -172,7 +172,7 @@ static void test_thread(DWORD curr_pid, DWORD sub_pcs_pid)
{
if (te.th32OwnerProcessID == curr_pid) curr_found++;
if (te.th32OwnerProcessID == sub_pcs_pid) sub_found++;
trace("PID=%lx TID=%lx %ld\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
num++;
} while (pThread32Next( hSnapshot, &te ));
}
......@@ -188,7 +188,7 @@ static void test_thread(DWORD curr_pid, DWORD sub_pcs_pid)
{
if (te.th32OwnerProcessID == curr_pid) curr_found++;
if (te.th32OwnerProcessID == sub_pcs_pid) sub_found++;
trace("PID=%lx TID=%lx %ld\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
trace("PID=%x TID=%x %d\n", te.th32OwnerProcessID, te.th32ThreadID, te.tpBasePri);
num--;
} while (pThread32Next( hSnapshot, &te ));
}
......@@ -240,7 +240,7 @@ static void test_module(DWORD pid, const char* expected[], unsigned num_expected
{
do
{
trace("PID=%lx base=%p size=%lx %s %s\n",
trace("PID=%x base=%p size=%x %s %s\n",
me.th32ProcessID, me.modBaseAddr, me.modBaseSize, me.szExePath, me.szModule);
ok(me.th32ProcessID == pid, "wrong returned process id\n");
for (i = 0; i < num_expected; i++)
......@@ -259,7 +259,7 @@ static void test_module(DWORD pid, const char* expected[], unsigned num_expected
{
do
{
trace("PID=%lx base=%p size=%lx %s %s\n",
trace("PID=%x base=%p size=%x %s %s\n",
me.th32ProcessID, me.modBaseAddr, me.modBaseSize, me.szExePath, me.szModule);
for (i = 0; i < num_expected; i++)
if (!lstrcmpi(expected[i], me.szModule)) found[i]++;
......@@ -322,7 +322,7 @@ START_TEST(toolhelp)
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
sprintf(buffer, "%s tests/toolhelp.c %lu %lu", selfname, (DWORD)ev1, (DWORD)ev2);
sprintf(buffer, "%s tests/toolhelp.c %u %u", selfname, (DWORD)ev1, (DWORD)ev2);
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to be initialized */
w = WaitForSingleObject(ev1, WAIT_TIME);
......
......@@ -53,24 +53,24 @@ START_TEST(version)
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION,
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ret = pVerifyVersionInfoA(&info, VER_BUILDNUMBER | VER_MAJORVERSION |
VER_MINORVERSION/* | VER_PLATFORMID | VER_SERVICEPACKMAJOR |
VER_SERVICEPACKMINOR | VER_SUITENAME | VER_PRODUCT_TYPE */,
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
/* tests special handling of VER_SUITENAME */
ret = pVerifyVersionInfoA(&info, VER_SUITENAME,
pVerSetConditionMask(0, VER_SUITENAME, VER_AND));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
ret = pVerifyVersionInfoA(&info, VER_SUITENAME,
pVerSetConditionMask(0, VER_SUITENAME, VER_OR));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
/* test handling of version numbers */
......@@ -81,59 +81,59 @@ START_TEST(version)
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.dwMinorVersion = 0;
info.wServicePackMajor = 10;
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
info.wServicePackMajor = 0;
info.wServicePackMinor = 10;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL),
VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMinor++;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMajor--;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMajor--;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMajor++;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_LESS));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMajor++;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_LESS_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.wServicePackMajor--;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
/* test the failure hierarchy for the four version fields */
......@@ -142,25 +142,25 @@ START_TEST(version)
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.dwMinorVersion++;
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
info.dwMajorVersion++;
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
GetVersionEx((OSVERSIONINFO *)&info);
......@@ -168,16 +168,16 @@ START_TEST(version)
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(!ret && (GetLastError() == ERROR_OLD_WIN_VERSION),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %ld\n", GetLastError());
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d\n", GetLastError());
ret = pVerifyVersionInfoA(&info, VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MINORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
/* test bad dwOSVersionInfoSize */
GetVersionEx((OSVERSIONINFO *)&info);
info.dwOSVersionInfoSize = 0;
ret = pVerifyVersionInfoA(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
pVerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL));
ok(ret, "VerifyVersionInfoA failed with error %ld\n", GetLastError());
ok(ret, "VerifyVersionInfoA failed with error %d\n", GetLastError());
}
......@@ -36,7 +36,7 @@ static void test_VirtualAlloc(void)
ok(addr1 == NULL, "VirtualAlloc should fail on zero-sized allocation\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER /* NT */ ||
GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Win9x */
"got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError());
"got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
addr1 = VirtualAlloc(0, 0xFFFC, MEM_RESERVE, PAGE_NOACCESS);
ok(addr1 != NULL, "VirtualAlloc failed\n");
......@@ -46,21 +46,21 @@ static void test_VirtualAlloc(void)
"VirtualQuery failed\n");
ok(info.BaseAddress == addr1, "%p != %p\n", info.BaseAddress, addr1);
ok(info.AllocationBase == addr1, "%p != %p\n", info.AllocationBase, addr1);
ok(info.AllocationProtect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.AllocationProtect);
ok(info.AllocationProtect == PAGE_NOACCESS, "%x != PAGE_NOACCESS\n", info.AllocationProtect);
ok(info.RegionSize == 0x10000, "%lx != 0x10000\n", info.RegionSize);
ok(info.State == MEM_RESERVE, "%lx != MEM_RESERVE\n", info.State);
ok(info.State == MEM_RESERVE, "%x != MEM_RESERVE\n", info.State);
/* NT reports Protect == 0 for a not committed memory block */
ok(info.Protect == 0 /* NT */ ||
info.Protect == PAGE_NOACCESS, /* Win9x */
"%lx != PAGE_NOACCESS\n", info.Protect);
ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
"%x != PAGE_NOACCESS\n", info.Protect);
ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
SetLastError(0xdeadbeef);
ok(!VirtualProtect(addr1, 0xFFFC, PAGE_READONLY, &old_prot),
"VirtualProtect should fail on a not committed memory\n");
ok(GetLastError() == ERROR_INVALID_ADDRESS /* NT */ ||
GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x */
"got %ld, expected ERROR_INVALID_ADDRESS\n", GetLastError());
"got %d, expected ERROR_INVALID_ADDRESS\n", GetLastError());
addr2 = VirtualAlloc(addr1, 0x1000, MEM_COMMIT, PAGE_NOACCESS);
ok(addr1 == addr2, "VirtualAlloc failed\n");
......@@ -70,12 +70,12 @@ static void test_VirtualAlloc(void)
"VirtualQuery failed\n");
ok(info.BaseAddress == addr1, "%p != %p\n", info.BaseAddress, addr1);
ok(info.AllocationBase == addr1, "%p != %p\n", info.AllocationBase, addr1);
ok(info.AllocationProtect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.AllocationProtect);
ok(info.AllocationProtect == PAGE_NOACCESS, "%x != PAGE_NOACCESS\n", info.AllocationProtect);
ok(info.RegionSize == 0x1000, "%lx != 0x1000\n", info.RegionSize);
ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
/* this time NT reports PAGE_NOACCESS as well */
ok(info.Protect == PAGE_NOACCESS, "%lx != PAGE_NOACCESS\n", info.Protect);
ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
ok(info.Protect == PAGE_NOACCESS, "%x != PAGE_NOACCESS\n", info.Protect);
ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
/* this should fail, since not the whole range is committed yet */
SetLastError(0xdeadbeef);
......@@ -83,26 +83,26 @@ static void test_VirtualAlloc(void)
"VirtualProtect should fail on a not committed memory\n");
ok(GetLastError() == ERROR_INVALID_ADDRESS /* NT */ ||
GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x */
"got %ld, expected ERROR_INVALID_ADDRESS\n", GetLastError());
"got %d, expected ERROR_INVALID_ADDRESS\n", GetLastError());
ok(VirtualProtect(addr1, 0x1000, PAGE_READONLY, &old_prot), "VirtualProtect failed\n");
ok(old_prot == PAGE_NOACCESS,
"wrong old protection: got %04lx instead of PAGE_NOACCESS\n", old_prot);
"wrong old protection: got %04x instead of PAGE_NOACCESS\n", old_prot);
ok(VirtualProtect(addr1, 0x1000, PAGE_READWRITE, &old_prot), "VirtualProtect failed\n");
ok(old_prot == PAGE_READONLY,
"wrong old protection: got %04lx instead of PAGE_READONLY\n", old_prot);
"wrong old protection: got %04x instead of PAGE_READONLY\n", old_prot);
ok(!VirtualFree(addr1, 0x10000, 0), "VirtualFree should fail with type 0\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError());
"got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
ok(VirtualFree(addr1, 0x10000, MEM_DECOMMIT), "VirtualFree failed\n");
/* if the type is MEM_RELEASE, size must be 0 */
ok(!VirtualFree(addr1, 1, MEM_RELEASE), "VirtualFree should fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"got %ld, expected ERROR_INVALID_PARAMETER\n", GetLastError());
"got %d, expected ERROR_INVALID_PARAMETER\n", GetLastError());
ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
}
......@@ -130,7 +130,7 @@ static void test_MapViewOfFile(void)
/* this fails on win9x but succeeds on NT */
ptr = MapViewOfFile( mapping, FILE_MAP_COPY, 0, 0, 4096 );
if (ptr) UnmapViewOfFile( ptr );
else ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %lx\n", GetLastError() );
else ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %x\n", GetLastError() );
ptr = MapViewOfFile( mapping, 0, 0, 0, 4096 );
ok( ptr != NULL, "MapViewOfFile 0 failed\n" );
......@@ -153,7 +153,7 @@ static void test_MapViewOfFile(void)
/* this fails on win9x but succeeds on NT */
ptr = MapViewOfFile( mapping, FILE_MAP_COPY, 0, 0, 4096 );
if (ptr) UnmapViewOfFile( ptr );
else ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %lx\n", GetLastError() );
else ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %x\n", GetLastError() );
ptr = MapViewOfFile( mapping, 0, 0, 0, 4096 );
ok( ptr != NULL, "MapViewOfFile 0 failed\n" );
......@@ -162,7 +162,7 @@ static void test_MapViewOfFile(void)
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 4096 );
ok( !ptr, "MapViewOfFile FILE_MAP_WRITE succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
CloseHandle( mapping );
/* copy-on-write mapping */
......@@ -185,14 +185,14 @@ static void test_MapViewOfFile(void)
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 4096 );
ok( !ptr, "MapViewOfFile FILE_MAP_WRITE succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
CloseHandle( mapping );
/* no access mapping */
mapping = CreateFileMappingA( file, NULL, PAGE_NOACCESS, 0, 4096, NULL );
/* fails on NT but succeeds on win9x */
if (!mapping) ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %lx\n", GetLastError() );
if (!mapping) ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %x\n", GetLastError() );
else
{
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 4096 );
......@@ -201,7 +201,7 @@ static void test_MapViewOfFile(void)
ptr = MapViewOfFile( mapping, FILE_MAP_COPY, 0, 0, 4096 );
ok( !ptr, "MapViewOfFile FILE_MAP_COPY succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %lx\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %x\n", GetLastError() );
ptr = MapViewOfFile( mapping, 0, 0, 0, 4096 );
ok( ptr != NULL, "MapViewOfFile 0 failed\n" );
......@@ -209,7 +209,7 @@ static void test_MapViewOfFile(void)
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 4096 );
ok( !ptr, "MapViewOfFile FILE_MAP_WRITE succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %lx\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error %x\n", GetLastError() );
CloseHandle( mapping );
}
......@@ -224,7 +224,7 @@ static void test_MapViewOfFile(void)
mapping = CreateFileMappingA( file, NULL, PAGE_READWRITE, 0, 4096, NULL );
ok( !mapping, "CreateFileMapping PAGE_READWRITE succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
mapping = CreateFileMappingA( file, NULL, PAGE_WRITECOPY, 0, 4096, NULL );
ok( mapping != 0, "CreateFileMapping PAGE_WRITECOPY failed\n" );
......@@ -243,17 +243,17 @@ static void test_MapViewOfFile(void)
mapping = CreateFileMappingA( file, NULL, PAGE_READWRITE, 0, 4096, NULL );
ok( !mapping, "CreateFileMapping PAGE_READWRITE succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
mapping = CreateFileMappingA( file, NULL, PAGE_WRITECOPY, 0, 4096, NULL );
ok( !mapping, "CreateFileMapping PAGE_WRITECOPY succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
mapping = CreateFileMappingA( file, NULL, PAGE_READONLY, 0, 4096, NULL );
ok( !mapping, "CreateFileMapping PAGE_READONLY succeeded\n" );
ok( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %lx\n", GetLastError() );
GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %x\n", GetLastError() );
CloseHandle( file );
......
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