ReactOS  0.4.15-dev-341-g17c5fb8
pnpinit.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: ntoskrnl/io/pnpmgr/pnpinit.c
5  * PURPOSE: PnP Initialization Code
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 /* GLOBALS ********************************************************************/
16 
18 {
22 
26 
32 
38 
39 /* FUNCTIONS ******************************************************************/
40 
42 NTAPI
44 {
45  /* FIXME: ReactOS doesn't support MicroChannel yet */
46  return Isa;
47 }
48 
50 NTAPI
52 {
54 
56  if (!NT_SUCCESS(Status))
57  {
58  DPRINT1("IopPortInitialize() return %X\n", Status);
59  return Status;
60  }
61 
63  if (!NT_SUCCESS(Status))
64  {
65  DPRINT1("IopMemInitialize() return %X\n", Status);
66  return Status;
67  }
68 
70  if (!NT_SUCCESS(Status))
71  {
72  DPRINT1("IopDmaInitialize() return %X\n", Status);
73  return Status;
74  }
75 
77  if (!NT_SUCCESS(Status))
78  {
79  DPRINT1("IopIrqInitialize() return %X\n", Status);
80  return Status;
81  }
82 
84  if (!NT_SUCCESS(Status))
85  {
86  DPRINT1("IopBusNumberInitialize() return %X\n", Status);
87  }
88 
89  return Status;
90 }
91 
92 
93 INIT_FUNCTION
95 NTAPI
97 {
100  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
101  PUNICODE_STRING GroupTable;
102  ULONG Count;
103  UNICODE_STRING GroupString =
104  RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet"
105  L"\\Control\\ServiceGroupOrder");
106 
107  /* Open the registry key */
109  NULL,
110  &GroupString,
111  KEY_READ);
112  if (NT_SUCCESS(Status))
113  {
114  /* Get the list */
115  Status = IopGetRegistryValue(KeyHandle, L"List", &KeyValueInformation);
117 
118  /* Make sure we got it */
119  if (NT_SUCCESS(Status))
120  {
121  /* Make sure it's valid */
122  if ((KeyValueInformation->Type == REG_MULTI_SZ) &&
123  (KeyValueInformation->DataLength))
124  {
125  /* Convert it to unicode strings */
126  Status = PnpRegMultiSzToUnicodeStrings(KeyValueInformation,
127  &GroupTable,
128  &Count);
129 
130  /* Cache it for later */
131  PiInitGroupOrderTable = GroupTable;
133  }
134  else
135  {
136  /* Fail */
138  }
139 
140  /* Free the information */
141  ExFreePool(KeyValueInformation);
142  }
143  }
144 
145  /* Return status */
146  return Status;
147 }
148 
149 USHORT
150 NTAPI
152 {
154  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
155  USHORT i;
156  PVOID Buffer;
158  PAGED_CODE();
159 
160  /* Make sure we have a cache */
161  if (!PiInitGroupOrderTable) return -1;
162 
163  /* If we don't have a handle, the rest is easy -- return the count */
164  if (!ServiceHandle) return PiInitGroupOrderTableCount + 1;
165 
166  /* Otherwise, get the group value */
167  Status = IopGetRegistryValue(ServiceHandle, L"Group", &KeyValueInformation);
169 
170  /* Make sure we have a valid string */
171  ASSERT(KeyValueInformation->Type == REG_SZ);
172  ASSERT(KeyValueInformation->DataLength);
173 
174  /* Convert to unicode string */
175  Buffer = (PVOID)((ULONG_PTR)KeyValueInformation + KeyValueInformation->DataOffset);
176  PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &Group.Length);
177  Group.MaximumLength = (USHORT)KeyValueInformation->DataLength;
178  Group.Buffer = Buffer;
179 
180  /* Loop the groups */
181  for (i = 0; i < PiInitGroupOrderTableCount; i++)
182  {
183  /* Try to find a match */
185  }
186 
187  /* We're done */
188  ExFreePool(KeyValueInformation);
189  return i;
190 }
191 
192 USHORT
193 NTAPI
195 {
198  PKEY_VALUE_FULL_INFORMATION KeyValueInformation = NULL;
199  PKEY_VALUE_FULL_INFORMATION KeyValueInformationTag;
200  PKEY_VALUE_FULL_INFORMATION KeyValueInformationGroupOrderList;
201  PVOID Buffer;
203  PULONG GroupOrder;
204  ULONG Count, Tag = 0;
205  USHORT i = -1;
206  UNICODE_STRING GroupString =
207  RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet"
208  L"\\Control\\ServiceGroupOrder");
209 
210  /* Open the key */
211  Status = IopOpenRegistryKeyEx(&KeyHandle, NULL, &GroupString, KEY_READ);
212  if (!NT_SUCCESS(Status)) goto Quickie;
213 
214  /* Read the group */
215  Status = IopGetRegistryValue(ServiceHandle, L"Group", &KeyValueInformation);
216  if (!NT_SUCCESS(Status)) goto Quickie;
217 
218  /* Make sure we have a group */
219  if ((KeyValueInformation->Type == REG_SZ) &&
220  (KeyValueInformation->DataLength))
221  {
222  /* Convert to unicode string */
223  Buffer = (PVOID)((ULONG_PTR)KeyValueInformation + KeyValueInformation->DataOffset);
224  PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &Group.Length);
225  Group.MaximumLength = (USHORT)KeyValueInformation->DataLength;
226  Group.Buffer = Buffer;
227  }
228 
229  /* Now read the tag */
230  Status = IopGetRegistryValue(ServiceHandle, L"Tag", &KeyValueInformationTag);
231  if (!NT_SUCCESS(Status)) goto Quickie;
232 
233  /* Make sure we have a tag */
234  if ((KeyValueInformationTag->Type == REG_DWORD) &&
235  (KeyValueInformationTag->DataLength))
236  {
237  /* Read it */
238  Tag = *(PULONG)((ULONG_PTR)KeyValueInformationTag +
239  KeyValueInformationTag->DataOffset);
240  }
241 
242  /* We can get rid of this now */
243  ExFreePool(KeyValueInformationTag);
244 
245  /* Now let's read the group's tag order */
247  Group.Buffer,
248  &KeyValueInformationGroupOrderList);
249 
250  /* We can get rid of this now */
251 Quickie:
252  if (KeyValueInformation) ExFreePool(KeyValueInformation);
254  if (!NT_SUCCESS(Status)) return -1;
255 
256  /* We're on the success path -- validate the tag order*/
257  if ((KeyValueInformationGroupOrderList->Type == REG_BINARY) &&
258  (KeyValueInformationGroupOrderList->DataLength))
259  {
260  /* Get the order array */
261  GroupOrder = (PULONG)((ULONG_PTR)KeyValueInformationGroupOrderList +
262  KeyValueInformationGroupOrderList->DataOffset);
263 
264  /* Get the count */
265  Count = *GroupOrder;
266  ASSERT(((Count + 1) * sizeof(ULONG)) <=
267  KeyValueInformationGroupOrderList->DataLength);
268 
269  /* Now loop each tag */
270  GroupOrder++;
271  for (i = 1; i <= Count; i++)
272  {
273  /* If we found it, we're out */
274  if (Tag == *GroupOrder) break;
275 
276  /* Try the next one */
277  GroupOrder++;
278  }
279  }
280 
281  /* Last buffer to free */
282  ExFreePool(KeyValueInformationGroupOrderList);
283  return i;
284 }
285 
286 NTSTATUS
287 NTAPI
289  IN BOOLEAN LoadDriver,
291 {
293  HANDLE EnumRootKey, SubKey;
294  HANDLE ControlKey, ClassKey = NULL, PropertiesKey;
295  UNICODE_STRING ClassGuid, Properties;
298  RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class");
299  PKEY_VALUE_FULL_INFORMATION KeyValueInformation = NULL;
300  PWCHAR Buffer;
301 
302  /* Open enumeration root key */
303  Status = IopOpenRegistryKeyEx(&EnumRootKey,
304  NULL,
305  &EnumRoot,
306  KEY_READ);
307  if (!NT_SUCCESS(Status))
308  {
309  DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n",
310  &EnumRoot, Status);
311  return Status;
312  }
313 
314  /* Open instance subkey */
315  Status = IopOpenRegistryKeyEx(&SubKey,
316  EnumRootKey,
317  &DeviceNode->InstancePath,
318  KEY_READ);
319  ZwClose(EnumRootKey);
320  if (!NT_SUCCESS(Status))
321  {
322  DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n",
323  &DeviceNode->InstancePath, Status);
324  return Status;
325  }
326 
327  /* Get class GUID */
328  Status = IopGetRegistryValue(SubKey,
330  &KeyValueInformation);
331  if (NT_SUCCESS(Status))
332  {
333  /* Convert to unicode string */
334  Buffer = (PVOID)((ULONG_PTR)KeyValueInformation + KeyValueInformation->DataOffset);
335  PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &ClassGuid.Length);
336  ClassGuid.MaximumLength = (USHORT)KeyValueInformation->DataLength;
337  ClassGuid.Buffer = Buffer;
338 
339  /* Open the key */
340  Status = IopOpenRegistryKeyEx(&ControlKey,
341  NULL,
342  &ControlClass,
343  KEY_READ);
344  if (!NT_SUCCESS(Status))
345  {
346  /* No class key */
347  DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n",
348  &ControlClass, Status);
349  }
350  else
351  {
352  /* Open the class key */
353  Status = IopOpenRegistryKeyEx(&ClassKey,
354  ControlKey,
355  &ClassGuid,
356  KEY_READ);
357  ZwClose(ControlKey);
358  if (!NT_SUCCESS(Status))
359  {
360  /* No class key */
361  DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n",
362  &ClassGuid, Status);
363  }
364  }
365 
366  /* Check if we made it till here */
367  if (ClassKey)
368  {
369  /* Get the device properties */
371  Status = IopOpenRegistryKeyEx(&PropertiesKey,
372  ClassKey,
373  &Properties,
374  KEY_READ);
375  if (!NT_SUCCESS(Status))
376  {
377  /* No properties */
378  DPRINT("IopOpenRegistryKeyEx() failed for '%wZ' with status 0x%lx\n",
379  &Properties, Status);
380  PropertiesKey = NULL;
381  }
382  else
383  {
384  ZwClose(PropertiesKey);
385  }
386  }
387 
388  /* Free the registry data */
389  ExFreePool(KeyValueInformation);
390  }
391 
392  /* Do ReactOS-style setup */
393  Status = IopAttachFilterDrivers(DeviceNode, SubKey, ClassKey, TRUE);
394  if (!NT_SUCCESS(Status))
395  {
397  goto Exit;
398  }
399 
401  if (!NT_SUCCESS(Status))
402  {
403  goto Exit;
404  }
405 
406  Status = IopAttachFilterDrivers(DeviceNode, SubKey, ClassKey, FALSE);
407  if (!NT_SUCCESS(Status))
408  {
410  goto Exit;
411  }
412 
414 
415 Exit:
416  /* Close keys and return status */
417  ZwClose(SubKey);
418  if (ClassKey != NULL)
419  {
420  ZwClose(ClassKey);
421  }
422  return Status;
423 }
424 
425 INIT_FUNCTION
426 NTSTATUS
427 NTAPI
429 {
432  HANDLE KeyHandle, EnumHandle, ParentHandle, TreeHandle, ControlHandle;
433  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
434  UNICODE_STRING PnpManagerDriverName = RTL_CONSTANT_STRING(DRIVER_ROOT_NAME L"PnpManager");
436 
437  /* Initialize locks and such */
441 
442  /* Get the default interface */
444 
445  /* Initialize arbiters */
447  if (!NT_SUCCESS(Status)) return Status;
448 
449  /* Setup the group cache */
451  if (!NT_SUCCESS(Status)) return Status;
452 
453  /* Open the current control set */
455  NULL,
456  &KeyName,
458  if (!NT_SUCCESS(Status)) return Status;
459 
460  /* Create the control key */
461  RtlInitUnicodeString(&KeyName, L"Control");
462  Status = IopCreateRegistryKeyEx(&ControlHandle,
463  KeyHandle,
464  &KeyName,
467  &Disposition);
468  if (!NT_SUCCESS(Status)) return Status;
469 
470  /* Check if it's a new key */
472  {
473  HANDLE DeviceClassesHandle;
474 
475  /* Create the device classes key */
476  RtlInitUnicodeString(&KeyName, L"DeviceClasses");
477  Status = IopCreateRegistryKeyEx(&DeviceClassesHandle,
478  ControlHandle,
479  &KeyName,
482  &Disposition);
483  if (!NT_SUCCESS(Status)) return Status;
484 
485  ZwClose(DeviceClassesHandle);
486  }
487 
488  ZwClose(ControlHandle);
489 
490  /* Create the enum key */
492  Status = IopCreateRegistryKeyEx(&EnumHandle,
493  KeyHandle,
494  &KeyName,
497  &Disposition);
498  if (!NT_SUCCESS(Status)) return Status;
499 
500  /* Check if it's a new key */
502  {
503  /* FIXME: DACLs */
504  }
505 
506  /* Create the root key */
507  ParentHandle = EnumHandle;
509  Status = IopCreateRegistryKeyEx(&EnumHandle,
510  ParentHandle,
511  &KeyName,
514  &Disposition);
515  NtClose(ParentHandle);
516  if (!NT_SUCCESS(Status)) return Status;
517  NtClose(EnumHandle);
518 
519  /* Open the root key now */
520  RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\ENUM");
521  Status = IopOpenRegistryKeyEx(&EnumHandle,
522  NULL,
523  &KeyName,
525  if (NT_SUCCESS(Status))
526  {
527  /* Create the root dev node */
529  Status = IopCreateRegistryKeyEx(&TreeHandle,
530  EnumHandle,
531  &KeyName,
534  NULL);
535  NtClose(EnumHandle);
536  if (NT_SUCCESS(Status)) NtClose(TreeHandle);
537  }
538 
539  /* Create the root driver */
540  Status = IoCreateDriver(&PnpManagerDriverName, PnpRootDriverEntry);
541  if (!NT_SUCCESS(Status))
542  {
543  DPRINT1("IoCreateDriverObject() failed\n");
544  KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
545  }
546 
547  /* Create the root PDO */
549  sizeof(IOPNP_DEVICE_EXTENSION),
550  NULL,
552  0,
553  FALSE,
554  &Pdo);
555  if (!NT_SUCCESS(Status))
556  {
557  DPRINT1("IoCreateDevice() failed\n");
558  KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
559  }
560 
561  /* This is a bus enumerated device */
563 
564  /* Create the root device node */
566 
567  /* Set flags */
570  DNF_ADDED;
571 
572  /* Create instance path */
575 
576  /* Call the add device routine */
579 
580  /* Initialize PnP-Event notification support */
582  if (!NT_SUCCESS(Status)) return Status;
583 
584  /* Report the device to the user-mode pnp manager */
585  IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
587 
588  /* Initialize the Bus Type GUID List */
592 
593  /* Launch the firmware mapper */
595  if (!NT_SUCCESS(Status)) return Status;
596 
597  /* Close the handle to the control set */
599 
600  /* We made it */
601  return STATUS_SUCCESS;
602 }
603 
604 /* EOF */
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define IN
Definition: typedefs.h:39
ULONG Flags
Definition: iotypes.h:836
#define TRUE
Definition: types.h:120
PDEVICE_OBJECT PhysicalDeviceObject
Definition: iotypes.h:839
PDEVICE_NODE IopRootDeviceNode
Definition: pnpmgr.c:18
#define DNF_PROCESSED
Definition: iotypes.h:167
enum _INTERFACE_TYPE INTERFACE_TYPE
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:301
INIT_FUNCTION NTSTATUS NTAPI IopInitializePlugPlayServices(VOID)
Definition: pnpinit.c:428
static const WCHAR ControlClass[]
Definition: cfgmgr.c:41
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
USHORT MaximumLength
Definition: env_spec_w32.h:370
INIT_FUNCTION NTSTATUS NTAPI PiInitCacheGroupInformation(VOID)
Definition: pnpinit.c:96
#define REG_BINARY
Definition: nt_native.h:1496
NTSTATUS NTAPI IopMemInitialize(VOID)
Definition: arbs.c:89
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
INTERFACE_TYPE PnpDefaultInterfaceType
Definition: pnpinit.c:25
_In_opt_ PSID Group
Definition: rtlfuncs.h:1605
LONG NTSTATUS
Definition: precomp.h:26
USHORT NTAPI PpInitGetGroupOrderIndex(IN HANDLE ServiceHandle)
Definition: pnpinit.c:151
#define DNF_NO_RESOURCE_REQUIRED
Definition: iotypes.h:174
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
FAST_MUTEX Lock
Definition: io.h:439
#define REGSTR_VAL_ROOT_DEVNODE
Definition: regstr.h:405
uint16_t * PWCHAR
Definition: typedefs.h:55
NTSTATUS NTAPI PipCallDriverAddDevice(IN PDEVICE_NODE DeviceNode, IN BOOLEAN LoadDriver, IN PDRIVER_OBJECT DriverObject)
Definition: pnpinit.c:288
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
INIT_FUNCTION NTSTATUS IopInitPlugPlayEvents(VOID)
Definition: plugplay.c:34
KSPIN_LOCK IopDeviceActionLock
Definition: pnpmgr.c:39
uint32_t ULONG_PTR
Definition: typedefs.h:64
ARBITER_INSTANCE IopRootIrqArbiter
Definition: pnpinit.c:28
ARBITER_INSTANCE IopRootMemArbiter
Definition: pnpinit.c:30
NTSTATUS IopStartDevice(IN PDEVICE_NODE DeviceNode)
NTSTATUS NTAPI IopCreateRegistryKeyEx(OUT PHANDLE Handle, IN HANDLE BaseHandle OPTIONAL, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PDEVICE_NODE NTAPI PipAllocateDeviceNode(IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: pnpmgr.c:4045
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
NTSTATUS IopRemoveDevice(IN PDEVICE_NODE DeviceNode)
#define REGSTR_KEY_ROOTENUM
Definition: regstr.h:10
#define REG_MULTI_SZ
Definition: nt_native.h:1501
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
USHORT PiInitGroupOrderTableCount
Definition: pnpinit.c:24
struct _IOPNP_DEVICE_EXTENSION IOPNP_DEVICE_EXTENSION
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
LIST_ENTRY IopDeviceActionRequestList
Definition: pnpmgr.c:36
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define DO_BUS_ENUMERATED_DEVICE
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
NTSTATUS FASTCALL IopInitializeDevice(IN PDEVICE_NODE DeviceNode, IN PDRIVER_OBJECT DriverObject)
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
void * PVOID
Definition: retypes.h:9
#define DNF_STARTED
Definition: iotypes.h:168
NTSTATUS NTAPI PnpRootDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: pnproot.c:1470
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
NTSTATUS IopQueueTargetDeviceEvent(const GUID *Guid, PUNICODE_STRING DeviceIds)
Definition: plugplay.c:46
ULONG CompatibleIdListSize
Definition: pnpinit.c:20
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static void Exit(void)
Definition: sock.c:1331
#define ENUM_ROOT
Definition: io.h:53
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define for
Definition: utility.h:88
NTSTATUS NTAPI IopPortInitialize(VOID)
Definition: arbs.c:108
#define REGSTR_VAL_CLASSGUID
Definition: regstr.h:422
NTSTATUS NTAPI IopIrqInitialize(VOID)
Definition: arbs.c:51
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
Definition: Node.h:9
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
PDRIVER_OBJECT IopRootDriverObject
Definition: pnpmgr.c:34
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IopInitializeArbiters(VOID)
Definition: pnpinit.c:51
static const WCHAR L[]
Definition: oid.c:1250
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
NTSTATUS NTAPI PnpRegMultiSzToUnicodeStrings(IN PKEY_VALUE_FULL_INFORMATION KeyValueInformation, OUT PUNICODE_STRING *UnicodeStringList, OUT PULONG UnicodeStringCount)
Definition: pnputil.c:47
ARBITER_INSTANCE IopRootPortArbiter
Definition: pnpinit.c:31
#define REGSTR_KEY_DEVICE_PROPERTIES
Definition: regstr.h:752
#define REGSTR_KEY_ENUM
Definition: regstr.h:9
UNICODE_STRING InstancePath
Definition: iotypes.h:842
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI IopBusNumberInitialize(VOID)
Definition: arbs.c:32
KSPIN_LOCK IopDeviceTreeLock
Definition: pnpmgr.c:19
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
NTSTATUS NTAPI IopGetRegistryValue(IN HANDLE Handle, IN PWSTR ValueName, OUT PKEY_VALUE_FULL_INFORMATION *Information)
Definition: pnpmgr.c:3911
NTSTATUS NTAPI IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, IN PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1698
NTSTATUS NTAPI IopOpenRegistryKeyEx(PHANDLE KeyHandle, HANDLE ParentKey, PUNICODE_STRING Name, ACCESS_MASK DesiredAccess)
Definition: pnpmgr.c:3760
unsigned short USHORT
Definition: pedump.c:61
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
PIO_BUS_TYPE_GUID_LIST PnpBusTypeGuidList
Definition: pnpmgr.c:35
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
INTERFACE_TYPE NTAPI IopDetermineDefaultInterfaceType(VOID)
Definition: pnpinit.c:43
NTSTATUS FASTCALL IopAttachFilterDrivers(IN PDEVICE_NODE DeviceNode, IN HANDLE EnumSubKey, IN HANDLE ClassKey, IN BOOLEAN Lower)
unsigned int * PULONG
Definition: retypes.h:1
INIT_FUNCTION NTSTATUS NTAPI IopUpdateRootKey(VOID)
Definition: pnpmgr.c:3702
ARBITER_INSTANCE IopRootBusNumberArbiter
Definition: pnpinit.c:27
BOOLEAN NTAPI PnpRegSzToString(IN PWCHAR RegSzData, IN ULONG RegSzLength, OUT PUSHORT StringLength OPTIONAL)
Definition: pnputil.c:171
#define DPRINT1
Definition: precomp.h:8
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define DNF_ENUMERATED
Definition: iotypes.h:170
PUNICODE_STRING PiInitGroupOrderTable
Definition: pnpinit.c:23
#define DNF_MADEUP
Definition: iotypes.h:172
USHORT NTAPI PipGetDriverTagPriority(IN HANDLE ServiceHandle)
Definition: pnpinit.c:194
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define DNF_ADDED
Definition: iotypes.h:179
#define REG_DWORD
Definition: sdbapi.c:596
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
NTSTATUS NTAPI IopDmaInitialize(VOID)
Definition: arbs.c:70
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:107
ARBITER_INSTANCE IopRootDmaArbiter
Definition: pnpinit.c:29
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
struct _IOPNP_DEVICE_EXTENSION * PIOPNP_DEVICE_EXTENSION
#define DRIVER_ROOT_NAME
Definition: ldr.h:5
#define PAGED_CODE()
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22