[PATCH v2 4/4] kernelbase: Call NtCancelSynchronousIoFile in CancelSynchronousIo.

Daniel Lehman wine at gitlab.winehq.org
Wed Jun 22 01:40:55 CDT 2022


From: Daniel Lehman <dlehman25 at gmail.com>

Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---
 dlls/kernel32/tests/pipe.c | 7 +------
 dlls/kernelbase/file.c     | 6 +++---
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index 50dda0bcc80..a27d510a7f6 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -4212,7 +4212,6 @@ static DWORD CALLBACK synchronousIoThreadMain(void *arg)
     SetLastError(0xdeadbeef);
     ret = ConnectNamedPipe(pipe, NULL);
     ok(!ret, "expected failure\n");
-    todo_wine
     ok(GetLastError() == ERROR_OPERATION_ABORTED, "got error %lu\n", GetLastError());
     return 0;
 }
@@ -4247,14 +4246,12 @@ static void test_CancelSynchronousIo(void)
     SetLastError(0xdeadbeef);
     res = pCancelSynchronousIo((HANDLE)0xdeadbeef);
     ok(!res, "CancelSynchronousIo succeeded unexpectedly\n");
-    todo_wine
     ok(GetLastError() == ERROR_INVALID_HANDLE,
         "In CancelSynchronousIo failure, expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     res = pCancelSynchronousIo(GetCurrentThread());
     ok(!res, "CancelSynchronousIo succeeded unexpectedly\n");
-    todo_wine
     ok(GetLastError() == ERROR_NOT_FOUND,
         "In CancelSynchronousIo failure, expected ERROR_NOT_FOUND, got %ld\n", GetLastError());
 
@@ -4267,11 +4264,10 @@ static void test_CancelSynchronousIo(void)
     /* wait for thread to start listening */
     Sleep(100);
     res = pCancelSynchronousIo(thread);
-    todo_wine
     ok(res, "CancelSynchronousIo failed with error %ld\n", GetLastError());
-    CloseHandle(pipe);
     WaitForSingleObject(thread, INFINITE);
     CloseHandle(thread);
+    CloseHandle(pipe);
 
     /* asynchronous i/o */
     pipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
@@ -4282,7 +4278,6 @@ static void test_CancelSynchronousIo(void)
     Sleep(100);
     res = pCancelSynchronousIo(thread);
     ok(!res, "CancelSynchronousIo succeeded unexpectedly\n");
-    todo_wine
     ok(GetLastError() == ERROR_NOT_FOUND,
         "In CancelSynchronousIo failure, expected ERROR_NOT_FOUND, got %ld\n", GetLastError());
     file = CreateFileA(PIPENAME, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 8ae982294f6..9a57c7f2e49 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -2900,9 +2900,9 @@ BOOL WINAPI DECLSPEC_HOTPATCH CancelIoEx( HANDLE handle, LPOVERLAPPED overlapped
  */
 BOOL WINAPI DECLSPEC_HOTPATCH CancelSynchronousIo( HANDLE thread )
 {
-    FIXME( "(%p): stub\n", thread );
-    SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
-    return FALSE;
+    IO_STATUS_BLOCK io;
+
+    return set_ntstatus( NtCancelSynchronousIoFile( thread, NULL, &io ) );
 }
 
 
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/47



More information about the wine-devel mailing list