- Fix DEVICE_NODE definition to remove ROS-only fields

- Move RTL_HEAP_PARAMETERS to umtypes.h
- Fix PROCESS_PRIORITY_CLASS_XXX definitions.
- Use PROCESS_PRIORITY_CLASS_INVALID in process creation code.
- Move and correct EX_PUSH_LOCK definition to ntifs.h
- Define KQUEUE along with KAPC_STATE if ntifs.h is not used, so that we don't force its usage
- Enable usage of EX_QUEUE_WORKER_INFO and EX_WORK_QUEUE without requiring the IFS.
- Fix definition of CsrClientConnectToServer
- Update NDK FIXME list
- Define and use a list of Bus Type GUIDs instead of saving the GUID in a ROS-only field of DEVICE_NODE.
- Use a IRP_MN_QUERY_CAPABILITIES PnP IRP to get the Address of a DeviceNode, intead of saving it inside a ROS-only field.

svn path=/trunk/; revision=17272
This commit is contained in:
Alex Ionescu 2005-08-11 00:01:17 +00:00
parent 4a6a9d5dd2
commit be97362b23
13 changed files with 239 additions and 113 deletions

View file

@ -38,10 +38,9 @@ extern NTOSAPI POBJECT_TYPE ExTimerType;
/* You'll need the IFS for this, so use an equivalent version */ /* You'll need the IFS for this, so use an equivalent version */
#ifndef _NTIFS_ #ifndef _NTIFS_
typedef PVOID EX_RUNDOWN_REF; typedef PVOID EX_RUNDOWN_REF;
typedef PVOID EX_PUSH_LOCK;
#endif #endif
/* You'll need the IFS for these, so let's not force everyone to have it */
#ifdef _NTIFS_
typedef struct _EX_QUEUE_WORKER_INFO typedef struct _EX_QUEUE_WORKER_INFO
{ {
UCHAR QueueDisabled:1; UCHAR QueueDisabled:1;
@ -59,7 +58,6 @@ typedef struct _EX_WORK_QUEUE
ULONG QueueDepthLastPass; ULONG QueueDepthLastPass;
EX_QUEUE_WORKER_INFO Info; EX_QUEUE_WORKER_INFO Info;
} EX_WORK_QUEUE, *PEX_WORK_QUEUE; } EX_WORK_QUEUE, *PEX_WORK_QUEUE;
#endif
typedef struct _EX_FAST_REF typedef struct _EX_FAST_REF
{ {
@ -71,21 +69,6 @@ typedef struct _EX_FAST_REF
}; };
} EX_FAST_REF, *PEX_FAST_REF; } EX_FAST_REF, *PEX_FAST_REF;
typedef struct _EX_PUSH_LOCK
{
union
{
struct
{
ULONG Waiting:1;
ULONG Exclusive:1;
ULONG Shared:30;
};
ULONG Value;
PVOID Ptr;
};
} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
typedef struct _HANDLE_TABLE_ENTRY_INFO typedef struct _HANDLE_TABLE_ENTRY_INFO
{ {
ULONG AuditMask; ULONG AuditMask;

View file

@ -2,8 +2,8 @@ NDK FIXMES
----------- -----------
Order: Order:
* Priority 1 = Easiest to fix. * Priority 1 = Most important to fix.
* Priority 5 = Hardest to fix. * Priority 5 = Least important to fix.
Format: Format:
<Priority Level> <Priority Level>
@ -19,7 +19,7 @@ List:
- FIXED: Some files need cleanup (Alex + Eric) [zwfuncs.h, rtlfuncs.h, rtltypes.h] - FIXED: Some files need cleanup (Alex + Eric) [zwfuncs.h, rtlfuncs.h, rtltypes.h]
Priority 2: Priority 2:
- DEVICE_NODE has 2 fields not part of NT's defintion [iotypes.h] - FIXED: DEVICE_NODE has 2 fields not part of NT's defintion (Alex) [iotypes.h]
- Object Callbacks don't match NT's (Alex) [obtypes.h] - Object Callbacks don't match NT's (Alex) [obtypes.h]
- Remove Create Callback Hack (Alex) [obtypes.h] - Remove Create Callback Hack (Alex) [obtypes.h]
- Object header doesn't match NT (Alex) [obtypes.h] blocks on -> - Object header doesn't match NT (Alex) [obtypes.h] blocks on ->
@ -32,9 +32,9 @@ List:
Priority 4: Priority 4:
- FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h] - FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h]
- Win32K Builds with windows.h (Filip, bugzilla id 666) [extypes.h, ketypes.h] - FIXED: Win32K Builds with windows.h (Filip) [extypes.h, ketypes.h]
Priority 5: Priority 5:
- LPC Types are totally wrong. [lpctypes.h] - LPC Types are totally wrong. [lpctypes.h]
- Missing System Info Classes [zwtypes.h] - Missing System Info Classes [zwtypes.h]
- Process Priority Classes are messed up (Alex) [pstypes.h] - FIXED: Process Priority Classes are messed up (Alex) [pstypes.h]

View file

@ -207,10 +207,6 @@ typedef struct _DEVICE_NODE
ULONG DriverUnloadRetryCount; ULONG DriverUnloadRetryCount;
struct _DEVICE_NODE *PreviousParent; struct _DEVICE_NODE *PreviousParent;
ULONG DeletedChidren; ULONG DeletedChidren;
/* FIXME: Not NT's */
GUID BusTypeGuid;
ULONG Address;
} DEVICE_NODE, *PDEVICE_NODE; } DEVICE_NODE, *PDEVICE_NODE;
typedef struct _PI_RESOURCE_ARBITER_ENTRY typedef struct _PI_RESOURCE_ARBITER_ENTRY

View file

@ -63,7 +63,7 @@ typedef enum _KAPC_ENVIRONMENT
CurrentApcEnvironment CurrentApcEnvironment
} KAPC_ENVIRONMENT; } KAPC_ENVIRONMENT;
/* We don't want to force NTIFS usage only for a single structure */ /* We don't want to force NTIFS usage only for two structures */
#ifndef _NTIFS_ #ifndef _NTIFS_
typedef struct _KAPC_STATE typedef struct _KAPC_STATE
{ {
@ -73,6 +73,15 @@ typedef struct _KAPC_STATE
BOOLEAN KernelApcPending; BOOLEAN KernelApcPending;
BOOLEAN UserApcPending; BOOLEAN UserApcPending;
} KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE; } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
typedef struct _KQUEUE
{
DISPATCHER_HEADER Header;
LIST_ENTRY EntryListHead;
ULONG CurrentCount;
ULONG MaximumCount;
LIST_ENTRY ThreadListHead;
} KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
#endif #endif
typedef struct _KNODE typedef struct _KNODE

View file

@ -36,12 +36,13 @@ extern NTOSAPI POBJECT_TYPE PsThreadType;
#define USER_SHARED_DATA (0x7FFE0000) #define USER_SHARED_DATA (0x7FFE0000)
/* Process priority classes */ /* Process priority classes */
#define PROCESS_PRIORITY_CLASS_IDLE 0 #define PROCESS_PRIORITY_CLASS_INVALID 0
#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL 1 #define PROCESS_PRIORITY_CLASS_IDLE 1
#define PROCESS_PRIORITY_CLASS_NORMAL 2 #define PROCESS_PRIORITY_CLASS_NORMAL 2
#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL 3 #define PROCESS_PRIORITY_CLASS_HIGH 3
#define PROCESS_PRIORITY_CLASS_HIGH 4 #define PROCESS_PRIORITY_CLASS_REALTIME 4
#define PROCESS_PRIORITY_CLASS_REALTIME 5 #define PROCESS_PRIORITY_CLASS_BELOW_NORMAL 5
#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL 6
/* Global Flags */ /* Global Flags */
#define FLG_STOP_ON_EXCEPTION 0x00000001 #define FLG_STOP_ON_EXCEPTION 0x00000001

View file

@ -40,11 +40,11 @@
#define EXCEPTION_TARGET_UNWIND 0x20 #define EXCEPTION_TARGET_UNWIND 0x20
#define EXCEPTION_COLLIDED_UNWIND 0x20 #define EXCEPTION_COLLIDED_UNWIND 0x20
#define EH_NONCONTINUABLE 0x01 #define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02 #define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04 #define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08 #define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10 #define EH_NESTED_CALL 0x10
#define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001 #define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
#define RTL_RANGE_LIST_ADD_SHARED 0x00000002 #define RTL_RANGE_LIST_ADD_SHARED 0x00000002
@ -109,20 +109,16 @@ typedef VOID
PVOID Parameter PVOID Parameter
); );
#ifndef _NTIFS_
typedef NTSTATUS
(NTAPI * PRTL_HEAP_COMMIT_ROUTINE) (
IN PVOID Base,
IN OUT PVOID *CommitAddress,
IN OUT PSIZE_T CommitSize
);
#endif
/* TYPES *********************************************************************/ /* TYPES *********************************************************************/
typedef unsigned short RTL_ATOM; typedef unsigned short RTL_ATOM;
typedef unsigned short *PRTL_ATOM; typedef unsigned short *PRTL_ATOM;
/* Once again, we don't want to force NTIFS for something like this */
#if !defined(_NTIFS_) && !defined(NTOS_MODE_USER)
typedef PVOID PRTL_HEAP_PARAMETERS;
#endif
typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
typedef struct _ACE typedef struct _ACE
@ -402,22 +398,6 @@ typedef struct _RTL_ATOM_TABLE
PRTL_ATOM_TABLE_ENTRY Buckets[1]; PRTL_ATOM_TABLE_ENTRY Buckets[1];
} RTL_ATOM_TABLE, *PRTL_ATOM_TABLE; } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
#ifndef _NTIFS_
typedef struct _RTL_HEAP_PARAMETERS {
ULONG Length;
SIZE_T SegmentReserve;
SIZE_T SegmentCommit;
SIZE_T DeCommitFreeBlockThreshold;
SIZE_T DeCommitTotalFreeThreshold;
SIZE_T MaximumAllocationSize;
SIZE_T VirtualMemoryThreshold;
SIZE_T InitialCommit;
SIZE_T InitialReserve;
PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
SIZE_T Reserved[2];
} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
#endif
/* Let Kernel Drivers use this */ /* Let Kernel Drivers use this */
#ifndef _WINBASE_ #ifndef _WINBASE_
typedef struct _SYSTEMTIME typedef struct _SYSTEMTIME

View file

@ -25,7 +25,7 @@ CsrClientConnectToServer(
PVOID Unknown, PVOID Unknown,
PVOID Context, PVOID Context,
ULONG ContextLength, ULONG ContextLength,
PULONG Unknown2 PBOOLEAN ServerToServerCall
); );
NTSTATUS NTSTATUS

View file

@ -48,7 +48,7 @@
#define NT_WARNING(x) ((ULONG)(x)>>30==2) #define NT_WARNING(x) ((ULONG)(x)>>30==2)
#define NT_ERROR(x) ((ULONG)(x)>>30==3) #define NT_ERROR(x) ((ULONG)(x)>>30==3)
/* Object Access Rights FIXME: Some are in w32api's psdk..,is that normal ?*/ /* Object Access Rights */
#define DIRECTORY_QUERY (0x0001) #define DIRECTORY_QUERY (0x0001)
#define DIRECTORY_TRAVERSE (0x0002) #define DIRECTORY_TRAVERSE (0x0002)
#define DIRECTORY_CREATE_OBJECT (0x0004) #define DIRECTORY_CREATE_OBJECT (0x0004)
@ -1418,7 +1418,28 @@ typedef struct _UNICODE_PREFIX_TABLE
PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry; PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
} UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE; } UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
/* FIXME - need FAST_MUTEX and PHANDLE_TABLE for RTL_ATOM_TABLE in umode! */ typedef NTSTATUS
(NTAPI * PRTL_HEAP_COMMIT_ROUTINE)(
IN PVOID Base,
IN OUT PVOID *CommitAddress,
IN OUT PSIZE_T CommitSize
);
typedef struct _RTL_HEAP_PARAMETERS
{
ULONG Length;
SIZE_T SegmentReserve;
SIZE_T SegmentCommit;
SIZE_T DeCommitFreeBlockThreshold;
SIZE_T DeCommitTotalFreeThreshold;
SIZE_T MaximumAllocationSize;
SIZE_T VirtualMemoryThreshold;
SIZE_T InitialCommit;
SIZE_T InitialReserve;
PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
SIZE_T Reserved[2];
} RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
typedef void *FAST_MUTEX; typedef void *FAST_MUTEX;
typedef void *PHANDLE_TABLE; typedef void *PHANDLE_TABLE;

View file

@ -263,7 +263,7 @@ BasepConvertPriorityClass(IN ULONG dwCreationFlags)
} }
else else
{ {
ReturnClass = 0 /* FIXME */; ReturnClass = PROCESS_PRIORITY_CLASS_INVALID;
} }
return ReturnClass; return ReturnClass;

View file

@ -107,7 +107,7 @@ CsrClientConnectToServer(PWSTR ObjectDirectory,
PVOID Unknown, PVOID Unknown,
PVOID Context, PVOID Context,
ULONG ContextLength, ULONG ContextLength,
PULONG Unknown2) PBOOLEAN ServerToServerCall)
{ {
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING PortName = RTL_CONSTANT_STRING(L"\\Windows\\ApiPort"); UNICODE_STRING PortName = RTL_CONSTANT_STRING(L"\\Windows\\ApiPort");

View file

@ -23,6 +23,15 @@ typedef struct _IO_COMPLETION_PACKET
IO_STATUS_BLOCK IoStatus; IO_STATUS_BLOCK IoStatus;
} IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET; } IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET;
/* List of Bus Type GUIDs */
typedef struct _IO_BUS_TYPE_GUID_LIST
{
ULONG GuidCount;
FAST_MUTEX Lock;
GUID Guids[1];
} IO_BUS_TYPE_GUID_LIST, *PIO_BUS_TYPE_GUID_LIST;
extern PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList;
/* Packet Types */ /* Packet Types */
#define IrpCompletionPacket 0x1 #define IrpCompletionPacket 0x1
#define IrpMiniCompletionPacket 0x2 #define IrpMiniCompletionPacket 0x2

View file

@ -22,6 +22,7 @@ KSPIN_LOCK IopDeviceTreeLock;
/* DATA **********************************************************************/ /* DATA **********************************************************************/
PDRIVER_OBJECT IopRootDriverObject; PDRIVER_OBJECT IopRootDriverObject;
PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList = NULL;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
@ -32,6 +33,32 @@ IopGetDeviceNode(
return DeviceObject->DeviceObjectExtension->DeviceNode; return DeviceObject->DeviceObjectExtension->DeviceNode;
} }
NTSTATUS
STDCALL
IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode,
PDEVICE_CAPABILITIES DeviceCaps)
{
IO_STATUS_BLOCK StatusBlock;
IO_STACK_LOCATION Stack;
/* Set up the Header */
RtlZeroMemory(DeviceCaps, sizeof(DEVICE_CAPABILITIES));
DeviceCaps->Size = sizeof(DEVICE_CAPABILITIES);
DeviceCaps->Version = 1;
DeviceCaps->Address = -1;
DeviceCaps->UINumber = -1;
/* Set up the Stack */
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.Parameters.DeviceCapabilities.Capabilities = DeviceCaps;
/* Send the IRP */
return IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject,
&StatusBlock,
IRP_MN_QUERY_CAPABILITIES,
&Stack);
}
/* /*
* @implemented * @implemented
*/ */
@ -57,9 +84,11 @@ IoGetDeviceProperty(
OUT PULONG ResultLength) OUT PULONG ResultLength)
{ {
PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject);
DEVICE_CAPABILITIES DeviceCaps;
ULONG Length; ULONG Length;
PVOID Data = NULL; PVOID Data = NULL;
PWSTR Ptr; PWSTR Ptr;
NTSTATUS Status;
DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty); DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty);
@ -75,23 +104,30 @@ IoGetDeviceProperty(
/* Complete, untested */ /* Complete, untested */
case DevicePropertyBusTypeGuid: case DevicePropertyBusTypeGuid:
*ResultLength = 39 * sizeof(WCHAR); /* Sanity check */
if (BufferLength < (39 * sizeof(WCHAR))) if ((DeviceNode->ChildBusTypeIndex != 0xFFFF) &&
return STATUS_BUFFER_TOO_SMALL; (DeviceNode->ChildBusTypeIndex < IopBusTypeGuidList->GuidCount))
swprintf((PWSTR)PropertyBuffer, {
L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", /* Return the GUID */
DeviceNode->BusTypeGuid.Data1, *ResultLength = sizeof(GUID);
DeviceNode->BusTypeGuid.Data2,
DeviceNode->BusTypeGuid.Data3, /* Check if the buffer given was large enough */
DeviceNode->BusTypeGuid.Data4[0], if (BufferLength < *ResultLength)
DeviceNode->BusTypeGuid.Data4[1], {
DeviceNode->BusTypeGuid.Data4[2], return STATUS_BUFFER_TOO_SMALL;
DeviceNode->BusTypeGuid.Data4[3], }
DeviceNode->BusTypeGuid.Data4[4],
DeviceNode->BusTypeGuid.Data4[5], /* Copy the GUID */
DeviceNode->BusTypeGuid.Data4[6], RtlCopyMemory(PropertyBuffer,
DeviceNode->BusTypeGuid.Data4[7]); &(IopBusTypeGuidList->Guids[DeviceNode->ChildBusTypeIndex]),
return STATUS_SUCCESS; sizeof(GUID));
return STATUS_SUCCESS;
}
else
{
return STATUS_OBJECT_NAME_NOT_FOUND;
}
break;
case DevicePropertyLegacyBusType: case DevicePropertyLegacyBusType:
Length = sizeof(INTERFACE_TYPE); Length = sizeof(INTERFACE_TYPE);
@ -99,9 +135,29 @@ IoGetDeviceProperty(
break; break;
case DevicePropertyAddress: case DevicePropertyAddress:
Length = sizeof(ULONG);
Data = &DeviceNode->Address; /* Query the device caps */
break; Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps);
if (NT_SUCCESS(Status) && (DeviceCaps.Address != -1))
{
/* Return length */
*ResultLength = sizeof(ULONG);
/* Check if the buffer given was large enough */
if (BufferLength < *ResultLength)
{
return STATUS_BUFFER_TOO_SMALL;
}
/* Return address */
*(PULONG)PropertyBuffer = DeviceCaps.Address;
return STATUS_SUCCESS;
}
else
{
return STATUS_OBJECT_NAME_NOT_FOUND;
}
break;
// case DevicePropertyUINumber: // case DevicePropertyUINumber:
// if (DeviceNode->CapabilityFlags == NULL) // if (DeviceNode->CapabilityFlags == NULL)
@ -453,6 +509,66 @@ IopGetSystemPowerDeviceObject(PDEVICE_OBJECT *DeviceObject)
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
USHORT
STDCALL
IopGetBusTypeGuidIndex(LPGUID BusTypeGuid)
{
USHORT i = 0, FoundIndex = 0xFFFF;
ULONG NewSize;
PVOID NewList;
/* Acquire the lock */
ExAcquireFastMutex(&IopBusTypeGuidList->Lock);
/* Loop all entries */
while (i < IopBusTypeGuidList->GuidCount)
{
/* Try to find a match */
if (RtlCompareMemory(BusTypeGuid,
&IopBusTypeGuidList->Guids[i],
sizeof(GUID)))
{
/* Found it */
FoundIndex = i;
goto Quickie;
}
}
/* Check if we have to grow the list */
if (IopBusTypeGuidList->GuidCount)
{
/* Calculate the new size */
NewSize = sizeof(IO_BUS_TYPE_GUID_LIST) +
(sizeof(GUID) * IopBusTypeGuidList->GuidCount);
/* Allocate the new copy */
NewList = ExAllocatePool(PagedPool, NewSize);
/* Now copy them, decrease the size too */
NewSize -= sizeof(GUID);
RtlCopyMemory(NewList, IopBusTypeGuidList, NewSize);
/* Free the old list */
ExFreePool(IopBusTypeGuidList);
/* Use the new buffer */
IopBusTypeGuidList = NewList;
}
/* Copy the new GUID */
RtlCopyMemory(&IopBusTypeGuidList->Guids[IopBusTypeGuidList->GuidCount],
BusTypeGuid,
sizeof(GUID));
/* The new entry is the index */
FoundIndex = IopBusTypeGuidList->GuidCount;
IopBusTypeGuidList->GuidCount++;
Quickie:
ExReleaseFastMutex(&IopBusTypeGuidList->Lock);
return FoundIndex;
}
/* /*
* DESCRIPTION * DESCRIPTION
* Creates a device node * Creates a device node
@ -1212,28 +1328,13 @@ IopActionInterrogateDeviceStack(
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
} }
RtlZeroMemory(&DeviceCapabilities, sizeof(DEVICE_CAPABILITIES)); Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities);
DeviceCapabilities.Size = sizeof(DEVICE_CAPABILITIES);
DeviceCapabilities.Version = 1;
DeviceCapabilities.Address = -1;
DeviceCapabilities.UINumber = -1;
Stack.Parameters.DeviceCapabilities.Capabilities = &DeviceCapabilities;
Status = IopInitiatePnpIrp(
DeviceNode->PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_QUERY_CAPABILITIES,
&Stack);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{
}
else
{ {
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
} }
DeviceNode->CapabilityFlags = *(PULONG)((ULONG_PTR)&DeviceCapabilities + 4); DeviceNode->CapabilityFlags = *(PULONG)((ULONG_PTR)&DeviceCapabilities + 4);
DeviceNode->Address = DeviceCapabilities.Address;
if (!DeviceCapabilities.UniqueID) if (!DeviceCapabilities.UniqueID)
{ {
@ -1457,20 +1558,16 @@ IopActionInterrogateDeviceStack(
DeviceNode->ChildBusNumber = BusInformation->BusNumber; DeviceNode->ChildBusNumber = BusInformation->BusNumber;
DeviceNode->ChildInterfaceType = BusInformation->LegacyBusType; DeviceNode->ChildInterfaceType = BusInformation->LegacyBusType;
memcpy(&DeviceNode->BusTypeGuid, DeviceNode->ChildBusTypeIndex = IopGetBusTypeGuidIndex(&BusInformation->BusTypeGuid);
&BusInformation->BusTypeGuid,
sizeof(GUID));
ExFreePool(BusInformation); ExFreePool(BusInformation);
} }
else else
{ {
DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
DeviceNode->ChildBusNumber = -1; DeviceNode->ChildBusNumber = 0xFFFFFFF0;
DeviceNode->ChildInterfaceType = -1; DeviceNode->ChildInterfaceType = InterfaceTypeUndefined;
memset(&DeviceNode->BusTypeGuid, DeviceNode->ChildBusTypeIndex = -1;
0,
sizeof(GUID));
} }
DPRINT("Sending IRP_MN_QUERY_RESOURCES to device stack\n"); DPRINT("Sending IRP_MN_QUERY_RESOURCES to device stack\n");
@ -2026,6 +2123,11 @@ PnpInit(VOID)
KeInitializeSpinLock(&IopDeviceTreeLock); KeInitializeSpinLock(&IopDeviceTreeLock);
/* Initialize the Bus Type GUID List */
IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
RtlZeroMemory(IopBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
ExInitializeFastMutex(&IopBusTypeGuidList->Lock);
/* Initialize PnP-Event notification support */ /* Initialize PnP-Event notification support */
Status = IopInitPlugPlayEvents(); Status = IopInitPlugPlayEvents();
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -627,6 +627,31 @@ typedef struct _EX_RUNDOWN_REF {
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF; } EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
#define EX_PUSH_LOCK_LOCK_V ((ULONG_PTR)0x0)
#define EX_PUSH_LOCK_LOCK ((ULONG_PTR)0x1)
#define EX_PUSH_LOCK_WAITING ((ULONG_PTR)0x2)
#define EX_PUSH_LOCK_WAKING ((ULONG_PTR)0x4)
#define EX_PUSH_LOCK_MULTIPLE_SHARED ((ULONG_PTR)0x8)
#define EX_PUSH_LOCK_SHARE_INC ((ULONG_PTR)0x10)
#define EX_PUSH_LOCK_PTR_BITS ((ULONG_PTR)0xf)
typedef struct _EX_PUSH_LOCK
{
union
{
struct
{
ULONG_PTR Locked:1;
ULONG_PTR Waiting:1;
ULONG_PTR Waking:1;
ULONG_PTR MultipleShared:1;
ULONG_PTR Shared:sizeof (ULONG_PTR) * 8 - 4;
};
ULONG_PTR Value;
PVOID Ptr;
};
} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
typedef struct _FILE_ACCESS_INFORMATION { typedef struct _FILE_ACCESS_INFORMATION {
ACCESS_MASK AccessFlags; ACCESS_MASK AccessFlags;
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION; } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;