[PATCH 1/2] ntdll/tests: Don't abort if NtCancelFileIoEx() is missing.
Zebediah Figura
z.figura12 at gmail.com
Fri Oct 6 17:18:51 CDT 2017
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/ntdll/tests/pipe.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index c448526..3e78bc9 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -98,11 +98,11 @@ static BOOL init_func_ptrs(void)
loadfunc(NtQueryVolumeInformationFile)
loadfunc(NtSetInformationFile)
loadfunc(NtCancelIoFile)
- loadfunc(NtCancelIoFileEx)
loadfunc(RtlInitUnicodeString)
/* not fatal */
module = GetModuleHandleA("kernel32.dll");
+ pNtCancelIoFileEx = (void *)GetProcAddress(module, "NtCancelIoFileEx");
pOpenThread = (void *)GetProcAddress(module, "OpenThread");
pQueueUserAPC = (void *)GetProcAddress(module, "QueueUserAPC");
return TRUE;
@@ -516,21 +516,27 @@ static void test_cancelio(void)
CloseHandle(hPipe);
- res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
- ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
+ if (pNtCancelIoFileEx)
+ {
+ res = create_pipe(&hPipe, FILE_SHARE_READ | FILE_SHARE_WRITE, 0 /* OVERLAPPED */);
+ ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
- memset(&iosb, 0x55, sizeof(iosb));
- res = listen_pipe(hPipe, hEvent, &iosb, FALSE);
- ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
+ memset(&iosb, 0x55, sizeof(iosb));
+ res = listen_pipe(hPipe, hEvent, &iosb, FALSE);
+ ok(res == STATUS_PENDING, "NtFsControlFile returned %x\n", res);
- res = pNtCancelIoFileEx(hPipe, &iosb, &cancel_sb);
- ok(!res, "NtCancelIoFileEx returned %x\n", res);
+ res = pNtCancelIoFileEx(hPipe, &iosb, &cancel_sb);
+ ok(!res, "NtCancelIoFileEx returned %x\n", res);
- ok(U(iosb).Status == STATUS_CANCELLED, "Wrong iostatus %x\n", U(iosb).Status);
- ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
+ ok(U(iosb).Status == STATUS_CANCELLED, "Wrong iostatus %x\n", U(iosb).Status);
+ ok(WaitForSingleObject(hEvent, 0) == 0, "hEvent not signaled\n");
+
+ CloseHandle(hPipe);
+ }
+ else
+ skip("NtCancelIoFileEx not available\n");
CloseHandle(hEvent);
- CloseHandle(hPipe);
}
static void _check_pipe_handle_state(int line, HANDLE handle, ULONG read, ULONG completion)
@@ -1098,6 +1104,8 @@ static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
CloseHandle( read );
CloseHandle( write );
}
+ else
+ skip("NtCancelIoFileEx not available\n");
CloseHandle(event);
}
--
2.7.4
More information about the wine-patches
mailing list