problems with IoGetDeviceObjectPointer

Hi all,
I am developing a driver for Windows 98 and I am using the WDM model.
I have the need of reading and writing from the serial port, so I have to
send, from my driver, IRPs to the serial port driver.
In order to get a pointer to the serial port device I use the following
code in the init routine of MY device:

NTSTATUS myStatus;
PDEVICE_OBJECT DevicePointer = NULL;
PFILE_OBJECT FilePointer = NULL;
UNICODE_STRING DeviceName;

RtlInitUnicodeString(&DeviceName, L"\device\serial0");
myStatus = IoGetDeviceObjectPointer(&DeviceName,
FILE_READ_ATTRIBUTES,
&FilePointer,
&DevicePointer);
if (NT_SUCCESS(myStatus)) {
sprintf(out, “SUCCESS!!! \n”, myStatus);
}
else {
sprintf(out, “FAILURE!!! \n”, myStatus);
}

… then I copy the string named “out” (which is global to all the
driver!!) in the internal buffer of my driver and I get it with a read IRP
sent to my device.
The problem is that I always get the “failure” message … and I couldn’t
be able to figure out what’s the problem!!!
I have tried to move the code to the read function of the driver (I thought
the problem could be that when the system initialized my device the serial
device had not been initialized yet!!) but I always got the same
message!!!
Thanks in advance for any suggestion!!!
Bye, Antonino Casile


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