diff --git a/modules/rostests/kmtests/include/kmt_test.h b/modules/rostests/kmtests/include/kmt_test.h index c046ab05874..4f25d6580b8 100644 --- a/modules/rostests/kmtests/include/kmt_test.h +++ b/modules/rostests/kmtests/include/kmt_test.h @@ -170,6 +170,7 @@ VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL); DWORD KmtRunKernelTest(IN PCSTR TestName); DWORD KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning); +VOID KmtUnloadDriverKeepService(VOID); VOID KmtUnloadDriver(VOID); DWORD KmtOpenDriver(VOID); VOID KmtCloseDriver(VOID); diff --git a/modules/rostests/kmtests/kmtest/support.c b/modules/rostests/kmtests/kmtest/support.c index 4cfa4bae9b8..0bb60eb3532 100644 --- a/modules/rostests/kmtests/kmtest/support.c +++ b/modules/rostests/kmtests/kmtest/support.c @@ -140,6 +140,24 @@ KmtLoadDriver( return KmtCreateAndStartService(TestServiceName, ServicePath, NULL, &TestServiceHandle, RestartIfRunning); } +/** + * @name KmtUnloadDriverKeepService + * + * Unload special-purpose driver (stop the service only) + */ +VOID +KmtUnloadDriverKeepService(VOID) +{ + DWORD Error; + + Error = KmtStopService(TestServiceName, &TestServiceHandle); + + if (Error) + { + fprintf(stderr, "Failed to stop %ls service with error 0x%lx\n", TestServiceName, Error); + } +} + /** * @name KmtUnloadDriver * diff --git a/modules/rostests/kmtests/ntos_io/IoDeviceObject_drv.c b/modules/rostests/kmtests/ntos_io/IoDeviceObject_drv.c index c71a0b8599c..c714bc8ab01 100644 --- a/modules/rostests/kmtests/ntos_io/IoDeviceObject_drv.c +++ b/modules/rostests/kmtests/ntos_io/IoDeviceObject_drv.c @@ -1,9 +1,9 @@ /* - * PROJECT: ReactOS kernel-mode tests - * LICENSE: GPLv2+ - See COPYING in the top level directory - * PURPOSE: Kernel-Mode Test Suite Driver Object Test Driver - * PROGRAMMER: Michael Martin - * Thomas Faber + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Kernel-Mode Test Suite Device Object Test Driver + * COPYRIGHT: Copyright 2009 Michael Martin (michael.martin@reactos.org) + * COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org) */ #include @@ -424,10 +424,11 @@ TestDeviceDeletion( DeviceObject->DeviceType); ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount); - /*Check the extended extension */ + /* Check the extended extension */ extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension; - ok(extdev->ExtensionFlags == DOE_UNLOAD_PENDING, - "Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got %lu\n", extdev->ExtensionFlags); + /* FIXME: Windows has the MSB set under some conditions, need to find out what this means */ + ok((extdev->ExtensionFlags & 0x7fffffff) == DOE_UNLOAD_PENDING, + "Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got 0x%lx\n", extdev->ExtensionFlags); ok (extdev->Type == 13, "Expected Type of 13, got %d\n", extdev->Type); ok (extdev->Size == 0, "Expected Size of 0, got %d\n", extdev->Size); ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p\n", diff --git a/modules/rostests/kmtests/ntos_io/IoDeviceObject_user.c b/modules/rostests/kmtests/ntos_io/IoDeviceObject_user.c index 50d66c58926..e51139191d5 100644 --- a/modules/rostests/kmtests/ntos_io/IoDeviceObject_user.c +++ b/modules/rostests/kmtests/ntos_io/IoDeviceObject_user.c @@ -1,8 +1,9 @@ /* - * PROJECT: ReactOS kernel-mode tests - * LICENSE: GPLv2+ - See COPYING in the top level directory - * PURPOSE: Kernel-Mode Test Suite Driver Object test user-mode part - * PROGRAMMER: Thomas Faber + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Kernel-Mode Test Suite Device Object test user-mode part + * COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org) + * COPYRIGHT: Copyright 2022 Timo Kreuzer (timo.kreuzer@reactos.org) */ #include @@ -16,7 +17,9 @@ START_TEST(IoDeviceObject) ok_eq_int(Error, ERROR_SUCCESS); if (Error) return; - KmtUnloadDriver(); + /* Can't use the normal unload function here because we need the + * service to stick around. */ + KmtUnloadDriverKeepService(); Error = KmtLoadAndOpenDriver(L"IoDeviceObject", TRUE); ok_eq_int(Error, ERROR_SUCCESS); diff --git a/modules/rostests/kmtests/ntos_ke/KeSpinLock.c b/modules/rostests/kmtests/ntos_ke/KeSpinLock.c index 32f5b8ce351..022a67b74ae 100644 --- a/modules/rostests/kmtests/ntos_ke/KeSpinLock.c +++ b/modules/rostests/kmtests/ntos_ke/KeSpinLock.c @@ -1,6 +1,6 @@ /* * PROJECT: ReactOS kernel-mode tests - * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) * PURPOSE: Kernel-Mode Test Suite Spin lock test * COPYRIGHT: Copyright 2011-2023 Thomas Faber (thomas.faber@reactos.org) * COPYRIGHT: Copyright 2021 Jérôme Gardou (jerome.gardou@reactos.org)