does driverentry return true?
--
Tom Picard
"POnga" wrote:
> Hi All,
>
> I'm a newbie in driver development, and I'm compile a driver with a
> simple AddDevice call, but after I load the driver, the system call
> the DriverEntry function and after the DriverUnload function is
> called. the AddDevice is never called.
>
> NTSTATUS
> DriverEntry(
> __in PDRIVER_OBJECT DriverObject,
> __in PUNICODE_STRING RegistryPath
> )
> {
> NTSTATUS nts = STATUS_SUCCESS;
>
> KdPrint(("03AddDevice_DriverEntry\n"));
> //
> // Connect the ToasterAddDevice routine that is implemented in
> this stage of
> // the function driver. The system calls ToasterAddDevice when a
> new instance
> // of Toaster class hardware is connected to the computer.
> //
> DriverObject->DriverExtension->AddDevice = AddDevice_AddDevice;
>
> //
> // Connect the ToasterUnload routine that is implemented in this
> stage of the
> // function driver. The system calls ToasterUnload when no more
> instances of
> // Toaster class hardware are connected to the computer.
> //
> DriverObject->DriverUnload = AddDevice_Unload;
>
> //
> // Connect the dispatch routines which are implemented in this
> stage of the
> // function driver, including PnP, Power Management and WMI. The
> system calls
> // these dispatch routines to handle PnP, Power and WMI
> operations.
> //
> DriverObject->MajorFunction[IRP_MJ_PNP] =
> AddDevice_DispatchPnp;
> DriverObject->MajorFunction[IRP_MJ_POWER] =
> AddDevice_DispatchPower;
> DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] =
> AddDevice_SystemControl;
>
> //
> // Connect the new dispatch routines implemented in this stage of
> the function
> // driver that support communication from applications.
> ToasterDispatchIO
> // initially processes read, write, and device control operations.
> These
> // operations are the result of user-mode calls to ReadFile,
> WriteFile, or
> // DeviceIoControl.
> //
> DriverObject->MajorFunction[IRP_MJ_CREATE] =
> AddDevice_CreateClose;
> DriverObject->MajorFunction[IRP_MJ_CLOSE] =
> AddDevice_CreateClose;
> DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
> AddDevice_ReadWrite;
> DriverObject->MajorFunction[IRP_MJ_READ] =
> AddDevice_ReadWrite;
> DriverObject->MajorFunction[IRP_MJ_WRITE] =
> AddDevice_ReadWrite;
>
> return nts;
> }
> .
>
|