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));
|
||||
overlapped.hEvent = hComPortEvent;
|
||||
|
||||
ok((hComWriteEvent = CreateEvent( NULL, TRUE, FALSE, NULL )) !=0,
|
||||
"CreateEvent res %d\n",
|
||||
GetLastError());
|
||||
hComWriteEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
ok(hComWriteEvent != NULL, "CreateEvent res %d\n", GetLastError());
|
||||
ZeroMemory( &overlapped_w, sizeof(overlapped_w));
|
||||
overlapped_w.hEvent = hComWriteEvent;
|
||||
|
||||
|
|
|
@ -2393,7 +2393,8 @@ static void test_read_write(void)
|
|||
user_apc_ran = FALSE;
|
||||
if (pQueueUserAPC) {
|
||||
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);
|
||||
|
|
|
@ -480,7 +480,8 @@ static DWORD CALLBACK serverThreadMain2(LPVOID arg)
|
|||
user_apc_ran = FALSE;
|
||||
if (i == 0 && pQueueUserAPC) {
|
||||
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 */
|
||||
|
|
|
@ -448,8 +448,8 @@ static void test_profile_delete_on_close(void)
|
|||
|
||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||
ok( WriteFile( h, contents, sizeof contents - 1, &size, NULL ),
|
||||
"Cannot write test file: %x\n", GetLastError() );
|
||||
res = WriteFile( h, contents, sizeof contents - 1, &size, NULL );
|
||||
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||
ok( size == sizeof contents - 1, "Test file: partial write\n");
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
|
@ -472,8 +472,8 @@ static void test_profile_refresh(void)
|
|||
|
||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||
ok( WriteFile( h, contents1, sizeof contents1 - 1, &size, NULL ),
|
||||
"Cannot write test file: %x\n", GetLastError() );
|
||||
res = WriteFile( h, contents1, sizeof contents1 - 1, &size, NULL );
|
||||
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||
ok( size == sizeof contents1 - 1, "Test file: partial write\n");
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
|
@ -488,8 +488,8 @@ static void test_profile_refresh(void)
|
|||
|
||||
h = CreateFile(testfile, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||
CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
|
||||
ok( WriteFile( h, contents2, sizeof contents2 - 1, &size, NULL ),
|
||||
"Cannot write test file: %x\n", GetLastError() );
|
||||
res = WriteFile( h, contents2, sizeof contents2 - 1, &size, NULL );
|
||||
ok( res, "Cannot write test file: %x\n", GetLastError() );
|
||||
ok( size == sizeof contents2 - 1, "Test file: partial write\n");
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
|
|
|
@ -598,12 +598,14 @@ static void test_MapViewOfFile(void)
|
|||
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
||||
if (!ptr)
|
||||
{
|
||||
SIZE_T size;
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
||||
SetLastError(0xdeadbeef);
|
||||
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
|
||||
ok( ptr != NULL, "MapViewOfFile FILE_MAP_READ error %u\n", GetLastError() );
|
||||
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() );
|
||||
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, 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 );
|
||||
if (!ptr)
|
||||
{
|
||||
SIZE_T size;
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "Wrong error %d\n", GetLastError() );
|
||||
SetLastError(0xdeadbeef);
|
||||
ptr = MapViewOfFile( mapping, FILE_MAP_WRITE, 0, 0, 0 );
|
||||
ok( ptr != NULL, "MapViewOfFile FILE_MAP_WRITE error %u\n", GetLastError() );
|
||||
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() );
|
||||
ok( info.BaseAddress == ptr, "%p != %p\n", info.BaseAddress, ptr );
|
||||
ok( info.AllocationBase == ptr, "%p != %p\n", info.AllocationBase, ptr );
|
||||
|
|
Loading…
Reference in New Issue