kernel32/tests: Don't test function directly when reporting GetLastError().
This commit is contained in:
parent
fd71f87642
commit
0ba0f505af
|
@ -1115,9 +1115,8 @@ static void test_WaitRx(HANDLE hcom)
|
||||||
ZeroMemory( &overlapped, sizeof(overlapped));
|
ZeroMemory( &overlapped, sizeof(overlapped));
|
||||||
overlapped.hEvent = hComPortEvent;
|
overlapped.hEvent = hComPortEvent;
|
||||||
|
|
||||||
ok((hComWriteEvent = CreateEvent( NULL, TRUE, FALSE, NULL )) !=0,
|
hComWriteEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||||
"CreateEvent res %d\n",
|
ok(hComWriteEvent != NULL, "CreateEvent res %d\n", GetLastError());
|
||||||
GetLastError());
|
|
||||||
ZeroMemory( &overlapped_w, sizeof(overlapped_w));
|
ZeroMemory( &overlapped_w, sizeof(overlapped_w));
|
||||||
overlapped_w.hEvent = hComWriteEvent;
|
overlapped_w.hEvent = hComWriteEvent;
|
||||||
|
|
||||||
|
|
|
@ -2393,7 +2393,8 @@ static void test_read_write(void)
|
||||||
user_apc_ran = FALSE;
|
user_apc_ran = FALSE;
|
||||||
if (pQueueUserAPC) {
|
if (pQueueUserAPC) {
|
||||||
trace("Queueing an user APC\n"); /* verify the file is non alerable */
|
trace("Queueing an user APC\n"); /* verify the file is non alerable */
|
||||||
ok(pQueueUserAPC(&user_apc, GetCurrentThread(), 0), "QueueUserAPC failed: %d\n", GetLastError());
|
ret = pQueueUserAPC(&user_apc, GetCurrentThread(), 0);
|
||||||
|
ok(ret, "QueueUserAPC failed: %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError(12345678);
|
SetLastError(12345678);
|
||||||
|
|
|
@ -480,7 +480,8 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
|
||||||
user_apc_ran = FALSE;
|
user_apc_ran = FALSE;
|
||||||
if (i == 0 && pQueueUserAPC) {
|
if (i == 0 && pQueueUserAPC) {
|
||||||
trace("Queueing an user APC\n"); /* verify the pipe is non alerable */
|
trace("Queueing an user APC\n"); /* verify the pipe is non alerable */
|
||||||
ok(pQueueUserAPC(&user_apc, GetCurrentThread(), 0), "QueueUserAPC failed: %d\n", GetLastError());
|
success = pQueueUserAPC(&user_apc, GetCurrentThread(), 0);
|
||||||
|
ok(success, "QueueUserAPC failed: %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for client to connect */
|
/* Wait for client to connect */
|
||||||
|
|
|
@ -448,8 +448,8 @@ static void test_profile_delete_on_close(void)
|
||||||
|
|
||||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||||
ok( WriteFile( h, contents, sizeof contents - 1, &size, NULL ),
|
res = WriteFile( h, contents, sizeof contents - 1, &size, NULL );
|
||||||
"Cannot write test file: %x\n", GetLastError() );
|
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||||
ok( size == sizeof contents - 1, "Test file: partial write\n");
|
ok( size == sizeof contents - 1, "Test file: partial write\n");
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
|
@ -472,8 +472,8 @@ static void test_profile_refresh(void)
|
||||||
|
|
||||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||||
ok( WriteFile( h, contents1, sizeof contents1 - 1, &size, NULL ),
|
res = WriteFile( h, contents1, sizeof contents1 - 1, &size, NULL );
|
||||||
"Cannot write test file: %x\n", GetLastError() );
|
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||||
ok( size == sizeof contents1 - 1, "Test file: partial write\n");
|
ok( size == sizeof contents1 - 1, "Test file: partial write\n");
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
|
@ -488,8 +488,8 @@ static void test_profile_refresh(void)
|
||||||
|
|
||||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||||
ok( WriteFile( h, contents2, sizeof contents2 - 1, &size, NULL ),
|
res = WriteFile( h, contents2, sizeof contents2 - 1, &size, NULL );
|
||||||
"Cannot write test file: %x\n", GetLastError() );
|
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||||
ok( size == sizeof contents2 - 1, "Test file: partial write\n");
|
ok( size == sizeof contents2 - 1, "Test file: partial write\n");
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
|
|
|
@ -598,12 +598,14 @@ static void test_MapViewOfFile(void)
|
||||||
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
|
SIZE_T size;
|
||||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
||||||
ok( ptr != NULL, "MapViewOfFile FILE_MAP_READ error %u\n", GetLastError() );
|
ok( ptr != NULL, "MapViewOfFile FILE_MAP_READ error %u\n", GetLastError() );
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
|
size = VirtualQuery( ptr, &info, sizeof(info) );
|
||||||
|
ok( size == sizeof(info),
|
||||||
"VirtualQuery error %u\n", GetLastError() );
|
"VirtualQuery error %u\n", GetLastError() );
|
||||||
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
|
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
|
||||||
ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
|
ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
|
||||||
|
@ -623,12 +625,14 @@ static void test_MapViewOfFile(void)
|
||||||
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
|
SIZE_T size;
|
||||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
||||||
ok( ptr != NULL, "MapViewOfFile FILE_MAP_WRITE error %u\n", GetLastError() );
|
ok( ptr != NULL, "MapViewOfFile FILE_MAP_WRITE error %u\n", GetLastError() );
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok( VirtualQuery( ptr, &info, sizeof(info) ) == sizeof(info),
|
size = VirtualQuery( ptr, &info, sizeof(info) );
|
||||||
|
ok( size == sizeof(info),
|
||||||
"VirtualQuery error %u\n", GetLastError() );
|
"VirtualQuery error %u\n", GetLastError() );
|
||||||
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
|
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
|
||||||
ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
|
ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
|
||||||
|
|
Loading…
Reference in New Issue