mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 04:14:53 +00:00
[NTOS:IO] IopInitializeDriverModule(): Set the DRVO_LEGACY_DRIVER flag if the driver is not WDM. (#3749)
This commit is contained in:
parent
18d15bcc8b
commit
1fd730b781
1 changed files with 15 additions and 1 deletions
|
@ -447,6 +447,16 @@ IopInitializeDriverModule(
|
||||||
|
|
||||||
DPRINT("Driver name: '%wZ'\n", &DriverName);
|
DPRINT("Driver name: '%wZ'\n", &DriverName);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve the driver's PE image NT header and perform some sanity checks.
|
||||||
|
* NOTE: We suppose that since the driver has been successfully loaded,
|
||||||
|
* its NT and optional headers are all valid and have expected sizes.
|
||||||
|
*/
|
||||||
|
PIMAGE_NT_HEADERS NtHeaders = RtlImageNtHeader(ModuleObject->DllBase);
|
||||||
|
ASSERT(NtHeaders);
|
||||||
|
ASSERT(ModuleObject->SizeOfImage == NtHeaders->OptionalHeader.SizeOfImage);
|
||||||
|
ASSERT(ModuleObject->EntryPoint == RVA(ModuleObject->DllBase, NtHeaders->OptionalHeader.AddressOfEntryPoint));
|
||||||
|
|
||||||
/* Obtain the registry path for the DriverInit routine */
|
/* Obtain the registry path for the DriverInit routine */
|
||||||
PKEY_NAME_INFORMATION nameInfo;
|
PKEY_NAME_INFORMATION nameInfo;
|
||||||
ULONG infoLength;
|
ULONG infoLength;
|
||||||
|
@ -524,7 +534,11 @@ IopInitializeDriverModule(
|
||||||
RtlZeroMemory(driverObject, ObjectSize);
|
RtlZeroMemory(driverObject, ObjectSize);
|
||||||
driverObject->Type = IO_TYPE_DRIVER;
|
driverObject->Type = IO_TYPE_DRIVER;
|
||||||
driverObject->Size = sizeof(DRIVER_OBJECT);
|
driverObject->Size = sizeof(DRIVER_OBJECT);
|
||||||
driverObject->Flags = DRVO_LEGACY_DRIVER; // TODO: check the WDM_DRIVER flag on the module
|
|
||||||
|
/* Set the legacy flag if this is not a WDM driver */
|
||||||
|
if (!(NtHeaders->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_WDM_DRIVER))
|
||||||
|
driverObject->Flags |= DRVO_LEGACY_DRIVER;
|
||||||
|
|
||||||
driverObject->DriverSection = ModuleObject;
|
driverObject->DriverSection = ModuleObject;
|
||||||
driverObject->DriverStart = ModuleObject->DllBase;
|
driverObject->DriverStart = ModuleObject->DllBase;
|
||||||
driverObject->DriverSize = ModuleObject->SizeOfImage;
|
driverObject->DriverSize = ModuleObject->SizeOfImage;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue