DeviceExtension not getting allocated by IoCreateDevice()...

When I use IoCreateDevice() to create a device object (for filtering
volumes), for some strange reason it’s not allocating my device extension.
Here’s how I’m doing it:

status = IoCreateDevice(pDriverObject,
sizeof(LOWIRQL_FILTER_EXTENION),
NULL,
FILE_DEVICE_DISK,
0,
FALSE,
&pFilterDeviceObject);

LOWIRQL_FILTER_EXTENION is defined as:

typedef struct _LOWIRQL_FILTER_EXTENION {
PDEVICE_OBJECT pThisDeviceObject;
PDEVICE_OBJECT pLowerDeviceObject;
ULONG DiskNumber;
ULONG DiskSignature;
ULONG PartitionNumber;
LONGLONG PartitionOffset;
LONGLONG PartitionLength;
BOOLEAN bDeletePending;
} LOWIRQL_FILTER_EXTENION, *PLOWIRQL_FILTER_EXTENION;

I’m writing a driver for NT4, but I’m testing it on my W2K machines, and
DriverExtension never gets allocated.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On Friday, March 09, 2001 1:09 AM “Nate Bushman” wrote:

When I use IoCreateDevice() to create a device object (for filtering
volumes), for some strange reason it’s not allocating my device
extension.
Here’s how I’m doing it (…)

Hi, Nate.
Your LOWIRQL_FILTER_EXTENION ( you’ve a typing error here:
the word is …_EXTENSION… :wink: ) seems to be allright. The problem
might be that as you’re testing your NT4 driver on a W2K system, you
should provide an NT-like name string on the third parameter to
IoCreateDevice. Try this:

// Use an unicode string
//
UNICODE_STRING NTNameString;

// Create counted string version of our device name
//
RtlInitUnicodeString (&NTNameString, YOUR_DEVICE_NAME_NT);

// Create the device object
//
status = IoCreateDevice(pDriverObject,
sizeof(LOWIRQL_FILTER_EXTENION),
&NTNameString,
FILE_DEVICE_DISK,
0,
FALSE,
&pFilterDeviceObject);

YOUR_DEVICE_NAME_NT should be something like:

#define YOUR_DEVICE_NAME_NT L"\Device\your_driver_name" // NT device
name

Also, you should check if the FILE_DEVICE_DISK value is appropriate
to your device (maybe you have to define your own value here; if that is
the case, this value should be in the range 0x8000 to 0xFFFF - check the
docs).

Hope it helps, :wink:

Miguel Monteiro
xxxxx@criticalsoftware.com
www.criticalsoftware.com

«Humour and love are God’s answers
to Human weaknesses»


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>

I’m writing a driver for NT4, but I’m testing it on my W2K machines, and
DriverExtension never gets allocated.

Point of clarification: Your DRIVER extension doesn’t get allocated, or your
DEVICE extension doesn’t get allocated?

There are both Driver and Device extensions, so this isn’t an attempt to be
“cute”…

Peter
OSR


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com