- Fix incompatibility: In Windows IoGetDeviceProperty(DevicePropertyAddress) returns information as 0xDDDDFFFF (D=Device, F=Function) and not as a PCI_SLOT_NUMBER structure. This is confirmed by tests in Windows XP and 2003, and also found via Google.

- Fix incorrect usage of DevicePropertyAddress in videoprt and ndis (thus ndis.sys+pcnet.sys load [again] in Windows XP).

svn path=/trunk/; revision=27290
This commit is contained in:
Aleksey Bragin 2007-06-27 18:05:04 +00:00
parent 2beeeef110
commit 57e548bec4
3 changed files with 25 additions and 2 deletions

View file

@ -157,6 +157,7 @@ PdoQueryCapabilities(
{ {
PPDO_DEVICE_EXTENSION DeviceExtension; PPDO_DEVICE_EXTENSION DeviceExtension;
PDEVICE_CAPABILITIES DeviceCapabilities; PDEVICE_CAPABILITIES DeviceCapabilities;
ULONG DeviceNumber, FunctionNumber;
DPRINT("Called\n"); DPRINT("Called\n");
@ -166,8 +167,11 @@ PdoQueryCapabilities(
if (DeviceCapabilities->Version != 1) if (DeviceCapabilities->Version != 1)
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
DeviceNumber = DeviceExtension->PciDevice->SlotNumber.u.bits.DeviceNumber;
FunctionNumber = DeviceExtension->PciDevice->SlotNumber.u.bits.FunctionNumber;
DeviceCapabilities->UniqueID = FALSE; DeviceCapabilities->UniqueID = FALSE;
DeviceCapabilities->Address = DeviceExtension->PciDevice->SlotNumber.u.AsULONG; DeviceCapabilities->Address = ((DeviceNumber << 16) & 0xFFFF0000) + (FunctionNumber & 0xFFFF);
DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */ DeviceCapabilities->UINumber = (ULONG)-1; /* FIXME */
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -1404,7 +1404,18 @@ NdisIPnPStartDevice(
else else
Adapter->NdisMiniportBlock.SlotNumber = 0; Adapter->NdisMiniportBlock.SlotNumber = 0;
} }
else
{
/* Convert slotnumber to PCI_SLOT_NUMBER */
ULONG PciSlotNumber = Adapter->NdisMiniportBlock.SlotNumber;
PCI_SLOT_NUMBER SlotNumber;
SlotNumber.u.AsULONG = 0;
SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
Adapter->NdisMiniportBlock.SlotNumber = SlotNumber.u.AsULONG;
}
NdisCloseConfiguration(ConfigHandle); NdisCloseConfiguration(ConfigHandle);
/* /*

View file

@ -227,6 +227,8 @@ IntVideoPortCreateAdapterDeviceObject(
{ {
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
ULONG DeviceNumber; ULONG DeviceNumber;
ULONG PciSlotNumber;
PCI_SLOT_NUMBER SlotNumber;
ULONG Size; ULONG Size;
NTSTATUS Status; NTSTATUS Status;
WCHAR DeviceBuffer[20]; WCHAR DeviceBuffer[20];
@ -345,8 +347,14 @@ IntVideoPortCreateAdapterDeviceObject(
PhysicalDeviceObject, PhysicalDeviceObject,
DevicePropertyAddress, DevicePropertyAddress,
Size, Size,
&DeviceExtension->SystemIoSlotNumber, &PciSlotNumber,
&Size); &Size);
/* Convert slotnumber to PCI_SLOT_NUMBER */
SlotNumber.u.AsULONG = 0;
SlotNumber.u.bits.DeviceNumber = (PciSlotNumber >> 16) & 0xFFFF;
SlotNumber.u.bits.FunctionNumber = PciSlotNumber & 0xFFFF;
DeviceExtension->SystemIoSlotNumber = SlotNumber.u.AsULONG;
} }
InitializeListHead(&DeviceExtension->AddressMappingListHead); InitializeListHead(&DeviceExtension->AddressMappingListHead);