NTSTATUS TestEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PCUNICODE_STRING RegistryPath, _Out_ PCWSTR *DeviceName, _Inout_ INT *Flags) { NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); UNREFERENCED_PARAMETER(RegistryPath); *DeviceName = L"CcCopyWrite"; *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE | TESTENTRY_BUFFERED_IO_DEVICE | TESTENTRY_NO_READONLY_DEVICE; KmtRegisterIrpHandler(IRP_MJ_CLEANUP, NULL, TestIrpHandler); KmtRegisterIrpHandler(IRP_MJ_CREATE, NULL, TestIrpHandler); KmtRegisterIrpHandler(IRP_MJ_READ, NULL, TestIrpHandler); KmtRegisterIrpHandler(IRP_MJ_WRITE, NULL, TestIrpHandler); KmtRegisterIrpHandler(IRP_MJ_FLUSH_BUFFERS, NULL, TestIrpHandler); TestFastIoDispatch.FastIoRead = FastIoRead; TestFastIoDispatch.FastIoWrite = FastIoWrite; DriverObject->FastIoDispatch = &TestFastIoDispatch; return Status; }
/** * @name TestEntry * * Test entry point. * This is called by DriverEntry as early as possible, but with ResultBuffer * initialized, so that test macros work correctly * * @param DriverObject * Driver Object. * This is guaranteed not to have been touched by DriverEntry before * the call to TestEntry * @param RegistryPath * Driver Registry Path * This is guaranteed not to have been touched by DriverEntry before * the call to TestEntry * @param DeviceName * Pointer to receive a test-specific name for the device to create * @param Flags * Pointer to a flags variable instructing DriverEntry how to proceed. * See the KMT_TESTENTRY_FLAGS enumeration for possible values * Initialized to zero on entry * * @return Status. * DriverEntry will fail if this is a failure status */ NTSTATUS TestEntry( IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags) { NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); UNREFERENCED_PARAMETER(RegistryPath); UNREFERENCED_PARAMETER(Flags); DPRINT("Entry!\n"); ok_irql(PASSIVE_LEVEL); TestDriverObject = DriverObject; *DeviceName = L"Example"; trace("Hi, this is the example driver\n"); KmtRegisterIrpHandler(IRP_MJ_CREATE, NULL, TestIrpHandler); KmtRegisterIrpHandler(IRP_MJ_CLOSE, NULL, TestIrpHandler); KmtRegisterMessageHandler(0, NULL, TestMessageHandler); return Status; }
NTSTATUS TestEntry( IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags) { NTSTATUS Status = STATUS_SUCCESS; INT i; PAGED_CODE(); UNREFERENCED_PARAMETER(DriverObject); UNREFERENCED_PARAMETER(RegistryPath); UNREFERENCED_PARAMETER(Flags); DPRINT("TestEntry. DriverObject=%p, RegistryPath=%wZ\n", DriverObject, RegistryPath); *DeviceName = L"IoHelper"; for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; ++i) KmtRegisterIrpHandler(i, NULL, TestIrpHandler); return Status; }
NTSTATUS TestEntry( IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags) { NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); UNREFERENCED_PARAMETER(RegistryPath); *DeviceName = L"FindFile"; *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE; KmtRegisterIrpHandler(IRP_MJ_DIRECTORY_CONTROL, NULL, TestIrpHandler); KmtRegisterMessageHandler(0, NULL, TestMessageHandler); return Status; }
NTSTATUS TestEntry( _In_ PDRIVER_OBJECT DriverObject, _In_ PCUNICODE_STRING RegistryPath, _Out_ PCWSTR *DeviceName, _Inout_ INT *Flags) { NTSTATUS Status = STATUS_SUCCESS; PAGED_CODE(); UNREFERENCED_PARAMETER(RegistryPath); *DeviceName = L"CcMapData"; *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE | TESTENTRY_BUFFERED_IO_DEVICE | TESTENTRY_NO_READONLY_DEVICE; KmtRegisterIrpHandler(IRP_MJ_READ, NULL, TestIrpHandler); KmtRegisterMessageHandler(0, NULL, TestMessageHandler); return Status; }