From 79165b162492f7b1a0ece97825f2d1ba735b5db0 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 25 Jul 2023 19:28:25 -0600 Subject: [PATCH] nsi: Implement NsiCancelChangeNotification(). --- dlls/nsi/nsi.c | 10 ++++++++-- dlls/nsi/tests/nsi.c | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dlls/nsi/nsi.c b/dlls/nsi/nsi.c index a44339fc3af..5dc54d0035f 100644 --- a/dlls/nsi/nsi.c +++ b/dlls/nsi/nsi.c @@ -119,9 +119,15 @@ err: DWORD WINAPI NsiCancelChangeNotification( OVERLAPPED *ovr ) { - FIXME( "%p stub.\n", ovr ); + DWORD err = ERROR_SUCCESS; - return ERROR_NOT_SUPPORTED; + TRACE( "%p.\n", ovr ); + + if (!ovr) return ERROR_NOT_FOUND; + if (!CancelIoEx( get_nsi_device( TRUE ), ovr )) + err = GetLastError(); + + return err; } DWORD WINAPI NsiEnumerateObjectsAllParameters( DWORD unk, DWORD unk2, const NPI_MODULEID *module, DWORD table, diff --git a/dlls/nsi/tests/nsi.c b/dlls/nsi/tests/nsi.c index 6d759debfd6..1bae78d2563 100644 --- a/dlls/nsi/tests/nsi.c +++ b/dlls/nsi/tests/nsi.c @@ -1056,24 +1056,24 @@ void test_change_notifications(void) ok( !bret && GetLastError() == ERROR_IO_INCOMPLETE, "got bret %d, err %lu.\n", bret, GetLastError() ); ret = NsiCancelChangeNotification( NULL ); - todo_wine ok( ret == ERROR_NOT_FOUND, "got %lu.\n", ret ); + ok( ret == ERROR_NOT_FOUND, "got %lu.\n", ret ); ret = NsiCancelChangeNotification( &ovr ); - todo_wine ok( !ret, "got %lu.\n", ret ); + ok( !ret, "got %lu.\n", ret ); bytes = 0xdeadbeef; - bret = GetOverlappedResult( handle, &ovr, &bytes, FALSE ); + bret = GetOverlappedResult( handle, &ovr, &bytes, TRUE ); - todo_wine ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); - todo_wine ok( ovr.Internal == (ULONG)STATUS_CANCELLED, "got %Ix.\n", ovr.Internal ); - todo_wine ok( !bytes, "got %lu.\n", bytes ); + ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); + ok( ovr.Internal == (ULONG)STATUS_CANCELLED, "got %Ix.\n", ovr.Internal ); + ok( !bytes, "got %lu.\n", bytes ); bret = GetOverlappedResult( handle2, &ovr2, &bytes, FALSE ); ok( !bret && GetLastError() == ERROR_IO_INCOMPLETE, "got bret %d, err %lu.\n", bret, GetLastError() ); ret = NsiCancelChangeNotification( &ovr2 ); - todo_wine ok( !ret, "got %lu.\n", ret ); - bret = GetOverlappedResult( handle, &ovr, &bytes, FALSE ); - todo_wine ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); + ok( !ret, "got %lu.\n", ret ); + bret = GetOverlappedResult( handle, &ovr, &bytes, TRUE ); + ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); ret = NsiRequestChangeNotification( 0, &NPI_MS_NDIS_MODULEID, NSI_NDIS_INDEX_LUID_TABLE, &ovr, &handle ); todo_wine ok( ret == ERROR_INVALID_PARAMETER, "got %lu.\n", ret ); @@ -1081,9 +1081,9 @@ void test_change_notifications(void) ret = NsiRequestChangeNotification( 0, &NPI_MS_IPV4_MODULEID, NSI_IP_FORWARD_TABLE, &ovr, &handle ); ok( ret == ERROR_IO_PENDING, "got %lu.\n", ret ); ret = NsiCancelChangeNotification( &ovr ); - todo_wine ok( !ret, "got %lu.\n", ret ); - bret = GetOverlappedResult( handle, &ovr, &bytes, FALSE ); - todo_wine ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); + ok( !ret, "got %lu.\n", ret ); + bret = GetOverlappedResult( handle, &ovr, &bytes, TRUE ); + ok( !bret && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", bret, GetLastError() ); } START_TEST( nsi )