RES: Unable to access my driver

You could use NtOpenSection and NtMapViewOfSection native APIs to get a
view of \Device\PhysicalMemory section even in user mode.

I just did this. E-mail me if you want more details about that.
s,


Fernando Roberto da Silva
DriverEntry Kernel Development
http://www.driverentry.com.br

-----Mensagem original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] Em nome de
xxxxx@yahoo.com
Enviada em: sexta-feira, 27 de julho de 2007 15:19
Para: Windows System Software Devs Interest List
Assunto: [ntdev] Unable to access my driver

I am facing a problem in opening the device handle in user mode. I am a
newbie to driver development and right now, I want to dump/visualize the
system attributes that the BIOS actually places in RAM at 000F0000h to
000FFFFFh. So, I wrote a simple driver which I am unable to open its
handle in user mode application via CreateFile win32 API or WinObj
sysInternals tool. Please anyone could help me out as I am stuck in it
for last three days.
In driver code, I do not register myself for the PNP dispatch
function as I am not handling any device. Also, I created the device
object with device type as unknown. I do not know what I have done
wrong. Below, is the driver code and driver inf file.

==============
Driver Code

NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath )
{
DriverObject->DriverExtension->AddDevice =
(PDRIVER_ADD_DEVICE)BiosDump_AddDevice;
DriverObject->DriverUnload =
(PDRIVER_UNLOAD)BiosDump_Unload;

DriverObject->MajorFunction[IRP_MJ_CREATE] =
(PDRIVER_DISPATCH)BiosDump_Create;
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
(PDRIVER_DISPATCH)BiosDump_Close;
DriverObject->MajorFunction[IRP_MJ_READ] =
(PDRIVER_DISPATCH)BiosDump_Read;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
(PDRIVER_DISPATCH)BiosDump_DeviceIO;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
(PDRIVER_DISPATCH)BiosDump_Cleanup;

return STATUS_SUCCESS;
}

NTSTATUS
BiosDump_AddDevice(
__in struct _DRIVER_OBJECT *DriverObject,
__in struct _DEVICE_OBJECT *PhysicalDeviceObject )
{
NTSTATUS status;
UNICODE_STRING DeviceName;
UNICODE_STRING SymbolicLinkName;
PDEVICE_OBJECT DeviceObject;

RtlInitUnicodeString( &DeviceName, BIOS_DUMP_NT_DEVICE_NAME );

//
// Create Bios Dump device object
//
status = IoCreateDevice( DriverObject, // DriverObject
0, //
DeviceExtensionSize
&DeviceName, // DeviceName
FILE_DEVICE_UNKNOWN, // DeviceType
0, //
DeviceCharacteristics
FALSE, // Exclusive
&DeviceObject ); // DeviceObject
if( NT_ERROR( status ) )
{
DbgPrint( “ERROR : Failed to create BiosDump device
object…%d\n”, status );
return status;
}

//
// Set the device object flags
//
DeviceObject->Flags |= DO_DIRECT_IO;

RtlInitUnicodeString( &SymbolicLinkName, BIOS_DUMP_DOS_DEVICE_NAME
);

//
// Create symbolic link to the device
//
status = IoCreateSymbolicLink( &SymbolicLinkName, &DeviceName );
if( NT_ERROR( status ) )
{
DbgPrint( “ERROR : Failed to create symbolic link to BiosDump
device object…%d\n”, status );
IoDeleteDevice( DeviceObject );
return status;
}

//
// Attach the device object to the device stack
//
if( IoAttachDeviceToDeviceStack( DeviceObject, PhysicalDeviceObject
) == NULL )
{
DbgPrint( “ERROR : Failed to attach BiosDump device object to
device stack\n” );
IoDeleteSymbolicLink( &SymbolicLinkName );
IoDeleteDevice( DeviceObject );
return status;
}

//
// Clear the device initialization flag
//
DeviceObject->Flags &= ~(DO_DEVICE_INITIALIZING);

return STATUS_SUCCESS;
}

===========================================
Driver INF

;--------------------------------------------------------------------
; Version section
;--------------------------------------------------------------------
[Version]
Signature = “$WINDOWS NT$”
Class = System
ClassGuid = {4d36e97d-e325-11ce-bfc1-08002be10318}
Provider = %EMS%
DriverVer = 07/01/2007,1.0.0.1

;--------------------------------------------------------------------
; DestinationDirs section
;--------------------------------------------------------------------
[DestinationDirs]
DefaultDestDir = 12

;--------------------------------------------------------------------
; SourceDisksNames section
;--------------------------------------------------------------------
[SourceDisksNames]
1 = %Disk1%

;--------------------------------------------------------------------
; SourceDisksFiles section
;--------------------------------------------------------------------
[SourceDisksFiles]
BiosDump.sys = 1

;--------------------------------------------------------------------
; Manufacturer section
;--------------------------------------------------------------------
[Manufacturer]
%EMS% = BiosDumpModelSection,NTx86

[BiosDumpModelSection.NTx86]
%BiosDump% = BiosDumpDDInstall, BiosDump

[BiosDumpDDInstall]
CopyFiles = @BiosDump.sys

[BiosDumpDDInstall.Services]
AddService = %BiosDump%,0x00000002,BiosDumpServiceInstallSection

[BiosDumpServiceInstallSection]
DisplayName = %BiosDump%
Description = %BiosDumpDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\BiosDump.sys

;--------------------------------------------------------------------
; Strings section
;--------------------------------------------------------------------
[Strings]
EMS = “EMS”
Disk1 = “HardDisk 0”
BiosDump = “BiosDump”
BiosDumpDesc = “Bios Dump Utility”


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

If I want the other way around means that I want to map physical address and do it my own self. As, I already mentioned that I am a newbie to this and I want to play around.

Fernando Silva wrote:

You could use NtOpenSection and NtMapViewOfSection native APIs
to get a view of \Device\PhysicalMemory section even in user mode.

As far as I know, user-mode programs cannot access it anymore:
http://technet2.microsoft.com/windowsserver/en/library/e0f862a3-cf16-4a48-bea5-f2004d12ce351033.mspx

The documented way to query stuff like this in user mode is
GetSystemFirmwareTable / EnumSystemFirmwareTables, BTW (or WMI if you can
stand the hell of a ridiculously overcomplicated COM-ified, script-ified
abstraction layer).


Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net
“Fernando Roberto” wrote in message
news:xxxxx@ntdev…
You could use NtOpenSection and NtMapViewOfSection native APIs to get a
view of \Device\PhysicalMemory section even in user mode.

I just did this. E-mail me if you want more details about that.
s,


Fernando Roberto da Silva
DriverEntry Kernel Development
http://www.driverentry.com.br

-----Mensagem original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] Em nome de
xxxxx@yahoo.com
Enviada em: sexta-feira, 27 de julho de 2007 15:19
Para: Windows System Software Devs Interest List
Assunto: [ntdev] Unable to access my driver

I am facing a problem in opening the device handle in user mode. I am a
newbie to driver development and right now, I want to dump/visualize the
system attributes that the BIOS actually places in RAM at 000F0000h to
000FFFFFh. So, I wrote a simple driver which I am unable to open its
handle in user mode application via CreateFile win32 API or WinObj
sysInternals tool. Please anyone could help me out as I am stuck in it
for last three days.
In driver code, I do not register myself for the PNP dispatch
function as I am not handling any device. Also, I created the device
object with device type as unknown. I do not know what I have done
wrong. Below, is the driver code and driver inf file.

==============
Driver Code
==============

NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath )
{
DriverObject->DriverExtension->AddDevice =
(PDRIVER_ADD_DEVICE)BiosDump_AddDevice;
DriverObject->DriverUnload =
(PDRIVER_UNLOAD)BiosDump_Unload;

DriverObject->MajorFunction[IRP_MJ_CREATE] =
(PDRIVER_DISPATCH)BiosDump_Create;
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
(PDRIVER_DISPATCH)BiosDump_Close;
DriverObject->MajorFunction[IRP_MJ_READ] =
(PDRIVER_DISPATCH)BiosDump_Read;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
(PDRIVER_DISPATCH)BiosDump_DeviceIO;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
(PDRIVER_DISPATCH)BiosDump_Cleanup;

return STATUS_SUCCESS;
}

NTSTATUS
BiosDump_AddDevice(
_in struct DRIVER_OBJECT *DriverObject,
in struct _DEVICE_OBJECT *PhysicalDeviceObject )
{
NTSTATUS status;
UNICODE_STRING DeviceName;
UNICODE_STRING SymbolicLinkName;
PDEVICE_OBJECT DeviceObject;

RtlInitUnicodeString( &DeviceName, BIOS_DUMP_NT_DEVICE_NAME );

//
// Create Bios Dump device object
//
status = IoCreateDevice( DriverObject, // DriverObject
0, //
DeviceExtensionSize
&DeviceName, // DeviceName
FILE_DEVICE_UNKNOWN, // DeviceType
0, //
DeviceCharacteristics
FALSE, // Exclusive
&DeviceObject ); // DeviceObject
if( NT_ERROR( status ) )
{
DbgPrint( “ERROR : Failed to create BiosDump device
object…%d\n”, status );
return status;
}

//
// Set the device object flags
//
DeviceObject->Flags |= DO_DIRECT_IO;

RtlInitUnicodeString( &SymbolicLinkName, BIOS_DUMP_DOS_DEVICE_NAME
);

//
// Create symbolic link to the device
//
status = IoCreateSymbolicLink( &SymbolicLinkName, &DeviceName );
if( NT_ERROR( status ) )
{
DbgPrint( “ERROR : Failed to create symbolic link to BiosDump
device object…%d\n”, status );
IoDeleteDevice( DeviceObject );
return status;
}

//
// Attach the device object to the device stack
//
if( IoAttachDeviceToDeviceStack( DeviceObject, PhysicalDeviceObject
) == NULL )
{
DbgPrint( “ERROR : Failed to attach BiosDump device object to
device stack\n” );
IoDeleteSymbolicLink( &SymbolicLinkName );
IoDeleteDevice( DeviceObject );
return status;
}

//
// Clear the device initialization flag
//
DeviceObject->Flags &= ~(DO_DEVICE_INITIALIZING);

return STATUS_SUCCESS;
}

===========================================
Driver INF
===========================================

;--------------------------------------------------------------------
; Version section
;--------------------------------------------------------------------
[Version]
Signature = “$WINDOWS NT$”
Class = System
ClassGuid = {4d36e97d-e325-11ce-bfc1-08002be10318}
Provider = %EMS%
DriverVer = 07/01/2007,1.0.0.1

;--------------------------------------------------------------------
; DestinationDirs section
;--------------------------------------------------------------------
[DestinationDirs]
DefaultDestDir = 12

;--------------------------------------------------------------------
; SourceDisksNames section
;--------------------------------------------------------------------
[SourceDisksNames]
1 = %Disk1%

;--------------------------------------------------------------------
; SourceDisksFiles section
;--------------------------------------------------------------------
[SourceDisksFiles]
BiosDump.sys = 1

;--------------------------------------------------------------------
; Manufacturer section
;--------------------------------------------------------------------
[Manufacturer]
%EMS% = BiosDumpModelSection,NTx86

[BiosDumpModelSection.NTx86]
%BiosDump% = BiosDumpDDInstall, BiosDump

[BiosDumpDDInstall]
CopyFiles = @BiosDump.sys

[BiosDumpDDInstall.Services]
AddService = %BiosDump%,0x00000002,BiosDumpServiceInstallSection

[BiosDumpServiceInstallSection]
DisplayName = %BiosDump%
Description = %BiosDumpDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\BiosDump.sys

;--------------------------------------------------------------------
; Strings section
;--------------------------------------------------------------------
[Strings]
EMS = “EMS”
Disk1 = “HardDisk 0”
BiosDump = “BiosDump”
BiosDumpDesc = “Bios Dump Utility”


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I am still saying that if I want to write my own driver and map the physical address And then copy the data and send the data to user mode. Right now, I am unable to open the device handle, It does not matter to me how could I access the physical address

If you still wish to write a driver, and if you’re looking for an sample
from which to start, you might want to use IOCTL from the WDK (under
“src\general”). There may be a better choice, but this will do what you
want and not too much more to complicate the issue. IOCTL handles all
four types of IO; you only need METHOD_BUFFERED.

To install it, download OSRLOADER from osronline.com, and just use the
default settings.

To start it, assuming you name it “IOCTL”, start a command shell and
type “NET START IOCTL.”

To stop it, type “NET STOP IOCTL.”

Good luck,

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, July 27, 2007 15:22
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Unable to access my driver

xxxxx@yahoo.com wrote:

I am facing a problem in opening the device handle in user mode. I am
a newbie to driver development and right now, I want to dump/visualize
the system attributes that the BIOS actually places in RAM at 000F0000h
to 000FFFFFh.

What “system attributes” do you expect to find here? A much quicker and
easier way to dump this information is to open a cmd shell and do this:

C:\Windows>debug
-d f000:0 l 280
F000:0000 00 13 00 00 01 02 00 E0-03 07 90 9E CB 7F 00 00

F000:0010 00 00 33 50 68 6F 65 6E-69 78 20 54 65 63 68 6E …3Phoenix
Techn
F000:0020 6F 6C 6F 67 69 65 73 2C-20 4C 54 44 00 36 2E 30 ologies,
LTD.6.0
F000:0030 30 20 50 47 00 31 30 2F-32 30 2F 32 30 30 35 00 0
PG.10/20/2005.
F000:0040 00 01 19 01 00 01 02 03-04 FF FF FF FF FF FF FF

F000:0050 FF FF FF FF FF FF FF FF-FF 06 20 00 20 00 20 00 …
. . .
F000:0060 20 00 00 02 08 02 00 01-02 03 04 20 00 6E 46 6F …
.nFo
F000:0070 72 63 65 34 2D 41 39 33-39 00 20 00 20 00 00 03 rce4-A939.
. …
F000:0080 0D 03 00 01 03 02 03 04-02 02 02 02 20 00 20 00
… . .
F000:0090 20 00 20 00 00 04 20 04-00 01 03 83 02 B1 0F 02 . …

F000:00A0 00 FF FB 8B 17 03 8D C9-00 B8 0B DA 07 41 12 0A
…A…
F000:00B0 00 0C 00 FF FF 53 6F 63-6B 65 74 20 39 33 39 00 …Socket
939.
F000:00C0 41 4D 44 00 41 4D 44 20-41 74 68 6C 6F 6E 28 74 AMD.AMD
Athlon(t
F000:00D0 6D 29 20 36 34 20 58 32-20 44 75 61 6C 20 43 6F m) 64 X2
Dual Co
F000:00E0 72 65 20 50 72 6F 63 65-73 73 6F 72 20 33 38 30 re
Processor 380
F000:00F0 30 2B 00 00 05 18 05 00-06 04 03 03 0C 1C 00 04
0+…
F000:0100 01 04 04 06 00 07 00 08-00 09 00 00 00 00 06 0C

F000:0110 06 00 01 FF 05 12 00 7F-7F 00 41 30 00 00 06 0C
…A0…
F000:0120 07 00 01 FF 05 12 00 7F-7F 00 41 31 00 00 06 0C
…A1…
F000:0130 08 00 01 45 05 12 00 89-89 00 41 32 00 00 06 0C
…E…A2…
F000:0140 09 00 01 67 05 12 00 89-89 00 41 33 00 00 07 13
…g…A3…
F000:0150 0A 00 01 80 01 80 00 80-00 20 00 20 00 00 02 02 … .

F000:0160 02 49 6E 74 65 72 6E 61-6C 20 43 61 63 68 65 00 .Internal
Cache.
F000:0170 00 07 13 0B 00 01 80 01-80 00 80 00 20 00 20 00
… . .
F000:0180 00 02 02 02 45 78 74 65-72 6E 61 6C 20 43 61 63
…External Cac
F000:0190 68 65 00 00 08 09 0C 00-01 16 00 00 FF 50 52 49
he…PRI
F000:01A0 4D 41 52 59 20 49 44 45-00 00 08 09 0D 00 01 16 MARY
IDE…
F000:01B0 00 00 FF 53 45 43 4F 4E-44 41 52 59 20 49 44 45
…SECONDARY IDE
F000:01C0 00 00 08 09 0E 00 01 17-00 00 A1 46 44 44 00 00
…FDD…
F000:01D0 08 09 0F 00 01 18 02 08-07 43 4F 4D 31 00 20 00
…COM1. .
F000:01E0 00 08 09 10 00 01 18 02-08 07 43 4F 4D 32 00 20
…COM2.
F000:01F0 00 00 08 09 11 00 01 05-02 05 05 4C 50 54 31 00
…LPT1.
F000:0200 20 00 00 08 09 12 00 01-0F 02 0F 0D 4B 65 79 62
…Keyb
F000:0210 6F 61 72 64 00 20 00 00-08 09 13 00 01 0F 02 0F oard.

F000:0220 0E 50 53 2F 32 20 4D 6F-75 73 65 00 20 00 00 08 .PS/2
Mouse. …
F000:0230 09 14 00 00 00 01 FF 10-55 53 42 30 00 00 09 0D
…USB0…
F000:0240 15 00 01 06 05 03 04 01-00 02 01 50 43 49 30 00
…PCI0.
F000:0250 00 09 0D 16 00 01 06 05-04 04 02 00 02 01 50 43
…PC
F000:0260 49 31 00 00 09 0D 17 00-01 06 05 03 04 03 00 02
I1…
F000:0270 01 50 43 49 32 00 00 09-0D 18 00 01 06 05 03 04
.PCI2…

So, I wrote a simple driver which I am unable to open its handle in
user mode application via CreateFile win32 API or WinObj sysInternals
tool. Please anyone could help me out as I am stuck in it for last three
days.

How do you expect that your driver will be loaded? Who is going to
request it?

You should make this a “legacy” driver, not a PnP driver. Then you can
use the service manager to load and unload it from user-mode. You will
have to move all of the AddDevice processing into DriverEntry


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I would consider doing what a couple of people have already suggested -
start over using a plaid old, NT4 DDK style sample driver, like IOCTL,
rather than one based on either WDM or WDF. The first reason is that it
will eliminate the inf and any setup issues. The second is that is will
be a smaller, simpler driver for you to start with. Isn’t this a
software only driver? If so, the last is that, even in the big picture,
there is no upside for using WDM for a software only driver, I don’t
personally see one for WDF, but a much better case can be made and it
doesn’t really matter either way.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com
Sent: Friday, July 27, 2007 15:53
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Unable to access my driver

First of all thanks for your reply and suggestions. Second, I put
DbgPrint in AddDevice routine and it is called. Also, I verified from
the DeviceTree utility that the device is created and my lower device to
which I am attached is \Device\PnPManager. The problem I always get is
that I am unable to open the device. Also, When I try to install through
ADD New Hardware device wizard. It installs successfully but it says
when finishing that unable to start service. I do not know what to do.
If you want to send my code in zip format and place it in some file
sharing site. I can do that. I will be glad if you kindly look into it.
Thanks


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

The WDK is full of sample drivers that illustrate this first step of accessing the driver.

Take a look at the KMDF NonPNP sample.

Thomas F. Divine

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-295429-
xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Friday, July 27, 2007 4:51 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] RES: Unable to access my driver

I am still saying that if I want to write my own driver and map the
physical address And then copy the data and send the data to user mode.
Right now, I am unable to open the device handle, It does not matter to
me how could I access the physical address


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

As I recall, you posted your initialization code and some comments way back when this started.

At that time, you were indicating an AddDevice routine, but not the PnP dispatch. Unsupported dispatch routines fail.

Well, (conceptually) the PNP START request is a PNP IRP (stands to reason?), and since you are not supporting PNP, it fails. Hence, “unable to start service”. More likely you failed the first PNP request presented, and never got to the start request, but I’m not going to try to verify that- point it you have to support PnP in a WDM driver.

WDM is pretty much all or nothing. Support (at least at the minimal documented levels) all of AddDevice, PNP, POWER, WMI, or don’t support any of them.

If you want to reduce the PnP/power/WMI burden, then use KMDF. Or use the pre-WDM model, and create at least one device in DriverEntry.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Friday, July 27, 2007 12:53 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Unable to access my driver

First of all thanks for your reply and suggestions. Second, I put DbgPrint in AddDevice routine and it is called. Also, I verified from the DeviceTree utility that the device is created and my lower device to which I am attached is \Device\PnPManager. The problem I always get is that I am unable to open the device. Also, When I try to install through ADD New Hardware device wizard. It installs successfully but it says when finishing that unable to start service. I do not know what to do. If you want to send my code in zip format and place it in some file sharing site. I can do that. I will be glad if you kindly look into it.
Thanks

Hi Bob,
Thanks for the reply. I omitted it out because my device does not want to
handle any sort of PNP requests and I am not dealing with the hardware
either. Now, I fully understand that either you have to implement it the
prerequisites or not. I have one question from you, if the PnP manager sends
any request related to IRP_MN_FILTER_RESOURCE_REQUIREMENTS or any other PnP
minor reuest codes, then I am thinking that I should skip it and pass it to
the lower device driver to handle it. Is it OK or do I have to process it my
own self.

Thank you.

On 7/30/07, Bob Kjelgaard wrote:
>
> As I recall, you posted your initialization code and some comments way
> back when this started.
>
> At that time, you were indicating an AddDevice routine, but not the PnP
> dispatch. Unsupported dispatch routines fail.
>
> Well, (conceptually) the PNP START request is a PNP IRP (stands to
> reason?), and since you are not supporting PNP, it fails. Hence, “unable to
> start service”. More likely you failed the first PNP request presented, and
> never got to the start request, but I’m not going to try to verify that-
> point it you have to support PnP in a WDM driver.
>
> WDM is pretty much all or nothing. Support (at least at the minimal
> documented levels) all of AddDevice, PNP, POWER, WMI, or don’t support any
> of them.
>
> If you want to reduce the PnP/power/WMI burden, then use KMDF. Or use the
> pre-WDM model, and create at least one device in DriverEntry.
>
> -----Original Message-----
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
> Sent: Friday, July 27, 2007 12:53 PM
> To: Windows System Software Devs Interest List
> Subject: RE:[ntdev] Unable to access my driver
>
> First of all thanks for your reply and suggestions. Second, I put DbgPrint
> in AddDevice routine and it is called. Also, I verified from the DeviceTree
> utility that the device is created and my lower device to which I am
> attached is \Device\PnPManager. The problem I always get is that I am unable
> to open the device. Also, When I try to install through ADD New Hardware
> device wizard. It installs successfully but it says when finishing that
> unable to start service. I do not know what to do. If you want to send my
> code in zip format and place it in some file sharing site. I can do that. I
> will be glad if you kindly look into it.
> Thanks
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

The rules for handling each of the PnP IRP minor code are listed in MSDN.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“salman razzaq” wrote in message news:xxxxx@ntdev…
> Hi Bob,
> Thanks for the reply. I omitted it out because my device does not want to
> handle any sort of PNP requests and I am not dealing with the hardware
> either. Now, I fully understand that either you have to implement it the
> prerequisites or not. I have one question from you, if the PnP manager sends
> any request related to IRP_MN_FILTER_RESOURCE_REQUIREMENTS or any other PnP
> minor reuest codes, then I am thinking that I should skip it and pass it to
> the lower device driver to handle it. Is it OK or do I have to process it my
> own self.
>
> Thank you.
>
>
> On 7/30/07, Bob Kjelgaard wrote:
> >
> > As I recall, you posted your initialization code and some comments way
> > back when this started.
> >
> > At that time, you were indicating an AddDevice routine, but not the PnP
> > dispatch. Unsupported dispatch routines fail.
> >
> > Well, (conceptually) the PNP START request is a PNP IRP (stands to
> > reason?), and since you are not supporting PNP, it fails. Hence, “unable
to
> > start service”. More likely you failed the first PNP request presented,
and
> > never got to the start request, but I’m not going to try to verify that-
> > point it you have to support PnP in a WDM driver.
> >
> > WDM is pretty much all or nothing. Support (at least at the minimal
> > documented levels) all of AddDevice, PNP, POWER, WMI, or don’t support any
> > of them.
> >
> > If you want to reduce the PnP/power/WMI burden, then use KMDF. Or use the
> > pre-WDM model, and create at least one device in DriverEntry.
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com [mailto:
> > xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
> > Sent: Friday, July 27, 2007 12:53 PM
> > To: Windows System Software Devs Interest List
> > Subject: RE:[ntdev] Unable to access my driver
> >
> > First of all thanks for your reply and suggestions. Second, I put DbgPrint
> > in AddDevice routine and it is called. Also, I verified from the DeviceTree
> > utility that the device is created and my lower device to which I am
> > attached is \Device\PnPManager. The problem I always get is that I am
unable
> > to open the device. Also, When I try to install through ADD New Hardware
> > device wizard. It installs successfully but it says when finishing that
> > unable to start service. I do not know what to do. If you want to send my
> > code in zip format and place it in some file sharing site. I can do that. I
> > will be glad if you kindly look into it.
> > Thanks
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > For our schedule of WDF, WDM, debugging and other seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>

I believe that’s the case, but I’m not 100% certain.

I usually write either KMDF drivers (which do all this for me) or NT4 style. When I wrote or maintained WDM drivers, I always checked the WDK/DDK documentation for these rules [I was used to NT4, and never totally got the hang of WDM]. So the rules aren’t firmly “stuck” in my head, and I’ve not time to look them up now.

I’m sure there are plenty of folks on the list who can answer this for you more reliably and with less effort… The WDK summarizes all of these rules, although it can be fairly daunting reading.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of salman razzaq
Sent: Monday, July 30, 2007 8:09 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Unable to access my driver

Hi Bob,
Thanks for the reply. I omitted it out because my device does not want to handle any sort of PNP requests and I am not dealing with the hardware either. Now, I fully understand that either you have to implement it the prerequisites or not. I have one question from you, if the PnP manager sends any request related to IRP_MN_FILTER_RESOURCE_REQUIREMENTS or any other PnP minor reuest codes, then I am thinking that I should skip it and pass it to the lower device driver to handle it. Is it OK or do I have to process it my own self.

Thank you.

On 7/30/07, Bob Kjelgaard wrote:
As I recall, you posted your initialization code and some comments way back when this started.

At that time, you were indicating an AddDevice routine, but not the PnP dispatch. Unsupported dispatch routines fail.

Well, (conceptually) the PNP START request is a PNP IRP (stands to reason?), and since you are not supporting PNP, it fails. Hence, “unable to start service”. More likely you failed the first PNP request presented, and never got to the start request, but I’m not going to try to verify that- point it you have to support PnP in a WDM driver.

WDM is pretty much all or nothing. Support (at least at the minimal documented levels) all of AddDevice, PNP, POWER, WMI, or don’t support any of them.

If you want to reduce the PnP/power/WMI burden, then use KMDF. Or use the pre-WDM model, and create at least one device in DriverEntry.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Friday, July 27, 2007 12:53 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Unable to access my driver

First of all thanks for your reply and suggestions. Second, I put DbgPrint in AddDevice routine and it is called. Also, I verified from the DeviceTree utility that the device is created and my lower device to which I am attached is \Device\PnPManager. The problem I always get is that I am unable to open the device. Also, When I try to install through ADD New Hardware device wizard. It installs successfully but it says when finishing that unable to start service. I do not know what to do. If you want to send my code in zip format and place it in some file sharing site. I can do that. I will be glad if you kindly look into it.
Thanks