IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

I have the following function which tries to get access to parallel port:

NTSTATUS ClaimHardware( PDRIVER_OBJECT pDriverObj,
PDEVICE_OBJECT pDevObj,
ULONG portBase, // 0x378
ULONG portSpan, // 0x4
ULONG Irq) // 0x7
{
NTSTATUS status;
PHYSICAL_ADDRESS maxPortAddr;
PIO_RESOURCE_REQUIREMENTS_LIST pRRList;

int rrSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
sizeof(IO_RESOURCE_DESCRIPTOR);
pRRList = (PIO_RESOURCE_REQUIREMENTS_LIST)
ExAllocatePool(PagedPool, rrSize);

RtlZeroMemory(pRRList, rrSize);
pRRList->ListSize = rrSize;
pRRList->AlternativeLists = 1; // only 1 Resource List
pRRList->InterfaceType = Isa;
pRRList->List[0].Version = 1;
pRRList->List[0].Revision = 1;
pRRList->List[0].Count = 2; // 2 Resource Descriptors: port & irq
pRRList->List[0].Descriptors[0].Type = CmResourceTypePort;
pRRList->List[0].Descriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[0].Flags = CM_RESOURCE_PORT_IO;
pRRList->List[0].Descriptors[0].u.Port.Length = portSpan;
pRRList->List[0].Descriptors[0].u.Port.Alignment = FILE_WORD_ALIGNMENT;
maxPortAddr.QuadPart = portBase;
pRRList->List[0].Descriptors[0].u.Port.MinimumAddress = maxPortAddr;
maxPortAddr.LowPart += portSpan-1;
pRRList->List[0].Descriptors[0].u.Port.MaximumAddress = maxPortAddr;
pRRList->List[0].Descriptors[1].Type = CmResourceTypeInterrupt;
pRRList->List[0].Descriptors[1].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[1].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
pRRList->List[0].Descriptors[1].u.Interrupt.MinimumVector = Irq;
pRRList->List[0].Descriptors[1].u.Interrupt.MaximumVector = Irq;

status = IoReportDetectedDevice(
pDriverObj, // DriverObject
Isa, // Bus type
-1, // Bus number
-1, // SlotNumber
NULL, // Driver RESOURCE_LIST
pRRList, // Device Resource List
FALSE, // Already claimed?
&pDevObj ); // device object

// Result: status = STATUS_NO_SUCH_DEVICE

ExFreePool(pRRList);
return status;
}

Function is called from DriverEntry. BIOS parallel port settings are:
Parallel port 378
Port Mode Normal
IRQ 7
Operating system: WinXP professional.

Is this code OK? Possibly there is conflict with existing parallel port driver. I tried to
prevent this disabling LPT1 in the Device Manager or uninstalling existing parallel port
driver. However, this doesn’t help and my driver cannot be loaded.

Note: I ask this question second time, possibly first question was too long and not clear. I hope this is not violation of message list rules. Thanks.


Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

Such hardware claims will not work for PnP hardware (which is your parallel port on ACPI mobos).

They are long ago obsolete, and I’m very much surprised that somebody suggested them for w2k.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Wednesday, October 27, 2004 9:00 PM
Subject: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

I have the following function which tries to get access to parallel port:

NTSTATUS ClaimHardware( PDRIVER_OBJECT pDriverObj,
PDEVICE_OBJECT pDevObj,
ULONG portBase, // 0x378
ULONG portSpan, // 0x4
ULONG Irq) // 0x7
{
NTSTATUS status;
PHYSICAL_ADDRESS maxPortAddr;
PIO_RESOURCE_REQUIREMENTS_LIST pRRList;

int rrSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
sizeof(IO_RESOURCE_DESCRIPTOR);
pRRList = (PIO_RESOURCE_REQUIREMENTS_LIST)
ExAllocatePool(PagedPool, rrSize);

RtlZeroMemory(pRRList, rrSize);
pRRList->ListSize = rrSize;
pRRList->AlternativeLists = 1; // only 1 Resource List
pRRList->InterfaceType = Isa;
pRRList->List[0].Version = 1;
pRRList->List[0].Revision = 1;
pRRList->List[0].Count = 2; // 2 Resource Descriptors: port & irq
pRRList->List[0].Descriptors[0].Type = CmResourceTypePort;
pRRList->List[0].Descriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[0].Flags = CM_RESOURCE_PORT_IO;
pRRList->List[0].Descriptors[0].u.Port.Length = portSpan;
pRRList->List[0].Descriptors[0].u.Port.Alignment = FILE_WORD_ALIGNMENT;
maxPortAddr.QuadPart = portBase;
pRRList->List[0].Descriptors[0].u.Port.MinimumAddress = maxPortAddr;
maxPortAddr.LowPart += portSpan-1;
pRRList->List[0].Descriptors[0].u.Port.MaximumAddress = maxPortAddr;
pRRList->List[0].Descriptors[1].Type = CmResourceTypeInterrupt;
pRRList->List[0].Descriptors[1].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[1].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
pRRList->List[0].Descriptors[1].u.Interrupt.MinimumVector = Irq;
pRRList->List[0].Descriptors[1].u.Interrupt.MaximumVector = Irq;

status = IoReportDetectedDevice(
pDriverObj, // DriverObject
Isa, // Bus type
-1, // Bus number
-1, // SlotNumber
NULL, // Driver RESOURCE_LIST
pRRList, // Device Resource List
FALSE, // Already claimed?
&pDevObj ); // device object

// Result: status = STATUS_NO_SUCH_DEVICE

ExFreePool(pRRList);
return status;
}

Function is called from DriverEntry. BIOS parallel port settings are:
Parallel port 378
Port Mode Normal
IRQ 7
Operating system: WinXP professional.

Is this code OK? Possibly there is conflict with existing parallel port driver. I tried to
prevent this disabling LPT1 in the Device Manager or uninstalling existing parallel port
driver. However, this doesn’t help and my driver cannot be loaded.

Note: I ask this question second time, possibly first question was too long and not clear. I hope this is not violation of message list rules. Thanks.


Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

This is sample driver from “The Windows 2000 Device Driver Book”. Hardware detection way will be improved in the next samples, but this driver works by such way. Is it possible to make it working? To change something in the code or in computer settings? It is really difficult to learn the program without having it running.

“Maxim S. Shatskih” wrote:
Such hardware claims will not work for PnP hardware (which is your parallel port on ACPI mobos).

They are long ago obsolete, and I’m very much surprised that somebody suggested them for w2k.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Wednesday, October 27, 2004 9:00 PM
Subject: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

I have the following function which tries to get access to parallel port:

NTSTATUS ClaimHardware( PDRIVER_OBJECT pDriverObj,
PDEVICE_OBJECT pDevObj,
ULONG portBase, // 0x378
ULONG portSpan, // 0x4
ULONG Irq) // 0x7
{
NTSTATUS status;
PHYSICAL_ADDRESS maxPortAddr;
PIO_RESOURCE_REQUIREMENTS_LIST pRRList;

int rrSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
sizeof(IO_RESOURCE_DESCRIPTOR);
pRRList = (PIO_RESOURCE_REQUIREMENTS_LIST)
ExAllocatePool(PagedPool, rrSize);

RtlZeroMemory(pRRList, rrSize);
pRRList->ListSize = rrSize;
pRRList->AlternativeLists = 1; // only 1 Resource List
pRRList->InterfaceType = Isa;
pRRList->List[0].Version = 1;
pRRList->List[0].Revision = 1;
pRRList->List[0].Count = 2; // 2 Resource Descriptors: port & irq
pRRList->List[0].Descriptors[0].Type = CmResourceTypePort;
pRRList->List[0].Descriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[0].Flags = CM_RESOURCE_PORT_IO;
pRRList->List[0].Descriptors[0].u.Port.Length = portSpan;
pRRList->List[0].Descriptors[0].u.Port.Alignment = FILE_WORD_ALIGNMENT;
maxPortAddr.QuadPart = portBase;
pRRList->List[0].Descriptors[0].u.Port.MinimumAddress = maxPortAddr;
maxPortAddr.LowPart += portSpan-1;
pRRList->List[0].Descriptors[0].u.Port.MaximumAddress = maxPortAddr;
pRRList->List[0].Descriptors[1].Type = CmResourceTypeInterrupt;
pRRList->List[0].Descriptors[1].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[1].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
pRRList->List[0].Descriptors[1].u.Interrupt.MinimumVector = Irq;
pRRList->List[0].Descriptors[1].u.Interrupt.MaximumVector = Irq;

status = IoReportDetectedDevice(
pDriverObj, // DriverObject
Isa, // Bus type
-1, // Bus number
-1, // SlotNumber
NULL, // Driver RESOURCE_LIST
pRRList, // Device Resource List
FALSE, // Already claimed?
&pDevObj ); // device object

// Result: status = STATUS_NO_SUCH_DEVICE

ExFreePool(pRRList);
return status;
}

Function is called from DriverEntry. BIOS parallel port settings are:
Parallel port 378
Port Mode Normal
IRQ 7
Operating system: WinXP professional.

Is this code OK? Possibly there is conflict with existing parallel port driver. I tried to
prevent this disabling LPT1 in the Device Manager or uninstalling existing parallel port
driver. However, this doesn’t help and my driver cannot be loaded.

Note: I ask this question second time, possibly first question was too long and not clear. I hope this is not violation of message list rules. Thanks.

---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

Try Walter Oney’s book instead. At least it has correct code for working with hardware resources.

There is no more such thing as “hardware detection” for PnP hardware, and the parallel port is the PnP hardware if the machine is ACPI-compatible.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Thursday, October 28, 2004 11:10 AM
Subject: Re: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

This is sample driver from “The Windows 2000 Device Driver Book”. Hardware detection way will be improved in the next samples, but this driver works by such way. Is it possible to make it working? To change something in the code or in computer settings? It is really difficult to learn the program without having it running.

“Maxim S. Shatskih” wrote:
Such hardware claims will not work for PnP hardware (which is your parallel port on ACPI mobos).

They are long ago obsolete, and I’m very much surprised that somebody suggested them for w2k.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Wednesday, October 27, 2004 9:00 PM
Subject: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

I have the following function which tries to get access to parallel port:

NTSTATUS ClaimHardware( PDRIVER_OBJECT pDriverObj,
PDEVICE_OBJECT pDevObj,
ULONG portBase, // 0x378
ULONG portSpan, // 0x4
ULONG Irq) // 0x7
{
NTSTATUS status;
PHYSICAL_ADDRESS maxPortAddr;
PIO_RESOURCE_REQUIREMENTS_LIST pRRList;

int rrSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
sizeof(IO_RESOURCE_DESCRIPTOR);
pRRList = (PIO_RESOURCE_REQUIREMENTS_LIST)
ExAllocatePool(PagedPool, rrSize);

RtlZeroMemory(pRRList, rrSize);
pRRList->ListSize = rrSize;
pRRList->AlternativeLists = 1; // only 1 Resource List
pRRList->InterfaceType = Isa;
pRRList->List[0].Version = 1;
pRRList->List[0].Revision = 1;
pRRList->List[0].Count = 2; // 2 Resource Descriptors: port & irq
pRRList->List[0].Descriptors[0].Type = CmResourceTypePort;
pRRList->List[0].Descriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[0].Flags = CM_RESOURCE_PORT_IO;
pRRList->List[0].Descriptors[0].u.Port.Length = portSpan;
pRRList->List[0].Descriptors[0].u.Port.Alignment = FILE_WORD_ALIGNMENT;
maxPortAddr.QuadPart = portBase;
pRRList->List[0].Descriptors[0].u.Port.MinimumAddress = maxPortAddr;
maxPortAddr.LowPart += portSpan-1;
pRRList->List[0].Descriptors[0].u.Port.MaximumAddress = maxPortAddr;
pRRList->List[0].Descriptors[1].Type = CmResourceTypeInterrupt;
pRRList->List[0].Descriptors[1].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[1].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
pRRList->List[0].Descriptors[1].u.Interrupt.MinimumVector = Irq;
pRRList->List[0].Descriptors[1].u.Interrupt.MaximumVector = Irq;

status = IoReportDetectedDevice(
pDriverObj, // DriverObject
Isa, // Bus type
-1, // Bus number
-1, // SlotNumber
NULL, // Driver RESOURCE_LIST
pRRList, // Device Resource List
FALSE, // Already claimed?
&pDevObj ); // device object

// Result: status = STATUS_NO_SUCH_DEVICE

ExFreePool(pRRList);
return status;
}

Function is called from DriverEntry. BIOS parallel port settings are:
Parallel port 378
Port Mode Normal
IRQ 7
Operating system: WinXP professional.

Is this code OK? Possibly there is conflict with existing parallel port driver. I tried to
prevent this disabling LPT1 in the Device Manager or uninstalling existing parallel port
driver. However, this doesn’t help and my driver cannot be loaded.

Note: I ask this question second time, possibly first question was too long and not clear. I hope this is not violation of message list rules. Thanks.

--------------------------------------------------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

------------------------------------------------------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Thank you very much for your answer.

Do you mean this book: http://www.amazon.com/exec/obidos/tg/detail/-/0735618038/104-8280857-7419137?v=glance ?

Before I get it, I want to continue with Baker’s book. Is there any chance to get this driver working under Windows NT? I need to start with something working. Another question: next sample from Baker’s book is the same parallel port driver with PnP support. This is a way it is registered:

REGEDIT4
[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MINPNP]
“Start”=dword:3
“Type”=dword:1
“ErrorControl”=dword:1
“DisplayName”=“Chapter 9 Minimal PnP Driver”
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4D36E978-E325-11CE-BFC1-08002BE10318}]
“UpperFilters”=“MINPNP”

Driver is properly built and copied to System32\Drivers directory. But after reboot computer disables COM1, COM2 and LPT ports showing driver error. Driver is not loaded. What may be reason for this? When I open Driver Details for LPT port in Device Manager, it shows MinPnP driver unchecked and original parport.sys checked.

“Maxim S. Shatskih” wrote:
Try Walter Oney’s book instead. At least it has correct code for working with hardware resources.

There is no more such thing as “hardware detection” for PnP hardware, and the parallel port is the PnP hardware if the machine is ACPI-compatible.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Thursday, October 28, 2004 11:10 AM
Subject: Re: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

This is sample driver from “The Windows 2000 Device Driver Book”. Hardware detection way will be improved in the next samples, but this driver works by such way. Is it possible to make it working? To change something in the code or in computer settings? It is really difficult to learn the program without having it running.

“Maxim S. Shatskih” wrote:
Such hardware claims will not work for PnP hardware (which is your parallel port on ACPI mobos).

They are long ago obsolete, and I’m very much surprised that somebody suggested them for w2k.

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

----- Original Message -----
From: Xela R
To: Windows System Software Devs Interest List
Sent: Wednesday, October 27, 2004 9:00 PM
Subject: [ntdev] IoReportDetectedDevice return STATUS_NO_SUCH_DEVICE

I have the following function which tries to get access to parallel port:

NTSTATUS ClaimHardware( PDRIVER_OBJECT pDriverObj,
PDEVICE_OBJECT pDevObj,
ULONG portBase, // 0x378
ULONG portSpan, // 0x4
ULONG Irq) // 0x7
{
NTSTATUS status;
PHYSICAL_ADDRESS maxPortAddr;
PIO_RESOURCE_REQUIREMENTS_LIST pRRList;

int rrSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) +
sizeof(IO_RESOURCE_DESCRIPTOR);
pRRList = (PIO_RESOURCE_REQUIREMENTS_LIST)
ExAllocatePool(PagedPool, rrSize);

RtlZeroMemory(pRRList, rrSize);
pRRList->ListSize = rrSize;
pRRList->AlternativeLists = 1; // only 1 Resource List
pRRList->InterfaceType = Isa;
pRRList->List[0].Version = 1;
pRRList->List[0].Revision = 1;
pRRList->List[0].Count = 2; // 2 Resource Descriptors: port & irq
pRRList->List[0].Descriptors[0].Type = CmResourceTypePort;
pRRList->List[0].Descriptors[0].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[0].Flags = CM_RESOURCE_PORT_IO;
pRRList->List[0].Descriptors[0].u.Port.Length = portSpan;
pRRList->List[0].Descriptors[0].u.Port.Alignment = FILE_WORD_ALIGNMENT;
maxPortAddr.QuadPart = portBase;
pRRList->List[0].Descriptors[0].u.Port.MinimumAddress = maxPortAddr;
maxPortAddr.LowPart += portSpan-1;
pRRList->List[0].Descriptors[0].u.Port.MaximumAddress = maxPortAddr;
pRRList->List[0].Descriptors[1].Type = CmResourceTypeInterrupt;
pRRList->List[0].Descriptors[1].ShareDisposition = CmResourceShareDeviceExclusive;
pRRList->List[0].Descriptors[1].Flags = CM_RESOURCE_INTERRUPT_LATCHED;
pRRList->List[0].Descriptors[1].u.Interrupt.MinimumVector = Irq;
pRRList->List[0].Descriptors[1].u.Interrupt.MaximumVector = Irq;

status = IoReportDetectedDevice(
pDriverObj, // DriverObject
Isa, // Bus type
-1, // Bus number
-1, // SlotNumber
NULL, // Driver RESOURCE_LIST
pRRList, // Device Resource List
FALSE, // Already claimed?
&pDevObj ); // device object

// Result: status = STATUS_NO_SUCH_DEVICE

ExFreePool(pRRList);
return status;
}

Function is called from DriverEntry. BIOS parallel port settings are:
Parallel port 378
Port Mode Normal
IRQ 7
Operating system: WinXP professional.

Is this code OK? Possibly there is conflict with existing parallel port driver. I tried to
prevent this disabling LPT1 in the Device Manager or uninstalling existing parallel port
driver. However, this doesn’t help and my driver cannot be loaded.

Note: I ask this question second time, possibly first question was too long and not clear. I hope this is not violation of message list rules. Thanks.

---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.