diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90f3e629ede..aa461f3a72f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
add_subdirectory(apitests)
#add_subdirectory(dibtests)
-add_subdirectory(drivers)
+#add_subdirectory(drivers)
#add_subdirectory(dxtest)
add_subdirectory(kmtests)
#add_subdirectory(regtests)
@@ -9,5 +9,5 @@ if(NOT MSVC) # FIXME: msvc build
add_subdirectory(rosautotest)
endif()
add_subdirectory(tests)
-add_subdirectory(win32)
+#add_subdirectory(win32)
add_subdirectory(winetests)
diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt
deleted file mode 100644
index b223805c4ff..00000000000
--- a/drivers/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-#add_subdirectory(csqtest)
-add_subdirectory(kmtest)
-#add_subdirectory(memtest)
-#add_subdirectory(ntoskrnl)
diff --git a/drivers/directory.rbuild b/drivers/directory.rbuild
index 322935ee2f4..63ed0581c0c 100644
--- a/drivers/directory.rbuild
+++ b/drivers/directory.rbuild
@@ -4,12 +4,6 @@
-
-
-
-
-
-
diff --git a/drivers/kmtest/CMakeLists.txt b/drivers/kmtest/CMakeLists.txt
deleted file mode 100644
index 3eae4fa9e08..00000000000
--- a/drivers/kmtest/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-
-list(APPEND KMTEST_SOURCE
- kmtest.c
- deviface_test.c
- drvobj_test.c
- devobj_test.c
- reghelper.c
- ntos_ex.c
- ntos_io.c
- ntos_ke.c
- ntos_ob.c
- ntos_pools.c
- ntos_fsrtl.c
- kmtest.rc)
-
-add_library(kmtest_old SHARED ${KMTEST_SOURCE})
-
-set_module_type(kmtest_old kernelmodedriver)
-target_link_libraries(kmtest_old ${PSEH_LIB})
-add_importlibs(kmtest_old ntoskrnl hal)
-
-add_cd_file(TARGET kmtest_old DESTINATION reactos/system32/drivers FOR all)
-
-
-add_library(kmtestassist SHARED kmtestassist.c)
-
-set_module_type(kmtestassist kernelmodedriver)
-add_importlibs(kmtestassist ntoskrnl hal)
-
-add_cd_file(TARGET kmtestassist DESTINATION reactos/system32/drivers FOR all)
diff --git a/drivers/kmtest/deviface_test.c b/drivers/kmtest/deviface_test.c
deleted file mode 100644
index 2e27349697c..00000000000
--- a/drivers/kmtest/deviface_test.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * PnP Test
- * Device Interface functions test
- *
- * Copyright 2004 Filip Navara
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-/* PRIVATE FUNCTIONS **********************************************************/
-
-NTSTATUS
-(NTAPI *IoGetDeviceInterfaces_Func)(
- IN CONST GUID *InterfaceClassGuid,
- IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
- IN ULONG Flags,
- OUT PWSTR *SymbolicLinkList);
-
-NTSTATUS NTAPI
-ReactOS_IoGetDeviceInterfaces(
- IN CONST GUID *InterfaceClassGuid,
- IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
- IN ULONG Flags,
- OUT PWSTR *SymbolicLinkList);
-
-VOID DeviceInterfaceTest_Func()
-{
- NTSTATUS Status;
- PWSTR SymbolicLinkList;
- PWSTR SymbolicLinkListPtr;
- GUID Guid = {0x378de44c, 0x56ef, 0x11d1, {0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd}};
-
- Status = IoGetDeviceInterfaces(
- &Guid,
- NULL,
- 0,
- &SymbolicLinkList);
-
- ok(NT_SUCCESS(Status),
- "IoGetDeviceInterfaces failed with status 0x%X\n",
- (unsigned int)Status);
- if (!NT_SUCCESS(Status))
- {
- return;
- }
-
- DPRINT("IoGetDeviceInterfaces results:\n");
- for (SymbolicLinkListPtr = SymbolicLinkList;
- SymbolicLinkListPtr[0] != 0 && SymbolicLinkListPtr[1] != 0;
- SymbolicLinkListPtr += wcslen(SymbolicLinkListPtr) + 1)
- {
- DPRINT1("Symbolic Link: %S\n", SymbolicLinkListPtr);
- }
-
-#if 0
- DPRINT("[PnP Test] Trying to get aliases\n");
-
- for (SymbolicLinkListPtr = SymbolicLinkList;
- SymbolicLinkListPtr[0] != 0 && SymbolicLinkListPtr[1] != 0;
- SymbolicLinkListPtr += wcslen(SymbolicLinkListPtr) + 1)
- {
- UNICODE_STRING SymbolicLink;
- UNICODE_STRING AliasSymbolicLink;
-
- SymbolicLink.Buffer = SymbolicLinkListPtr;
- SymbolicLink.Length = SymbolicLink.MaximumLength = wcslen(SymbolicLinkListPtr);
- RtlInitUnicodeString(&AliasSymbolicLink, NULL);
- IoGetDeviceInterfaceAlias(
- &SymbolicLink,
- &AliasGuid,
- &AliasSymbolicLink);
- if (AliasSymbolicLink.Buffer != NULL)
- {
- DPRINT("[PnP Test] Original: %S\n", SymbolicLinkListPtr);
- DPRINT("[PnP Test] Alias: %S\n", AliasSymbolicLink.Buffer);
- }
- }
-#endif
-
- ExFreePool(SymbolicLinkList);
-}
-
-VOID RegisterDI_Test(HANDLE KeyHandle)
-{
- GUID Guid = {0x378de44c, 0x56ef, 0x11d1, {0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd}};
- DEVICE_OBJECT DeviceObject;
- EXTENDED_DEVOBJ_EXTENSION DeviceObjectExtension;
- DEVICE_NODE DeviceNode;
- UNICODE_STRING SymbolicLinkName;
- NTSTATUS Status;
-
- StartTest();
-
- RtlInitUnicodeString(&SymbolicLinkName, L"");
-
- // Prepare our surrogate of a Device Object
- DeviceObject.DeviceObjectExtension = (PDEVOBJ_EXTENSION)&DeviceObjectExtension;
-
- // 1. DeviceNode = NULL
- DeviceObjectExtension.DeviceNode = NULL;
- Status = IoRegisterDeviceInterface(&DeviceObject, &Guid, NULL,
- &SymbolicLinkName);
-
- ok(Status == STATUS_INVALID_DEVICE_REQUEST,
- "IoRegisterDeviceInterface returned 0x%08lX\n", Status);
-
- // 2. DeviceNode->InstancePath is of a null length
- DeviceObjectExtension.DeviceNode = &DeviceNode;
- DeviceNode.InstancePath.Length = 0;
- Status = IoRegisterDeviceInterface(&DeviceObject, &Guid, NULL,
- &SymbolicLinkName);
-
- ok(Status == STATUS_INVALID_DEVICE_REQUEST,
- "IoRegisterDeviceInterface returned 0x%08lX\n", Status);
-
- DeviceInterfaceTest_Func();
-
- FinishTest(KeyHandle, L"IoDeviceInterfaceTest");
-}
diff --git a/drivers/kmtest/devobj_test.c b/drivers/kmtest/devobj_test.c
deleted file mode 100644
index 00e96cea36d..00000000000
--- a/drivers/kmtest/devobj_test.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Driver Regression Tests
- *
- * Copyright 2009 Michael Martin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include "kmtest.h"
-#include
-#include
-#include "ntddser.h"
-#include "ntndk.h"
-
-VOID LowerDeviceKernelAPITest(PDEVICE_OBJECT DeviceObject, BOOLEAN UnLoading)
-{
- PDEVICE_OBJECT RetObject;
-
- RetObject = IoGetLowerDeviceObject(DeviceObject);
-
- if (UnLoading)
- {
- ok(RetObject == 0,
- "Expected no Lower DeviceObject, got %p", RetObject);
- }
- else
- {
- ok(RetObject == AttachDeviceObject,
- "Expected an Attached DeviceObject %p, got %p", AttachDeviceObject, RetObject);
- }
-
- if (RetObject)
- {
- ObDereferenceObject(RetObject);
- }
-
- RetObject = IoGetDeviceAttachmentBaseRef(DeviceObject);
- ok(RetObject == DeviceObject,
- "Expected an Attached DeviceObject %p, got %p", DeviceObject, RetObject);
-
- if (RetObject)
- {
- ObDereferenceObject(RetObject);
- }
-
-}
-VOID DeviceCreatedTest(PDEVICE_OBJECT DeviceObject, BOOLEAN ExclusiveAccess)
-{
- PEXTENDED_DEVOBJ_EXTENSION extdev;
-
- /*Check the device object members */
- ok(DeviceObject->Type==3, "Expected Type = 3, got %x", DeviceObject->Type);
- ok(DeviceObject->Size = 0xb8, "Expected Size = 0xba, got %x", DeviceObject->Size);
- ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu",
- DeviceObject->ReferenceCount);
- ok(DeviceObject->DriverObject == ThisDriverObject,
- "Expected DriverObject member to match this DriverObject %p, got %p",
- ThisDriverObject, DeviceObject->DriverObject);
- ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p", DeviceObject->NextDevice);
- ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p", DeviceObject->AttachedDevice);
- ok(DeviceObject->Characteristics == 0, "Expected Characteristics to be 0");
- if (ExclusiveAccess)
- {
- ok((DeviceObject->Flags == (DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE)),
- "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE, got %lu", DeviceObject->Flags);
- }
- else
- {
- ok((DeviceObject->Flags == (DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING)),
- "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING, got %lu", DeviceObject->Flags);
- }
- ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
- "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu",
- DeviceObject->DeviceType);
- ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
-
- /*Check the extended extension */
- extdev = (PEXTENDED_DEVOBJ_EXTENSION)DeviceObject->DeviceObjectExtension;
- ok(extdev->ExtensionFlags == 0, "Expected Extended ExtensionFlags to be 0, got %lu", extdev->ExtensionFlags);
- ok (extdev->Type == 13, "Expected Type of 13, got %d", extdev->Type);
- ok (extdev->Size == 0, "Expected Size of 0, got %d", extdev->Size);
- ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p",
- DeviceObject, extdev->DeviceObject);
- ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p", extdev->AttachedTo);
- ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu", extdev->StartIoCount);
- ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu", extdev->StartIoKey);
- ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu", extdev->StartIoFlags);
-}
-
-VOID DeviceDeletionTest(PDEVICE_OBJECT DeviceObject, BOOLEAN Lower)
-{
- PEXTENDED_DEVOBJ_EXTENSION extdev;
-
- /*Check the device object members */
- ok(DeviceObject->Type==3, "Expected Type = 3, got %d", DeviceObject->Type);
- ok(DeviceObject->Size = 0xb8, "Expected Size = 0xba, got %d", DeviceObject->Size);
- ok(DeviceObject->ReferenceCount == 0, "Expected ReferenceCount = 0, got %lu",
- DeviceObject->ReferenceCount);
- if (!Lower)
- {
- ok(DeviceObject->DriverObject == ThisDriverObject,
- "Expected DriverObject member to match this DriverObject %p, got %p",
- ThisDriverObject, DeviceObject->DriverObject);
- }
- ok(DeviceObject->NextDevice == NULL, "Expected NextDevice to be NULL, got %p", DeviceObject->NextDevice);
-
- if (Lower)
- {
- ok(DeviceObject->AttachedDevice == MainDeviceObject,
- "Expected AttachDevice to be %p, got %p", MainDeviceObject, DeviceObject->AttachedDevice);
- }
- else
- {
- ok(DeviceObject->AttachedDevice == NULL, "Expected AttachDevice to be NULL, got %p", DeviceObject->AttachedDevice);
- }
-
- ok(DeviceObject->Flags ==FILE_VIRTUAL_VOLUME,
- "Expected Flags FILE_VIRTUAL_VOLUME, got %lu", DeviceObject->Flags);
- ok(DeviceObject->DeviceType == FILE_DEVICE_UNKNOWN,
- "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu",
- DeviceObject->DeviceType);
- ok(DeviceObject->ActiveThreadCount == 0, "Expected ActiveThreadCount = 0, got %lu\n", DeviceObject->ActiveThreadCount);
-
- /*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", extdev->ExtensionFlags);
- ok (extdev->Type == 13, "Expected Type of 13, got %d", extdev->Type);
- ok (extdev->Size == 0, "Expected Size of 0, got %d", extdev->Size);
- ok (extdev->DeviceObject == DeviceObject, "Expected DeviceOject to match newly created device %p, got %p",
- DeviceObject, extdev->DeviceObject);
- if (Lower)
- {
- /* Skip this for now */
- //ok(extdev->AttachedTo == MainDeviceObject, "Expected AttachTo to %p, got %p", MainDeviceObject, extdev->AttachedTo);
- }
- else
- {
- ok(extdev->AttachedTo == NULL, "Expected AttachTo to be NULL, got %p", extdev->AttachedTo);
- }
- ok(extdev->StartIoCount == 0, "Expected StartIoCount = 0, got %lu", extdev->StartIoCount);
- ok(extdev->StartIoKey == 0, "Expected StartIoKey = 0, got %lu", extdev->StartIoKey);
- ok(extdev->StartIoFlags == 0, "Expected StartIoFlags = 0, got %lu", extdev->StartIoFlags);
-}
-
-VOID DeviceCreateDeleteTest(PDRIVER_OBJECT DriverObject)
-{
- NTSTATUS Status;
- UNICODE_STRING DeviceString;
- UNICODE_STRING DosDeviceString;
- PDEVICE_OBJECT DeviceObject;
-
- /* Create using wrong directory */
- RtlInitUnicodeString(&DeviceString, L"\\Device1\\Kmtest");
- Status = IoCreateDevice(DriverObject,
- 0,
- &DeviceString,
- FILE_DEVICE_UNKNOWN,
- 0,
- FALSE,
- &DeviceObject);
- ok(Status == STATUS_OBJECT_PATH_NOT_FOUND, "Expected STATUS_OBJECT_PATH_NOT_FOUND, got 0x%lX", Status);
-
- /* Create using correct params with exlusice access */
- RtlInitUnicodeString(&DeviceString, L"\\Device\\Kmtest");
- Status = IoCreateDevice(DriverObject,
- 0,
- &DeviceString,
- FILE_DEVICE_UNKNOWN,
- 0,
- TRUE,
- &DeviceObject);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
-
- DeviceCreatedTest(DeviceObject, TRUE);
-
- /* Delete the device */
- if (NT_SUCCESS(Status))
- {
- IoDeleteDevice(DeviceObject);
- ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p",
- DriverObject->DeviceObject);
- }
-
- /* Create using correct params with exlusice access */
- Status = IoCreateDevice(DriverObject,
- 0,
- &DeviceString,
- FILE_DEVICE_UNKNOWN,
- 0,
- FALSE,
- &DeviceObject);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
-
- DeviceCreatedTest(DeviceObject, FALSE);
-
- /* Delete the device */
- if (NT_SUCCESS(Status))
- {
- IoDeleteDevice(DeviceObject);
- ok(DriverObject->DeviceObject == 0, "Expected DriverObject->DeviceObject to be NULL, got %p",
- DriverObject->DeviceObject);
- }
-
- /* Recreate device */
- Status = IoCreateDevice(DriverObject,
- 0,
- &DeviceString,
- FILE_DEVICE_UNKNOWN,
- 0,
- FALSE,
- &DeviceObject);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
-
- RtlInitUnicodeString(&DosDeviceString, L"\\DosDevices\\kmtest");
- Status = IoCreateSymbolicLink(&DosDeviceString, &DeviceString);
-
- if (!NT_SUCCESS(Status))
- {
- /* Delete device object if not successful */
- IoDeleteDevice(DeviceObject);
- return;
- }
-
- MainDeviceObject = DeviceObject;
-
- return;
-}
-
-BOOLEAN AttachDeviceTest(PDEVICE_OBJECT DeviceObject, PWCHAR NewDriverRegPath)
-{
- NTSTATUS Status;
- UNICODE_STRING LowerDeviceName;
-
- RtlInitUnicodeString(&LowerDeviceName, NewDriverRegPath);
- Status = IoAttachDevice(DeviceObject, &LowerDeviceName, &AttachDeviceObject);
-
- /* TODO: Add more tests */
-
- return TRUE;
-}
-
-BOOLEAN DetachDeviceTest(PDEVICE_OBJECT AttachedDevice)
-{
-
- IoDetachDevice(AttachedDevice);
-
- /* TODO: Add more tests */
-
- return TRUE;
-}
diff --git a/drivers/kmtest/drvobj_test.c b/drivers/kmtest/drvobj_test.c
deleted file mode 100644
index ad3675a6c2a..00000000000
--- a/drivers/kmtest/drvobj_test.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Driver Regression Tests
- *
- * Copyright 2009 Michael Martin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include "kmtest.h"
-#include
-#include
-
-VOID DriverObjectTest(PDRIVER_OBJECT DriverObject, int DriverStatus)
-{
- BOOLEAN CheckThisDispatchRoutine;
- PVOID FirstMajorFunc;
- int i;
-
- ok(DriverObject->Size == sizeof(DRIVER_OBJECT), "Size does not match, got %x",DriverObject->Size);
- ok(DriverObject->Type == 4, "Type does not match 4. got %d",DriverObject->Type);
-
- if (DriverStatus == 0)
- {
- ok(DriverObject->DeviceObject == NULL, "Expected DeviceObject pointer to be 0, got %p",
- DriverObject->DeviceObject);
- ok (DriverObject->Flags == DRVO_LEGACY_DRIVER,
- "Expected Flags to be DRVO_LEGACY_DRIVER, got %lu",
- DriverObject->Flags);
- }
- else if (DriverStatus == 1)
- {
- ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to non null");
- ok (DriverObject->Flags == (DRVO_LEGACY_DRIVER | DRVO_INITIALIZED),
- "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED, got %lu",
- DriverObject->Flags);
- }
- else
- {
- ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to non null");
- ok (DriverObject->Flags == (DRVO_LEGACY_DRIVER | DRVO_INITIALIZED | DRVO_UNLOAD_INVOKED),
- "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED | DRVO_UNLOAD_INVOKED, got %lu",
- DriverObject->Flags);
- }
-
- /* Select a routine that was not changed */
- FirstMajorFunc = DriverObject->MajorFunction[1];
- ok(FirstMajorFunc != 0, "Expected MajorFunction[1] to be non NULL");
-
- if (FirstMajorFunc)
- {
- for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
- {
- if (DriverStatus > 0) CheckThisDispatchRoutine = (i > 3) && (i != 14);
- else CheckThisDispatchRoutine = TRUE;
-
- if (CheckThisDispatchRoutine)
- {
- ok(DriverObject->MajorFunction[i] == FirstMajorFunc, "Expected MajorFunction[%d] to match %p",
- i, FirstMajorFunc);
- }
- }
- }
- else
- {
- ok(TRUE, "Skipped testing for all MajorFunction");
- }
-}
-
-BOOLEAN ZwLoadTest(PDRIVER_OBJECT DriverObject, PUNICODE_STRING DriverRegistryPath, PWCHAR NewDriverRegPath)
-{
- UNICODE_STRING RegPath;
- NTSTATUS Status;
-
- /* Try to load ourself */
- Status = ZwLoadDriver(DriverRegistryPath);
- ok (Status == STATUS_IMAGE_ALREADY_LOADED, "Expected NTSTATUS STATUS_IMAGE_ALREADY_LOADED, got 0x%lX", Status);
-
- if (Status != STATUS_IMAGE_ALREADY_LOADED)
- {
- DbgPrint("WARNING: Loading this a second time will cause BUGCHECK!\n");
- }
-
- /* Try to load with a Registry Path that doesnt exist */
- RtlInitUnicodeString(&RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
- Status = ZwLoadDriver(&RegPath);
- ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX", Status);
-
- /* Load the driver */
- RtlInitUnicodeString(&RegPath, NewDriverRegPath);
- Status = ZwLoadDriver(&RegPath);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
-
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOLEAN ZwUnloadTest(PDRIVER_OBJECT DriverObject, PUNICODE_STRING DriverRegistryPath, PWCHAR NewDriverRegPath)
-{
- UNICODE_STRING RegPath;
- NTSTATUS Status;
-
- /* Try to unload ourself, which should fail as our Unload routine hasnt been set yet. */
- Status = ZwUnloadDriver(DriverRegistryPath);
- ok (Status == STATUS_INVALID_DEVICE_REQUEST, "Expected NTSTATUS STATUS_INVALID_DEVICE_REQUEST, got 0x%lX", Status);
-
- /* Try to unload with a Registry Path that doesnt exist */
- RtlInitUnicodeString(&RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
- Status = ZwUnloadDriver(&RegPath);
- ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX", Status);
-
- /* Unload the driver */
- RtlInitUnicodeString(&RegPath, NewDriverRegPath);
- Status = ZwUnloadDriver(&RegPath);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX", Status);
-
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/drivers/kmtest/kmtest.c b/drivers/kmtest/kmtest.c
deleted file mode 100644
index 68817e33e67..00000000000
--- a/drivers/kmtest/kmtest.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * Kernel Mode regression Test
- * Driver Core
- *
- * Copyright 2004 Filip Navara
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include
-
-LONG successes;
-LONG failures;
-LONG skipped;
-tls_data glob_data;
-
-/* PRIVATE FUNCTIONS ***********************************************************/
-VOID
-StartTest()
-{
- successes = 0;
- failures = 0;
- skipped = 0;
-}
-
-VOID
-FinishTest(HANDLE KeyHandle, LPWSTR TestName)
-{
- WCHAR KeyName[100];
- LONG total = successes + failures;
- UNICODE_STRING KeyNameU;
-
- wcscpy(KeyName, TestName);
- wcscat(KeyName, L"SuccessCount");
- RtlInitUnicodeString(&KeyNameU, KeyName);
-
- ZwSetValueKey(KeyHandle,
- &KeyNameU,
- 0,
- REG_DWORD,
- &successes,
- sizeof(ULONG));
-
- wcscpy(KeyName, TestName);
- wcscat(KeyName, L"FailureCount");
- RtlInitUnicodeString(&KeyNameU, KeyName);
-
- ZwSetValueKey(KeyHandle,
- &KeyNameU,
- 0,
- REG_DWORD,
- &failures,
- sizeof(ULONG));
-
- wcscpy(KeyName, TestName);
- wcscat(KeyName, L"TotalCount");
- RtlInitUnicodeString(&KeyNameU, KeyName);
-
- ZwSetValueKey(KeyHandle,
- &KeyNameU,
- 0,
- REG_DWORD,
- &total,
- sizeof(ULONG));
-
- wcscpy(KeyName, TestName);
- wcscat(KeyName, L"SkipCount");
- RtlInitUnicodeString(&KeyNameU, KeyName);
-
- ZwSetValueKey(KeyHandle,
- &KeyNameU,
- 0,
- REG_DWORD,
- &skipped,
- sizeof(ULONG));
-
- DbgPrint("%S: %d test executed (0 marked as todo, %d failures), %d skipped.\n", TestName, total, failures, skipped);
-}
-
-void kmtest_set_location(const char* file, int line)
-{
- glob_data.current_file=strrchr(file,'/');
- if (glob_data.current_file==NULL)
- glob_data.current_file=strrchr(file,'\\');
- if (glob_data.current_file==NULL)
- glob_data.current_file=file;
- else
- glob_data.current_file++;
- glob_data.current_line=line;
-}
-
-/*
- * Checks condition.
- * Parameters:
- * - condition - condition to check;
- * - msg test description;
- * - file - test application source code file name of the check
- * - line - test application source code file line number of the check
- * Return:
- * 0 if condition does not have the expected value, 1 otherwise
- */
-int kmtest_ok(int condition, const char *msg, ... )
-{
- va_list valist;
-
- if (!condition)
- {
- if (msg[0])
- {
- char string[1024];
- va_start(valist, msg);
- vsprintf(string, msg, valist);
- DbgPrint( "%s:%d: Test failed: %s\n",
- glob_data.current_file, glob_data.current_line, string );
- va_end(valist);
- }
- else
- {
- DbgPrint( "%s:%d: Test failed\n",
- glob_data.current_file, glob_data.current_line );
- }
- InterlockedIncrement(&failures);
- return 0;
- }
- else
- {/*
- if (report_success)
- fprintf( stdout, "%s:%d: Test succeeded\n",
- glob_data.current_file, glob_data.current_line);*/
- InterlockedIncrement(&successes);
- }
- return 1;
-}
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-PWCHAR CreateLowerDeviceRegistryKey(PUNICODE_STRING RegistryPath, PWCHAR NewDriver);
-
-/*
- * Test Declarations
- */
-VOID RegisterDI_Test(HANDLE KeyHandle);
-VOID NtoskrnlIoMdlTest(HANDLE KeyHandle);
-VOID NtoskrnlIoIrpTest(HANDLE KeyHandle);
-VOID NtoskrnlObTest(HANDLE KeyHandle);
-VOID ExTimerTest(HANDLE KeyHandle);
-VOID PoolsTest(HANDLE KeyHandle);
-VOID PoolsCorruption(HANDLE KeyHandle);
-VOID KeStallTest(HANDLE KeyHandle);
-VOID DriverObjectTest(PDRIVER_OBJECT, int);
-VOID DeviceCreateDeleteTest(PDRIVER_OBJECT);
-VOID DeviceObjectTest(PDEVICE_OBJECT);
-BOOLEAN ZwLoadTest(PDRIVER_OBJECT, PUNICODE_STRING, PWCHAR);
-BOOLEAN ZwUnloadTest(PDRIVER_OBJECT, PUNICODE_STRING, PWCHAR);
-BOOLEAN DetachDeviceTest(PDEVICE_OBJECT);
-BOOLEAN AttachDeviceTest(PDEVICE_OBJECT, PWCHAR);
-VOID LowerDeviceKernelAPITest(PDEVICE_OBJECT, BOOLEAN);
-VOID NtoskrnlFsRtlTest(HANDLE KeyHandle);
-
-typedef enum {
- TestStageExTimer = 0,
- TestStageIoMdl,
- TestStageIoDi,
- TestStageIoIrp,
- TestStageMmPoolTest,
- TestStageMmPoolCorruption,
- TestStageOb,
- TestStageKeStall,
- TestStageDrv,
- TestStageFsRtl,
- TestStageMax
-} TEST_STAGE;
-
-/*
- * KmtestDispatch
- */
-NTSTATUS
-NTAPI
-KmtestDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
-
-{
- NTSTATUS Status = STATUS_SUCCESS;
-
- if (AttachDeviceObject)
- {
- IoSkipCurrentIrpStackLocation(Irp);
- Status = IoCallDriver(AttachDeviceObject, Irp);
- return Status;
- }
-
- Irp->IoStatus.Status = Status;
- Irp->IoStatus.Information = 0;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return Status;
-}
-
-/*
- * KmtestCreateClose
- */
-NTSTATUS
-NTAPI
-KmtestCreateClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
-{
- NTSTATUS Status = STATUS_SUCCESS;
-
- if (AttachDeviceObject)
- {
- IoSkipCurrentIrpStackLocation(Irp);
- Status = IoCallDriver(AttachDeviceObject, Irp);
- return Status;
- }
-
- /* Do DriverObject Test with Driver Initialized */
- DriverObjectTest(DeviceObject->DriverObject, 1);
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information=0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
-}
-
-/*
- * KmtestUnload
- */
-VOID
-NTAPI
-KmtestUnload(IN PDRIVER_OBJECT DriverObject)
-{
- UNICODE_STRING DosDeviceString;
-
- if(AttachDeviceObject)
- {
- IoDetachDevice(AttachDeviceObject);
- }
-
- /* Do DriverObject Test for Unload */
- DriverObjectTest(DriverObject, 2);
-
- if (MainDeviceObject)
- {
- RtlInitUnicodeString(&DosDeviceString, L"\\DosDevices\\Kmtest");
- IoDeleteSymbolicLink(&DosDeviceString);
-
- IoDeleteDevice(MainDeviceObject);
- }
-}
-
-static
-PKEY_VALUE_PARTIAL_INFORMATION
-NTAPI
-ReadRegistryValue(HANDLE KeyHandle, PWCHAR ValueName)
-{
- NTSTATUS Status;
- PKEY_VALUE_PARTIAL_INFORMATION InformationBuffer = NULL;
- ULONG AllocatedLength = 0, RequiredLength = 0;
- UNICODE_STRING ValueNameU;
-
- RtlInitUnicodeString(&ValueNameU, ValueName);
-
- Status = ZwQueryValueKey(KeyHandle,
- &ValueNameU,
- KeyValuePartialInformation,
- NULL,
- 0,
- &RequiredLength);
- if (Status == STATUS_BUFFER_TOO_SMALL || Status == STATUS_BUFFER_OVERFLOW)
- {
- InformationBuffer = ExAllocatePool(PagedPool, RequiredLength);
- AllocatedLength = RequiredLength;
- if (!InformationBuffer) return NULL;
-
- Status = ZwQueryValueKey(KeyHandle,
- &ValueNameU,
- KeyValuePartialInformation,
- InformationBuffer,
- AllocatedLength,
- &RequiredLength);
- }
-
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to read %S (0x%x)\n", ValueName, Status);
- if (InformationBuffer != NULL)
- ExFreePool(InformationBuffer);
- return NULL;
- }
-
- return InformationBuffer;
-}
-
-static
-VOID
-RunKernelModeTest(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath,
- HANDLE KeyHandle,
- TEST_STAGE Stage)
-{
- UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"CurrentStage");
- PWCHAR LowerDriverRegPath;
-
- DPRINT1("Running stage %d test...\n", Stage);
-
- ZwSetValueKey(KeyHandle,
- &KeyName,
- 0,
- REG_DWORD,
- &Stage,
- sizeof(ULONG));
-
- switch (Stage)
- {
- case TestStageExTimer:
- ExTimerTest(KeyHandle);
- break;
-
- case TestStageIoMdl:
- NtoskrnlIoMdlTest(KeyHandle);
- break;
-
- case TestStageIoDi:
- RegisterDI_Test(KeyHandle);
- break;
-
- case TestStageIoIrp:
- NtoskrnlIoIrpTest(KeyHandle);
- break;
-
- case TestStageMmPoolTest:
- PoolsTest(KeyHandle);
- break;
-
- case TestStageMmPoolCorruption:
- PoolsCorruption(KeyHandle);
- break;
-
- case TestStageOb:
- NtoskrnlObTest(KeyHandle);
- break;
-
- case TestStageKeStall:
- KeStallTest(KeyHandle);
- break;
-
- case TestStageDrv:
- /* Start the tests for the driver routines */
- StartTest();
-
- /* Do DriverObject Test for Driver Entry */
- DriverObjectTest(DriverObject, 0);
-
- /* Create and delete device, on return MainDeviceObject has been created */
- DeviceCreateDeleteTest(DriverObject);
-
- /* Make sure a device object was created */
- if (MainDeviceObject)
- {
- LowerDriverRegPath = CreateLowerDeviceRegistryKey(RegistryPath, L"kmtestassist");
-
- if (LowerDriverRegPath)
- {
- /* Load driver test and load the lower driver */
- if (ZwLoadTest(DriverObject, RegistryPath, LowerDriverRegPath))
- {
- AttachDeviceTest(MainDeviceObject, L"kmtestassists");
- if (AttachDeviceObject)
- {
- LowerDeviceKernelAPITest(MainDeviceObject, FALSE);
- }
-
- /* Unload lower driver without detaching from its device */
- ZwUnloadTest(DriverObject, RegistryPath, LowerDriverRegPath);
- LowerDeviceKernelAPITest(MainDeviceObject, TRUE);
- }
- else
- {
- DbgPrint("Failed to load kmtestassist driver\n");
- }
- }
- }
-
- FinishTest(KeyHandle, L"DriverTest");
- break;
-
- case TestStageFsRtl:
- NtoskrnlFsRtlTest(KeyHandle);
- break;
-
- default:
- ASSERT(FALSE);
- break;
- }
-}
-
-/*
- * DriverEntry
- */
-NTSTATUS
-NTAPI
-DriverEntry(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
-{
- int i;
- NTSTATUS Status;
- OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING ParameterKeyName = RTL_CONSTANT_STRING(L"Parameters");
- PKEY_VALUE_PARTIAL_INFORMATION KeyInfo;
- PULONG KeyValue;
- TEST_STAGE CurrentStage;
- HANDLE DriverKeyHandle, ParameterKeyHandle;
-
- DbgPrint("\n===============================================\n");
- DbgPrint("Kernel Mode Regression Driver Test starting...\n");
- DbgPrint("===============================================\n");
-
- InitializeObjectAttributes(&ObjectAttributes,
- RegistryPath,
- OBJ_CASE_INSENSITIVE,
- 0,
- NULL);
-
- Status = ZwOpenKey(&DriverKeyHandle,
- KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS,
- &ObjectAttributes);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to open %wZ\n", RegistryPath);
- return Status;
- }
-
- InitializeObjectAttributes(&ObjectAttributes,
- &ParameterKeyName,
- OBJ_OPENIF | OBJ_CASE_INSENSITIVE,
- DriverKeyHandle,
- NULL);
- Status = ZwCreateKey(&ParameterKeyHandle,
- KEY_SET_VALUE | KEY_QUERY_VALUE,
- &ObjectAttributes,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- NULL);
- ZwClose(DriverKeyHandle);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to create %wZ\\%wZ\n", RegistryPath, &ParameterKeyName);
- return Status;
- }
-
- KeyInfo = ReadRegistryValue(ParameterKeyHandle, L"CurrentStage");
- if (KeyInfo)
- {
- if (KeyInfo->DataLength != sizeof(ULONG))
- {
- DPRINT1("Invalid data length for CurrentStage: %d\n", KeyInfo->DataLength);
- ExFreePool(KeyInfo);
- return STATUS_UNSUCCESSFUL;
- }
-
- KeyValue = (PULONG)KeyInfo->Data;
-
- if ((*KeyValue) + 1 < TestStageMax)
- {
- DPRINT1("Resuming testing after a crash at stage %d\n", (*KeyValue));
-
- CurrentStage = (TEST_STAGE)((*KeyValue) + 1);
- }
- else
- {
- DPRINT1("Testing was completed on a previous boot\n");
- ExFreePool(KeyInfo);
- return STATUS_UNSUCCESSFUL;
- }
-
- ExFreePool(KeyInfo);
- }
- else
- {
- DPRINT1("Starting a fresh test\n");
- CurrentStage = (TEST_STAGE)0;
- }
-
- /* Run the tests */
- while (CurrentStage < TestStageMax)
- {
- RunKernelModeTest(DriverObject,
- RegistryPath,
- ParameterKeyHandle,
- CurrentStage);
- CurrentStage++;
- }
-
- DPRINT1("Testing is complete!\n");
- ZwClose(ParameterKeyHandle);
-
- /* Set all MajorFunctions to NULL to verify that kernel fixes them */
- for (i = 1; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
- DriverObject->MajorFunction[i] = NULL;
-
- /* Set necessary routines */
- DriverObject->DriverUnload = KmtestUnload;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = KmtestDispatch;
- DriverObject->MajorFunction[IRP_MJ_CREATE] = KmtestCreateClose;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = KmtestCreateClose;
-
- return STATUS_SUCCESS;
-}
diff --git a/drivers/kmtest/kmtest.h b/drivers/kmtest/kmtest.h
deleted file mode 100644
index eb02766f522..00000000000
--- a/drivers/kmtest/kmtest.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef KMTEST_H
-#define KMTEST_H
-
-#include
-#include
-#include
-#include "ntddk.h"
-
-
-/*
- Some macros, structs, and vars are based or inspired from the great
- Wine regression tests Copyright (C) 2002 Alexandre Julliard.
- Everything else is done by Aleksey Bragin based on PnPTest by Filip Navara
-*/
-
-extern LONG successes; /* number of successful tests */
-extern LONG failures; /* number of failures */
-//static ULONG todo_successes; /* number of successful tests inside todo block */
-//static ULONG todo_failures; /* number of failures inside todo block */
-
-// We don't do multithreading, so we just keep this struct in a global var
-typedef struct
-{
- const char* current_file; /* file of current check */
- int current_line; /* line of current check */
- int todo_level; /* current todo nesting level */
- int todo_do_loop;
-} tls_data;
-
-extern tls_data glob_data;
-
-VOID StartTest(VOID);
-VOID FinishTest(HANDLE KeyHandle, LPWSTR TestName);
-void kmtest_set_location(const char* file, int line);
-
-#ifdef __GNUC__
-
-extern int kmtest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
-
-#else /* __GNUC__ */
-
-extern int kmtest_ok( int condition, const char *msg, ... );
-
-#endif /* __GNUC__ */
-
-
-#define ok_(file, line) (kmtest_set_location(file, line), 0) ? (void)0 : kmtest_ok
-#define ok ok_(__FILE__, __LINE__)
-
-PDEVICE_OBJECT AttachDeviceObject;
-PDEVICE_OBJECT MainDeviceObject;
-PDRIVER_OBJECT ThisDriverObject;
-
-#endif /* KMTEST_H */
diff --git a/drivers/kmtest/kmtest.rbuild b/drivers/kmtest/kmtest.rbuild
deleted file mode 100644
index 1ef7e3d405b..00000000000
--- a/drivers/kmtest/kmtest.rbuild
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- include/reactos/drivers
- ntoskrnl
- hal
- pseh
- kmtest.c
- deviface_test.c
- drvobj_test.c
- devobj_test.c
- reghelper.c
- ntos_ex.c
- ntos_io.c
- ntos_ke.c
- ntos_ob.c
- ntos_pools.c
- ntos_fsrtl.c
- kmtest.rc
-
diff --git a/drivers/kmtest/kmtest.rc b/drivers/kmtest/kmtest.rc
deleted file mode 100644
index fa44c9352c1..00000000000
--- a/drivers/kmtest/kmtest.rc
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $Id: csqtest.rc 21842 2006-05-07 19:16:11Z ion $ */
-
-#define REACTOS_VERSION_DLL
-#define REACTOS_STR_FILE_DESCRIPTION "Kernel Mode Regression Tests\0"
-#define REACTOS_STR_INTERNAL_NAME "kmtest\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "kmtest.sys\0"
-#include
diff --git a/drivers/kmtest/kmtestassist.c b/drivers/kmtest/kmtestassist.c
deleted file mode 100644
index eaa3bfc7e35..00000000000
--- a/drivers/kmtest/kmtestassist.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Driver Regression Tests
- *
- * Copyright 2009 Michael Martin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include "ntddk.h"
-#include "ntddser.h"
-
-NTSTATUS
-NTAPI
-DriverDispatch(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
-{
- DbgPrint(" ControlCode %x\n",IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.IoControlCode);
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information=0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-DriverCreateClose(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
-{
- Irp->IoStatus.Status = STATUS_SUCCESS;
- Irp->IoStatus.Information = 0;
-
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return STATUS_SUCCESS;
-}
-
-VOID
-NTAPI
-DriverUnload(IN PDRIVER_OBJECT DriverObject)
-{
- UNICODE_STRING DeviceString;
-
- RtlInitUnicodeString(&DeviceString, L"\\DosDevices\\kmtestassist");
- IoDeleteSymbolicLink(&DeviceString);
-
- IoDeleteDevice(DriverObject->DeviceObject);
-}
-
-NTSTATUS
-NTAPI
-DriverEntry(IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING path)
-{
- PDEVICE_OBJECT pDeviceObject;
- UNICODE_STRING DriverString;
- UNICODE_STRING DeviceString;
-
- NTSTATUS Status= STATUS_DEVICE_CONFIGURATION_ERROR;
-
- RtlInitUnicodeString(&DriverString, L"\\Device\\kmtestassist");
-
- Status = IoCreateDevice(DriverObject,0,&DriverString,FILE_DEVICE_UNKNOWN,0,FALSE,&pDeviceObject);
- if (!NT_SUCCESS(Status))
- {
- return Status;
- }
-
- RtlInitUnicodeString(&DeviceString, L"\\DosDevices\\kmtestassist");
-
- Status = IoCreateSymbolicLink(&DeviceString, &DriverString);
- if (!NT_SUCCESS(Status))
- {
- // Delete device object if not successful
- IoDeleteDevice(pDeviceObject);
- return Status;
- }
-
- DriverObject->DriverUnload = DriverUnload;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverDispatch;
- DriverObject->MajorFunction[IRP_MJ_CREATE] = DriverCreateClose;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverCreateClose;
-
- return Status;
-}
diff --git a/drivers/kmtest/kmtestassist.rbuild b/drivers/kmtest/kmtestassist.rbuild
deleted file mode 100644
index c50f7bf89e1..00000000000
--- a/drivers/kmtest/kmtestassist.rbuild
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- include/reactos/drivers
- ntoskrnl
- hal
- kmtestassist.c
-
diff --git a/drivers/kmtest/ntos_ex.c b/drivers/kmtest/ntos_ex.c
deleted file mode 100644
index 8edf7fec1a8..00000000000
--- a/drivers/kmtest/ntos_ex.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * NTOSKRNL Executive Regressions KM-Test
- * ReactOS Kernel Mode Regression Testing framework
- *
- * Copyright 2006 Aleksey Bragin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-/* PRIVATE FUNCTIONS ***********************************************************/
-
-VOID
-NTAPI
-TestTimerApcRoutine(IN PVOID TimerContext,
- IN ULONG TimerLowValue,
- IN LONG TimerHighValue)
-
-{
- ULONG *ApcCount = (ULONG *)TimerContext;
- DPRINT("Timer Apc called!\n");
- (*ApcCount)++;
-}
-
-/* PUBLIC FUNCTIONS *************************************************************/
-
-VOID
-ExTimerTest(HANDLE KeyHandle)
-{
- UNICODE_STRING TimerName;
- OBJECT_ATTRIBUTES ObjectAttributes;
- HANDLE TimerHandle;
- HANDLE HandleOpened;
- LARGE_INTEGER DueTime;
- BOOLEAN PreviousState, CurrentState;
- NTSTATUS Status;
- ULONG ApcCount;
-
- StartTest();
-
- // Create the timer
- RtlInitUnicodeString(&TimerName, L"\\TestTimer");
- InitializeObjectAttributes(&ObjectAttributes, &TimerName, 0, NULL, NULL);
- Status = ZwCreateTimer(&TimerHandle, TIMER_ALL_ACCESS,
- &ObjectAttributes, NotificationTimer);
- ok(Status == STATUS_SUCCESS, "ZwCreateTimer failed with Status=0x%08lX", Status);
-
- // Open the timer
- Status = ZwOpenTimer(&HandleOpened, TIMER_ALL_ACCESS, &ObjectAttributes);
- ok(Status == STATUS_SUCCESS, "ZwOpenTimer failed with Status=0x%08lX", Status);
-
- // Set the timer, to some rather high value so it doesn't expire
- DPRINT("Set timer 1\n");
- DueTime.LowPart = -10000;
- DueTime.HighPart = -10;
- PreviousState = TRUE;
- Status = ZwSetTimer(HandleOpened, &DueTime, NULL, NULL, FALSE, 0L, &PreviousState);
- ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
- ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
-
- // Cancel the timer
- CurrentState = TRUE;
- Status = ZwCancelTimer(HandleOpened, &CurrentState);
- ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
- ok(CurrentState == FALSE, "Incorrect CurrentState returned when canceling the timer");
-
- // Set the timer to some small value, because we'll wait for it to expire
- DPRINT("Set timer 2\n");
- DueTime.LowPart = -100;
- DueTime.HighPart = -1;
- PreviousState = TRUE;
- Status = ZwSetTimer(HandleOpened, &DueTime, NULL, NULL, FALSE, 0L, &PreviousState);
- ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
- ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
-
- // Wait until it expires
- DPRINT("Wait till timer expires\n");
- Status = ZwWaitForSingleObject(HandleOpened, FALSE, NULL);
- ok(Status == STATUS_SUCCESS, "ZwWaitForSingleObject failed with Status=0x%08lX", Status);
-
- // And cancel it
- DPRINT("Cancel it\n");
- CurrentState = FALSE;
- Status = ZwCancelTimer(HandleOpened, &CurrentState);
- ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
- ok(CurrentState == TRUE, "Incorrect CurrentState returned when setting the timer");
-
- // Test it with APC: Set, Cancel, check if APC has been called
- DPRINT("Set timer with Apc (3)\n");
- ApcCount = 0;
- DueTime.LowPart = -10000;
- DueTime.HighPart = -10;
- PreviousState = FALSE;
- Status = ZwSetTimer(HandleOpened, &DueTime,
- (PTIMER_APC_ROUTINE)TestTimerApcRoutine, &ApcCount, FALSE,
- 0L, &PreviousState);
-
- ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
- ok(PreviousState == TRUE, "Incorrect PreviousState returned when setting the timer");
-
- DPRINT("Cancel it\n");
- CurrentState = TRUE;
- Status = ZwCancelTimer(HandleOpened, &CurrentState);
- ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
- ok(CurrentState == FALSE, "Incorrect CurrentState returned when cancelling the timer");
- ok(ApcCount == 0, "Incorrect count of TimerApcRoutine calls: %ld, should be 0\n", ApcCount);
-
- // Test setting the timer two times in a row, APC routine must not be called
- DPRINT("Set timer with Apc (4)\n");
- ApcCount = 0;
- DueTime.LowPart = -10000;
- DueTime.HighPart = -10;
- PreviousState = TRUE;
- Status = ZwSetTimer(HandleOpened, &DueTime,
- (PTIMER_APC_ROUTINE)TestTimerApcRoutine, &ApcCount, FALSE,
- 0L, &PreviousState);
- ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
- ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
-
- // Set small due time, since we have to wait for timer to finish
- DPRINT("Set timer with Apc (5)\n");
- DueTime.LowPart = -10;
- DueTime.HighPart = -1;
- PreviousState = TRUE;
- Status = ZwSetTimer(HandleOpened, &DueTime,
- (PTIMER_APC_ROUTINE)TestTimerApcRoutine, &ApcCount, FALSE,
- 0L, &PreviousState);
- ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
- ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
-
- // Now wait till it's finished, and then check APC call
- DPRINT("Wait for it\n");
- Status = ZwWaitForSingleObject(HandleOpened, FALSE, NULL);
- ok(Status == STATUS_SUCCESS, "ZwWaitForSingleObject failed with Status=0x%08lX", Status);
-
- CurrentState = FALSE;
- Status = ZwCancelTimer(HandleOpened, &CurrentState);
- ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
- ok(CurrentState == TRUE, "Incorrect CurrentState returned when cancelling the timer");
- ok(ApcCount == 1, "Incorrect count of TimerApcRoutine calls: %ld, should be 1\n", ApcCount);
-
- // Cleanup...
- Status = ZwClose(HandleOpened);
- ok(Status == STATUS_SUCCESS, "ZwClose failed with Status=0x%08lX", Status);
-
- Status = ZwClose(TimerHandle);
- ok(Status == STATUS_SUCCESS, "ZwClose failed with Status=0x%08lX", Status);
-
- FinishTest(KeyHandle, L"ExTimerTest");
-}
diff --git a/drivers/kmtest/ntos_fsrtl.c b/drivers/kmtest/ntos_fsrtl.c
deleted file mode 100644
index 5eef05afdd7..00000000000
--- a/drivers/kmtest/ntos_fsrtl.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * FsRtl Test
- *
- * Copyright 2010 Pierre Schweitzer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include "kmtest.h"
-#include
-
-#define NDEBUG
-#include "debug.h"
-
-/* PRIVATE FUNCTIONS **********************************************************/
-
-VOID FsRtlIsNameInExpressionTest()
-{
- UNICODE_STRING Expression, Name;
-
- RtlInitUnicodeString(&Expression, L"*");
- RtlInitUnicodeString(&Name, L"");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"ntdll.dll");
- RtlInitUnicodeString(&Name, L".");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"~1");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"..");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"ntdll.dll");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"smss.exe");
- RtlInitUnicodeString(&Name, L".");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"~1");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"..");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"ntdll.dll");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"NTDLL.dll");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"nt??krnl.???");
- RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"he*o");
- RtlInitUnicodeString(&Name, L"hello");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"helo");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"hella");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"he*");
- RtlInitUnicodeString(&Name, L"hello");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"helo");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"hella");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"*.cpl");
- RtlInitUnicodeString(&Name, L"kdcom.dll");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"bootvid.dll");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L".");
- RtlInitUnicodeString(&Name, L"NTDLL.DLL");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"F0_*.*");
- RtlInitUnicodeString(&Name, L".");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"..");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"SETUP.EXE");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"F0_001");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"*.TTF");
- RtlInitUnicodeString(&Name, L".");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"..");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"SETUP.INI");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"*");
- RtlInitUnicodeString(&Name, L".");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"..");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"SETUP.INI");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"\"ntoskrnl.exe");
- RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"ntoskrnl\"exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"ntoskrn\".exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"ntoskrn\"\"exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"ntoskrnl.\"exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"ntoskrnl.exe\"");
- RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"ntoskrnl.exe.");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitUnicodeString(&Expression, L"*.c.d");
- RtlInitUnicodeString(&Name, L"a.b.c.d");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"*.?.c.d");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"*?");
- RtlInitUnicodeString(&Name, L"");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"a");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"aa");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"aaa");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"?*?");
- RtlInitUnicodeString(&Name, L"");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"a");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Name, L"aa");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"aaa");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Name, L"aaaa");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
-
- /* Tests from #5923 */
- RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\**");
- RtlInitUnicodeString(&Name, L"C:\\ReactOS\\dings.bmp");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\***");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
- RtlInitUnicodeString(&Expression, L"C:\\Windows\\*a*");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\*.bmp");
- RtlInitUnicodeString(&Name, L"C:\\Windows\\explorer.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
- RtlInitUnicodeString(&Expression, L"*.bmp;*.dib");
- RtlInitUnicodeString(&Name, L"winhlp32.exe");
- ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
-}
-
-VOID FsRtlIsDbcsInExpressionTest()
-{
- ANSI_STRING Expression, Name;
-
- RtlInitAnsiString(&Expression, "*");
- RtlInitAnsiString(&Name, "");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "ntdll.dll");
- RtlInitAnsiString(&Name, ".");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "~1");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "..");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "ntdll.dll");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "smss.exe");
- RtlInitAnsiString(&Name, ".");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "~1");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "..");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "ntdll.dll");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "NTDLL.dll");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "nt??krnl.???");
- RtlInitAnsiString(&Name, "ntoskrnl.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "he*o");
- RtlInitAnsiString(&Name, "hello");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "helo");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "hella");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "he*");
- RtlInitAnsiString(&Name, "hello");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "helo");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "hella");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "*.cpl");
- RtlInitAnsiString(&Name, "kdcom.dll");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "bootvid.dll");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "ntoskrnl.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, ".");
- RtlInitAnsiString(&Name, "NTDLL.DLL");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "F0_*.*");
- RtlInitAnsiString(&Name, ".");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "..");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "SETUP.EXE");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "F0_001");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "*.TTF");
- RtlInitAnsiString(&Name, ".");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "..");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "SETUP.INI");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "*");
- RtlInitAnsiString(&Name, ".");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "..");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "SETUP.INI");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "\"ntoskrnl.exe");
- RtlInitAnsiString(&Name, "ntoskrnl.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "ntoskrnl\"exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "ntoskrn\".exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "ntoskrn\"\"exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "ntoskrnl.\"exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "ntoskrnl.exe\"");
- RtlInitAnsiString(&Name, "ntoskrnl.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "ntoskrnl.exe.");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- RtlInitAnsiString(&Expression, "*.c.d");
- RtlInitAnsiString(&Name, "a.b.c.d");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "*.?.c.d");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "*?");
- RtlInitAnsiString(&Name, "");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "a");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "aa");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "aaa");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "?*?");
- RtlInitAnsiString(&Name, "");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "a");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Name, "aa");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "aaa");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Name, "aaaa");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
-
- /* Tests from #5923 */
- RtlInitAnsiString(&Expression, "C:\\ReactOS\\**");
- RtlInitAnsiString(&Name, "C:\\ReactOS\\dings.bmp");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "C:\\ReactOS\\***");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE");
- RtlInitAnsiString(&Expression, "C:\\Windows\\*a*");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-
- RtlInitAnsiString(&Expression, "C:\\ReactOS\\*.bmp");
- RtlInitAnsiString(&Name, "C:\\Windows\\explorer.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
- RtlInitAnsiString(&Expression, "*.bmp;*.dib");
- RtlInitAnsiString(&Name, "winhlp32.exe");
- ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE");
-}
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID
-NtoskrnlFsRtlTest(HANDLE KeyHandle)
-{
- StartTest();
-
- FsRtlIsNameInExpressionTest();
- FsRtlIsDbcsInExpressionTest();
-
- FinishTest(KeyHandle, L"FsRtlTest");
-}
diff --git a/drivers/kmtest/ntos_io.c b/drivers/kmtest/ntos_io.c
deleted file mode 100644
index f450ebfaef8..00000000000
--- a/drivers/kmtest/ntos_io.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * NTOSKRNL Io Regressions KM-Test
- * ReactOS Kernel Mode Regression Testing framework
- *
- * Copyright 2006 Aleksey Bragin
- * Copyright 2008 Etersoft (Alexander Morozov)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID NtoskrnlIoMdlTest(HANDLE KeyHandle)
-{
- PMDL Mdl;
- PIRP Irp;
- PVOID VirtualAddress;
- ULONG MdlSize = 2*4096+184; // 2 pages and some random value
-
- StartTest();
-
- // Try to alloc 2Gb MDL
- Mdl = IoAllocateMdl(NULL, 2048UL*0x100000, FALSE, FALSE, NULL);
-
- ok(Mdl == NULL,
- "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X",
- (UINT_PTR)Mdl);
-
- if (Mdl)
- IoFreeMdl(Mdl);
-
- // Now create a valid MDL
- VirtualAddress = ExAllocatePool(NonPagedPool, MdlSize);
- Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, NULL);
- ok(Mdl != NULL, "Mdl allocation failed");
- // Check fields of the allocated struct
- ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X",
- (UINT_PTR)Mdl->Next);
- ok(Mdl->ByteCount == MdlSize,
- "Mdl->ByteCount should be equal to MdlSize, but is 0x%X",
- (UINT_PTR)Mdl->ByteCount);
- // TODO: Check other fields of MDL struct
-
- IoFreeMdl(Mdl);
- // Allocate now with pointer to an Irp
- Irp = IoAllocateIrp(1, FALSE);
- ok(Irp != NULL, "IRP allocation failed");
- Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, Irp);
- ok(Mdl != NULL, "Mdl allocation failed");
- ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X",
- (UINT_PTR)Mdl, (UINT_PTR)Irp->MdlAddress);
-
- IoFreeMdl(Mdl);
-
- // TODO: Check a case when SecondaryBuffer == TRUE
-
- IoFreeIrp(Irp);
- ExFreePool(VirtualAddress);
-
- FinishTest(KeyHandle, L"IoMdlTest");
-}
-
-VOID NtoskrnlIoIrpTest(HANDLE KeyHandle)
-{
- USHORT size;
- IRP *iorp;
-
- StartTest();
-
- // 1st test
- size = sizeof(IRP) + 5 * sizeof(IO_STACK_LOCATION);
- iorp = ExAllocatePool(NonPagedPool, size);
-
- if (NULL != iorp)
- {
- IoInitializeIrp(iorp, size, 5);
-
- ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
- ok(iorp->Size == size, "Irp size should be %d, but got %d\n",
- iorp->Size, size);
- ok(5 == iorp->StackCount, "Irp StackCount should be 5, but got %d\n",
- iorp->StackCount);
- ok(6 == iorp->CurrentLocation, "Irp CurrentLocation should be 6, but got %d\n",
- iorp->CurrentLocation);
- ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
- ok ((PIO_STACK_LOCATION)(iorp + 1) + 5 ==
- iorp->Tail.Overlay.CurrentStackLocation,
- "CurrentStackLocation mismatch\n");
-
- ExFreePool(iorp);
- }
-
- // 2nd test
- size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
- iorp = IoAllocateIrp(2, FALSE);
-
- if (NULL != iorp)
- {
- ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
- ok(iorp->Size >= size,
- "Irp size should be more or equal to %d, but got %d\n",
- iorp->Size, size);
- ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
- iorp->StackCount);
- ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
- iorp->CurrentLocation);
- ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
- ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
- iorp->Tail.Overlay.CurrentStackLocation,
- "CurrentStackLocation mismatch\n");
- ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
- "IRP Allocation flags lack fixed size attribute\n");
- ok(!(IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
- "IRP Allocation flags should not have lookaside allocation\n");
-
- IoFreeIrp(iorp);
- }
-
- // 3rd test
- size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
- iorp = IoAllocateIrp(2, TRUE);
-
- if (NULL != iorp)
- {
- ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
- ok(iorp->Size >= size,
- "Irp size should be more or equal to %d, but got %d\n",
- iorp->Size, size);
- ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
- iorp->StackCount);
- ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
- iorp->CurrentLocation);
- ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
- ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
- iorp->Tail.Overlay.CurrentStackLocation,
- "CurrentStackLocation mismatch\n");
- ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
- "IRP Allocation flags lack fixed size attribute\n");
- ok((IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
- "IRP Allocation flags lack lookaside allocation\n");
-
- IoFreeIrp(iorp);
- }
-
- FinishTest(KeyHandle, L"IoIrpTest");
-}
diff --git a/drivers/kmtest/ntos_ke.c b/drivers/kmtest/ntos_ke.c
deleted file mode 100644
index d59eeb3a00f..00000000000
--- a/drivers/kmtest/ntos_ke.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * NTOSKRNL Executive Regressions KM-Test
- * ReactOS Kernel Mode Regression Testing framework
- *
- * Copyright 2006 Aleksey Bragin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID
-KeStallTest(HANDLE KeyHandle)
-{
- ULONG i;
- LARGE_INTEGER TimeStart, TimeFinish;
-
- StartTest();
-
- DPRINT1("Waiting for 30 secs with 50us stalls...\n");
- KeQuerySystemTime(&TimeStart);
- for (i = 0; i < (30*1000*20); i++)
- {
- KeStallExecutionProcessor(50);
- }
- KeQuerySystemTime(&TimeFinish);
- DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
-
- DPRINT1("Waiting for 30 secs with 1000us stalls...\n");
- KeQuerySystemTime(&TimeStart);
- for (i = 0; i < (30*1000); i++)
- {
- KeStallExecutionProcessor(1000);
- }
- KeQuerySystemTime(&TimeFinish);
- DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
-
- DPRINT1("Waiting for 30 secs with 1us stalls...\n");
- KeQuerySystemTime(&TimeStart);
- for (i = 0; i < (30*1000*1000); i++)
- {
- KeStallExecutionProcessor(1);
- }
- KeQuerySystemTime(&TimeFinish);
- DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 43
-
- DPRINT1("Waiting for 30 secs with one huge stall...\n");
- KeQuerySystemTime(&TimeStart);
- KeStallExecutionProcessor(30*1000000);
- KeQuerySystemTime(&TimeFinish);
- DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30
-
- FinishTest(KeyHandle, L"KeStallmanExecutionTest");
-}
diff --git a/drivers/kmtest/ntos_ob.c b/drivers/kmtest/ntos_ob.c
deleted file mode 100644
index 9f5f71c9f26..00000000000
--- a/drivers/kmtest/ntos_ob.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * NTOSKRNL Ob Regressions KM-Test
- * ReactOS Kernel Mode Regression Testing framework
- *
- * Copyright 2006 Aleksey Bragin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-#include "ntndk.h"
-
-// I ment to make this test scalable, but for now
-// we work with two object types only
-#define NUM_OBTYPES 2
-
-typedef struct _MY_OBJECT1
-{
- ULONG Something1;
-} MY_OBJECT1, *PMY_OBJECT1;
-
-typedef struct _MY_OBJECT2
-{
- ULONG Something1;
- ULONG SomeLong[10];
-} MY_OBJECT2, *PMY_OBJECT2;
-
-POBJECT_TYPE ObTypes[NUM_OBTYPES];
-UNICODE_STRING ObTypeName[NUM_OBTYPES];
-UNICODE_STRING ObName[NUM_OBTYPES];
-OBJECT_TYPE_INITIALIZER ObTypeInitializer[NUM_OBTYPES];
-UNICODE_STRING ObDirectoryName;
-OBJECT_ATTRIBUTES ObDirectoryAttributes;
-OBJECT_ATTRIBUTES ObAttributes[NUM_OBTYPES];
-PVOID ObBody[NUM_OBTYPES];
-PMY_OBJECT1 ObObject1;
-PMY_OBJECT2 ObObject2;
-HANDLE ObHandle1[NUM_OBTYPES];
-HANDLE ObHandle2[NUM_OBTYPES];
-HANDLE DirectoryHandle;
-
-USHORT DumpCount, OpenCount, CloseCount, DeleteCount,
- ParseCount, OkayToCloseCount, QueryNameCount;
-
-/* PRIVATE FUNCTIONS **********************************************************/
-
-VOID
-NTAPI
-DumpProc(IN PVOID Object,
- IN POB_DUMP_CONTROL DumpControl)
-{
- DbgPrint("DumpProc() called\n");
- DumpCount++;
-}
-
-// Tested in Win2k3
-VOID
-NTAPI
-OpenProc(IN OB_OPEN_REASON OpenReason,
- IN PEPROCESS Process,
- IN PVOID Object,
- IN ACCESS_MASK GrantedAccess,
- IN ULONG HandleCount)
-{
- DbgPrint("OpenProc() 0x%p, OpenReason %d, HC %d, AM 0x%X\n",
- Object, OpenReason, HandleCount, GrantedAccess);
- OpenCount++;
-}
-
-// Tested in Win2k3
-VOID
-NTAPI
-CloseProc(IN PEPROCESS Process,
- IN PVOID Object,
- IN ACCESS_MASK GrantedAccess,
- IN ULONG ProcessHandleCount,
- IN ULONG SystemHandleCount)
-{
- DbgPrint("CloseProc() 0x%p, PHC %d, SHC %d, AM 0x%X\n", Object,
- ProcessHandleCount, SystemHandleCount, GrantedAccess);
- CloseCount++;
-}
-
-// Tested in Win2k3
-VOID
-NTAPI
-DeleteProc(IN PVOID Object)
-{
- DbgPrint("DeleteProc() 0x%p\n", Object);
- DeleteCount++;
-}
-
-NTSTATUS
-NTAPI
-ParseProc(IN PVOID ParseObject,
- IN PVOID ObjectType,
- IN OUT PACCESS_STATE AccessState,
- IN KPROCESSOR_MODE AccessMode,
- IN ULONG Attributes,
- IN OUT PUNICODE_STRING CompleteName,
- IN OUT PUNICODE_STRING RemainingName,
- IN OUT PVOID Context OPTIONAL,
- IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
- OUT PVOID *Object)
-{
- DbgPrint("ParseProc() called\n");
- *Object = NULL;
-
- ParseCount++;
- return STATUS_OBJECT_NAME_NOT_FOUND;//STATUS_SUCCESS;
-}
-
-// Tested in Win2k3
-NTSTATUS
-NTAPI
-OkayToCloseProc(IN PEPROCESS Process OPTIONAL,
- IN PVOID Object,
- IN HANDLE Handle,
- IN KPROCESSOR_MODE AccessMode)
-{
- DbgPrint("OkayToCloseProc() 0x%p, H 0x%p, AM 0x%X\n", Object, Handle,
- AccessMode);
- OkayToCloseCount++;
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-QueryNameProc(IN PVOID Object,
- IN BOOLEAN HasObjectName,
- OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
- IN ULONG Length,
- OUT PULONG ReturnLength,
- IN KPROCESSOR_MODE AccessMode)
-{
- DbgPrint("QueryNameProc() 0x%p, HON %d, Len %d, AM 0x%X\n",
- Object, HasObjectName, Length, AccessMode);
- QueryNameCount++;
-
- ObjectNameInfo = NULL;
- ReturnLength = 0;
- return STATUS_OBJECT_NAME_NOT_FOUND;
-}
-
-
-VOID
-ObtCreateObjectTypes()
-{
- USHORT i;
- NTSTATUS Status;
- WCHAR Name[15];
-
- for (i=0; i
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-#include
-/* SEH support with PSEH */
-#include
-#include "kmtest.h"
-
-#define NDEBUG
-#include "debug.h"
-
-#define TAG_POOLTEST 'tstP'
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID
-PoolsTest(HANDLE KeyHandle)
-{
- PVOID Ptr;
- ULONG AllocSize, i, AllocNumber;
- PVOID *Allocs;
-
- StartTest();
-
- // Stress-test nonpaged pool
- for (i=1; i<10000; i++)
- {
- // make up some increasing, a bit irregular size
- AllocSize = i*10;
-
- if (i % 10)
- AllocSize++;
-
- if (i % 25)
- AllocSize += 13;
-
- // start with non-paged pool
- Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
-
- // it may fail due to no-memory condition
- if (!Ptr) break;
-
- // try to fully fill it
- RtlFillMemory(Ptr, AllocSize, 0xAB);
-
- // free it
- ExFreePoolWithTag(Ptr, TAG_POOLTEST);
- }
-
- // now paged one
- for (i=1; i<10000; i++)
- {
- // make up some increasing, a bit irregular size
- AllocSize = i*50;
-
- if (i % 10)
- AllocSize++;
-
- if (i % 25)
- AllocSize += 13;
-
- // start with non-paged pool
- Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST);
-
- // it may fail due to no-memory condition
- if (!Ptr) break;
-
- // try to fully fill it
- RtlFillMemory(Ptr, AllocSize, 0xAB);
-
- // free it
- ExFreePoolWithTag(Ptr, TAG_POOLTEST);
- }
-
- // test super-big allocations
- /*AllocSize = 2UL * 1024 * 1024 * 1024;
- Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
- ok(Ptr == NULL, "Allocating 2Gb of nonpaged pool should fail\n");
-
- Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST);
- ok(Ptr == NULL, "Allocating 2Gb of paged pool should fail\n");*/
-
- // now test allocating lots of small/medium blocks
- AllocNumber = 100000;
- Allocs = ExAllocatePoolWithTag(PagedPool, sizeof(Allocs) * AllocNumber, TAG_POOLTEST);
-
- // alloc blocks
- for (i=0; i
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include "kmtest.h"
-
-/*
- Adds a service registry entry for a driver
- The driver must reside in the same path as this loaded driver
- The caller is resposible for releasing memory
-*/
-PWCHAR CreateLowerDeviceRegistryKey(PUNICODE_STRING RegistryPath, PWCHAR NewDriver)
-{
- OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING Name;
- UNICODE_STRING Value;
- UNICODE_STRING NewDriverRegPath;
- PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInfo = NULL;
- HANDLE ServiceKey;
- NTSTATUS Status;
- ULONG Disposition;
- ULONG ServiceDWordValue;
- ULONG ResultLength = 0;
- ULONG Length = 0;
- PWCHAR ReturnPath = NULL;
- /* Now lets find out where we were loaded from by using registry */
- InitializeObjectAttributes(&ObjectAttributes, RegistryPath, OBJ_CASE_INSENSITIVE, NULL, NULL);
- Status = ZwOpenKey(&ServiceKey, KEY_READ, &ObjectAttributes);
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwOpenKey () failed (Status %x)\n", Status);
- return NULL;
- }
-
- RtlInitUnicodeString(&Name, L"ImagePath");
-
- /* First query how much memory we need */
- Status = ZwQueryValueKey(ServiceKey, &Name, KeyValuePartialInformation, 0, 0, &ResultLength);
-
- ResultLength += sizeof(KEY_VALUE_PARTIAL_INFORMATION);
- ValuePartialInfo = ExAllocatePool(PagedPool, ResultLength);
- if (!ValuePartialInfo)
- {
- DbgPrint("Out of memory!\n");
- goto cleanup;
- }
-
- Length = ResultLength;
- Status = ZwQueryValueKey(ServiceKey, &Name, KeyValuePartialInformation, (PVOID)ValuePartialInfo, Length, &ResultLength);
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwQueryValueKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
- /* Remove the current driver name from the string */
- /* FIXME: Dont use hard coded driver name, determine it from the string returned from the above Query */
- Length = (wcslen((PWCHAR)ValuePartialInfo->Data) * 2) - (wcslen(L"kmtest.sys") * 2);
- RtlZeroMemory((PVOID)((ULONG_PTR)ValuePartialInfo->Data + Length),
- wcslen(L"drvtests.sys") * 2);
- ZwClose(ServiceKey);
-
- /* Now add a registry entry for the driver */
-
- NewDriverRegPath.Length = 0;
- NewDriverRegPath.MaximumLength = (wcslen(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\") +
- wcslen(NewDriver) + 1) * sizeof(WCHAR);
- NewDriverRegPath.Buffer = ExAllocatePool(PagedPool, NewDriverRegPath.MaximumLength);
- if (!NewDriverRegPath.Buffer)
- {
- DbgPrint("Out of memory!\n");
- ExFreePool(NewDriverRegPath.Buffer);
- goto cleanup;
- }
-
- RtlAppendUnicodeToString(&NewDriverRegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
- RtlAppendUnicodeToString(&NewDriverRegPath, NewDriver);
-
- InitializeObjectAttributes(&ObjectAttributes,
- &NewDriverRegPath,
- OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
- 0,
- NULL);
-
- Status = ZwCreateKey(&ServiceKey,
- KEY_ALL_ACCESS,
- &ObjectAttributes,
- 0,
- NULL,
- REG_OPTION_VOLATILE,
- &Disposition);
-
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- ExFreePool(NewDriverRegPath.Buffer);
- goto cleanup;
- }
-
- ReturnPath = NewDriverRegPath.Buffer;
- RtlInitUnicodeString(&Name, L"ImagePath");
-
- Value.Length = 0;
- Value.MaximumLength = (wcslen((PWCHAR)ValuePartialInfo->Data) +
- wcslen(NewDriver) + 5) * sizeof(WCHAR);
- Value.Buffer = ExAllocatePool(PagedPool, Value.MaximumLength);
-
- if (!Value.Buffer)
- {
- DbgPrint("Out of memory!\n");
- ExFreePool(Value.Buffer);
- goto cleanup;
- }
-
- RtlAppendUnicodeToString(&Value, (PWCHAR)ValuePartialInfo->Data);
- RtlAppendUnicodeToString(&Value, NewDriver);
- RtlAppendUnicodeToString(&Value, L".sys");
-
- Status = ZwSetValueKey(ServiceKey,
- &Name,
- 0,
- REG_SZ,
- Value.Buffer,
- (wcslen(Value.Buffer)+1) * sizeof(WCHAR));
- ExFreePool(Value.Buffer);
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
- RtlInitUnicodeString(&Name, L"DisplayName");
- RtlInitUnicodeString(&Value, NewDriver);
-
- Status = ZwSetValueKey(ServiceKey,
- &Name,
- 0,
- REG_SZ,
- Value.Buffer,
- (wcslen(Value.Buffer)+1) * sizeof(WCHAR));
-
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
- RtlInitUnicodeString(&Name, L"ErrorControl");
- ServiceDWordValue = 0;
-
- Status = ZwSetValueKey(ServiceKey,
- &Name,
- 0,
- REG_DWORD,
- &ServiceDWordValue,
- sizeof(ULONG));
-
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
- RtlInitUnicodeString(&Name, L"Start");
- ServiceDWordValue = 3;
- Status = ZwSetValueKey(ServiceKey,
- &Name,
- 0,
- REG_DWORD,
- &ServiceDWordValue,
- sizeof(ULONG));
-
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
- RtlInitUnicodeString(&Name, L"Type");
- ServiceDWordValue = 0;
- Status = ZwSetValueKey(ServiceKey,
- &Name,
- 0,
- REG_DWORD,
- &ServiceDWordValue,
- sizeof(ULONG));
-
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("ZwCreateKey() failed (Status %lx)\n", Status);
- goto cleanup;
- }
-
-cleanup:
- ZwClose(ServiceKey);
- if (ValuePartialInfo) ExFreePool(ValuePartialInfo);
-
- return ReturnPath;
-
-}
diff --git a/win32/CMakeLists.txt b/win32/CMakeLists.txt
deleted file mode 100644
index 310892d7ac5..00000000000
--- a/win32/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#add_subdirectory(cmd)
-#add_subdirectory(DriverLoading)
-#add_subdirectory(kernel32)
-add_subdirectory(kmtloader)
-#add_subdirectory(loadlib)
-#add_subdirectory(msvcrt)
-#add_subdirectory(rpcrt4)
-#add_subdirectory(smss)
-#add_subdirectory(user32)
-#add_subdirectory(win32k)
diff --git a/win32/kmtloader/CMakeLists.txt b/win32/kmtloader/CMakeLists.txt
deleted file mode 100644
index 4eec43d938d..00000000000
--- a/win32/kmtloader/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_executable(kmtloader kmtloader.c)
-set_module_type(kmtloader win32cui)
-add_importlibs(kmtloader msvcrt kernel32 advapi32)
-add_cd_file(TARGET kmtloader DESTINATION reactos/bin FOR all)
diff --git a/win32/kmtloader/kmtloader.c b/win32/kmtloader/kmtloader.c
deleted file mode 100644
index d200425beb2..00000000000
--- a/win32/kmtloader/kmtloader.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Kernel-Mode Tests Loader (based on PnP Test Driver Loader by Filip Navara)
- *
- * Copyright 2004 Filip Navara
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* INCLUDES *******************************************************************/
-
-#include
-#include
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-int main()
-{
- SC_HANDLE schSCManager;
- SC_HANDLE schService;
- PWCHAR DriverName = L"KMTEST";
- WCHAR ServiceExe[MAX_PATH];
-
- printf("Kernel Mode Tests loader\n\n");
- GetCurrentDirectoryW(MAX_PATH, ServiceExe);
- wcscat(ServiceExe, L"\\kmtest.sys");
-
- printf("Opening SC Manager...\n");
- schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
-
- if (schSCManager == NULL)
- {
- DWORD Err = GetLastError();
- printf("OpenSCManager failed with error 0x%lx\n", Err);
- return 0;
- }
-
- printf("Creating service...\n");
- schService = CreateServiceW(
- schSCManager,
- DriverName,
- DriverName,
- SERVICE_ALL_ACCESS,
- SERVICE_KERNEL_DRIVER,
- SERVICE_DEMAND_START,
- SERVICE_ERROR_NORMAL,
- ServiceExe,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
-
- if (schService == NULL)
- {
- printf("Opening service...\n");
- schService = OpenServiceW(schSCManager, DriverName, SERVICE_ALL_ACCESS);
- }
-
- if (schService == NULL)
- {
- DWORD Err = GetLastError();
- printf("Create/OpenService failed with error 0x%lx\n", Err);
- CloseServiceHandle(schSCManager);
- return 0;
- }
-
- //for (;;) ;
-
- printf("Starting service...\n");
- StartService(schService, 0, NULL);
-
- printf("Cleaning up and exiting\n");
- CloseServiceHandle(schService);
- CloseServiceHandle(schSCManager);
-
- return 0;
-}
diff --git a/win32/kmtloader/kmtloader.rbuild b/win32/kmtloader/kmtloader.rbuild
deleted file mode 100644
index f7a5002e0c9..00000000000
--- a/win32/kmtloader/kmtloader.rbuild
+++ /dev/null
@@ -1,4 +0,0 @@
-
- advapi32
- kmtloader.c
-
diff --git a/win32/testsets.rbuild b/win32/testsets.rbuild
index 24a94a863c7..1c2e72ec6bd 100644
--- a/win32/testsets.rbuild
+++ b/win32/testsets.rbuild
@@ -4,9 +4,6 @@
-
-
-