kernel32/tests: Test ReadFileScatter() completion status with FILE_SKIP_COMPLETION_PORT_ON_SUCCESS.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Jacek Caban<jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-02-20 21:50:14 +03:00 committed by Alexandre Julliard
parent 76cbd21c5a
commit 41b221ff82
1 changed files with 24 additions and 0 deletions

View File

@ -61,6 +61,7 @@ static BOOL (WINAPI *pSetFileInformationByHandle)(HANDLE, FILE_INFO_BY_HANDLE_CL
static BOOL (WINAPI *pGetQueuedCompletionStatusEx)(HANDLE, OVERLAPPED_ENTRY*, ULONG, ULONG*, DWORD, BOOL);
static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ);
static void (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
static BOOL (WINAPI *pSetFileCompletionNotificationModes)(HANDLE, UCHAR);
static char filename[MAX_PATH];
static const char sillytext[] =
@ -109,6 +110,7 @@ static void InitFunctionPointers(void)
pGetFinalPathNameByHandleW = (void *) GetProcAddress(hkernel32, "GetFinalPathNameByHandleW");
pSetFileInformationByHandle = (void *) GetProcAddress(hkernel32, "SetFileInformationByHandle");
pGetQueuedCompletionStatusEx = (void *) GetProcAddress(hkernel32, "GetQueuedCompletionStatusEx");
pSetFileCompletionNotificationModes = (void *)GetProcAddress(hkernel32, "SetFileCompletionNotificationModes");
}
static void test__hread( void )
@ -4565,6 +4567,28 @@ static void test_WriteFileGather(void)
ok( memcmp( rbuf1 + si.dwPageSize / 2, rbuf2, si.dwPageSize - si.dwPageSize / 2 ) == 0,
"invalid data was read into buffer\n" );
if (pSetFileCompletionNotificationModes)
{
br = pSetFileCompletionNotificationModes(hfile, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS);
ok(br, "SetFileCompletionNotificationModes failed, error %u.\n", GetLastError());
br = ReadFileScatter(hfile, fse, si.dwPageSize, NULL, &ovl);
ok(br == FALSE, "ReadFileScatter should be asynchronous.\n");
ok(GetLastError() == ERROR_IO_PENDING, "ReadFileScatter failed, error %u.\n", GetLastError());
br = GetQueuedCompletionStatus(hiocp2, &size, &key, &povl, 1000);
todo_wine ok(br, "GetQueuedCompletionStatus failed, err %u.\n", GetLastError());
todo_wine ok(povl == &ovl, "Wrong ovl %p.\n", povl);
br = GetOverlappedResult(hfile, &ovl, &tx, TRUE);
ok(br, "GetOverlappedResult failed, err %u.\n", GetLastError());
ok(tx == si.dwPageSize, "Got unexpected size %u.\n", tx);
ResetEvent(evt);
}
else
win_skip("SetFileCompletionNotificationModes not available.\n");
CloseHandle( hfile );
CloseHandle( hiocp1 );
CloseHandle( hiocp2 );