ReactOS  0.4.15-dev-313-g8fde48b
registry.c
Go to the documentation of this file.
1 /*
2  * VideoPort driver
3  *
4  * Copyright (C) 2002-2004, 2007 ReactOS Team
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21 
22 #include "videoprt.h"
23 #include <ndk/obfuncs.h>
24 
25 #define NDEBUG
26 #include <debug.h>
27 
29 NTAPI
31  _In_ HANDLE SourceKeyHandle,
32  _In_ HANDLE DestKeyHandle)
33 {
34  PVOID InfoBuffer;
35  PKEY_BASIC_INFORMATION KeyInformation;
36  PKEY_VALUE_FULL_INFORMATION KeyValueInformation;
38  ULONG Index, InformationLength, RequiredLength;
39  UNICODE_STRING NameString;
41  HANDLE SourceSubKeyHandle, DestSubKeyHandle;
42 
43  /* Start with no buffer, set initial size */
44  InfoBuffer = NULL;
45  InformationLength = 256;
46 
47  /* Start looping with key index 0 */
48  Index = 0;
49  while (TRUE)
50  {
51  /* Check if we have no buffer */
52  if (InfoBuffer == NULL)
53  {
54  /* Allocate a new buffer */
55  InfoBuffer = ExAllocatePoolWithTag(PagedPool,
56  InformationLength,
58  if (InfoBuffer == NULL)
59  {
60  ERR_(VIDEOPRT, "Could not allocate buffer for key info\n");
62  }
63  }
64 
65  /* Enumerate the next sub-key */
66  KeyInformation = InfoBuffer;
67  Status = ZwEnumerateKey(SourceKeyHandle,
68  Index,
70  KeyInformation,
71  InformationLength,
73  if ((Status == STATUS_BUFFER_OVERFLOW) ||
75  {
76  /* Free the buffer and remember the required size */
78  InfoBuffer = NULL;
79  InformationLength = RequiredLength;
80 
81  /* Try again */
82  continue;
83  }
84  else if (Status == STATUS_NO_MORE_ENTRIES)
85  {
86  /* We are done with the sub-keys */
87  break;
88  }
89  else if (!NT_SUCCESS(Status))
90  {
91  ERR_(VIDEOPRT, "ZwEnumerateKey failed, status 0x%lx\n", Status);
92  goto Cleanup;
93  }
94 
95  /* Initialize a unicode string from the key name */
96  NameString.Buffer = KeyInformation->Name;
97  NameString.Length = (USHORT)KeyInformation->NameLength;
98  NameString.MaximumLength = NameString.Length;
99 
100  /* Initialize object attributes and open the source sub-key */
102  &NameString,
104  SourceKeyHandle,
105  NULL);
106  Status = ZwOpenKey(&SourceSubKeyHandle, KEY_READ, &ObjectAttributes);
107  if (!NT_SUCCESS(Status))
108  {
109  ERR_(VIDEOPRT, "failed to open the source key.\n");
110  goto Cleanup;
111  }
112 
113  /* Initialize object attributes and create the dest sub-key */
115  &NameString,
117  DestKeyHandle,
118  NULL);
119  Status = ZwCreateKey(&DestSubKeyHandle,
120  KEY_WRITE,
122  0,
123  NULL,
125  NULL);
126  if (!NT_SUCCESS(Status))
127  {
128  ERR_(VIDEOPRT, "failed to create the destination key.\n");
129  ObCloseHandle(SourceSubKeyHandle, KernelMode);
130  goto Cleanup;
131  }
132 
133  /* Recursively copy the sub-key */
134  Status = IntCopyRegistryKey(SourceSubKeyHandle, DestSubKeyHandle);
135  if (!NT_SUCCESS(Status))
136  {
137  /* Just warn, but continue with the remaining sub-keys */
138  WARN_(VIDEOPRT, "failed to copy subkey '%wZ'.\n", &NameString);
139  }
140 
141  /* Close the sub-key handles */
142  ObCloseHandle(SourceSubKeyHandle, KernelMode);
143  ObCloseHandle(DestSubKeyHandle, KernelMode);
144 
145  /* Next sub-key */
146  Index++;
147  }
148 
149  /* Start looping with value index 0 */
150  Index = 0;
151  while (TRUE)
152  {
153  /* Check if we have no buffer */
154  if (InfoBuffer == NULL)
155  {
156  /* Allocate a new buffer */
157  InfoBuffer = ExAllocatePoolWithTag(PagedPool,
158  InformationLength,
160  if (InfoBuffer == NULL)
161  {
162  ERR_(VIDEOPRT, "Could not allocate buffer for key values\n");
163  return Status;
164  }
165  }
166 
167  /* Enumerate the next value */
168  KeyValueInformation = InfoBuffer;
169  Status = ZwEnumerateValueKey(SourceKeyHandle,
170  Index,
172  KeyValueInformation,
173  InformationLength,
174  &RequiredLength);
175  if ((Status == STATUS_BUFFER_OVERFLOW) ||
177  {
178  /* Free the buffer and remember the required size */
180  InfoBuffer = NULL;
181  InformationLength = RequiredLength;
182 
183  /* Try again */
184  continue;
185  }
186  else if (Status == STATUS_NO_MORE_ENTRIES)
187  {
188  /* We are done with the values */
190  break;
191  }
192  else if (!NT_SUCCESS(Status))
193  {
194  ERR_(VIDEOPRT, "ZwEnumerateValueKey failed, status 0x%lx\n", Status);
195  goto Cleanup;
196  }
197 
198  /* Initialize a unicode string from the value name */
199  NameString.Buffer = KeyValueInformation->Name;
200  NameString.Length = (USHORT)KeyValueInformation->NameLength;
201  NameString.MaximumLength = NameString.Length;
202 
203  /* Create the key value in the destination key */
204  Status = ZwSetValueKey(DestKeyHandle,
205  &NameString,
206  KeyValueInformation->TitleIndex,
207  KeyValueInformation->Type,
208  (PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset,
209  KeyValueInformation->DataLength);
210  if (!NT_SUCCESS(Status))
211  {
212  /* Just warn, but continue with the remaining sub-keys */
213  WARN_(VIDEOPRT, "failed to set value '%wZ'.\n", &NameString);
214  }
215 
216  /* Next subkey */
217  Index++;
218  }
219 
220 Cleanup:
221  /* Free the buffer and return the failure code */
222  if (InfoBuffer != NULL)
224  return Status;
225 }
226 
227 NTSTATUS
228 NTAPI
230  HANDLE SourceKeyHandle,
231  HANDLE DestKeyHandle,
233 {
234  PKEY_VALUE_PARTIAL_INFORMATION ValueInformation;
235  UNICODE_STRING ValueNameString;
236  ULONG Length;
238 
239  RtlInitUnicodeString(&ValueNameString, ValueName);
240 
241  /* Query the value length */
242  Status = ZwQueryValueKey(SourceKeyHandle,
243  &ValueNameString,
245  NULL,
246  0,
247  &Length);
248  if ((Status != STATUS_BUFFER_OVERFLOW) &&
250  {
251  /* The key seems not present */
253  return Status;
254  }
255 
256  /* Allocate a buffer */
258  if (ValueInformation == NULL)
259  {
260  return Status;
261  }
262 
263  /* Query the value */
264  Status = ZwQueryValueKey(SourceKeyHandle,
265  &ValueNameString,
267  ValueInformation,
268  Length,
269  &Length);
270  if (!NT_SUCCESS(Status))
271  {
272  ExFreePoolWithTag(ValueInformation, TAG_VIDEO_PORT_BUFFER);
273  return Status;
274  }
275 
276  /* Write the registry value */
277  Status = ZwSetValueKey(DestKeyHandle,
278  &ValueNameString,
279  ValueInformation->TitleIndex,
280  ValueInformation->Type,
281  ValueInformation->Data,
282  ValueInformation->DataLength);
283 
284  ExFreePoolWithTag(ValueInformation, TAG_VIDEO_PORT_BUFFER);
285 
286  if (!NT_SUCCESS(Status))
287  {
288  ERR_(VIDEOPRT, "ZwSetValueKey failed: status 0x%lx\n", Status);
289  }
290 
291  return Status;
292 }
293 
294 NTSTATUS
295 NTAPI
297  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
298 {
299  static UNICODE_STRING SettingsKeyName = RTL_CONSTANT_STRING(L"Settings");
300  HANDLE DevInstRegKey, SourceKeyHandle, DestKeyHandle;
303 
304  /* Open the software key: HKLM\System\CurrentControlSet\Control\Class<ClassGUID><n> */
308  &DevInstRegKey);
309  if (Status != STATUS_SUCCESS)
310  {
311  ERR_(VIDEOPRT, "Failed to open device software key. Status 0x%lx\n", Status);
312  return Status;
313  }
314 
315  /* Open the 'Settings' sub-key */
317  &SettingsKeyName,
320  NULL);
321  Status = ZwOpenKey(&DestKeyHandle, KEY_WRITE, &ObjectAttributes);
322 
323  /* Close the device software key */
325 
326  if (Status != STATUS_SUCCESS)
327  {
328  ERR_(VIDEOPRT, "Failed to open settings key. Status 0x%lx\n", Status);
329  return Status;
330  }
331 
332  /* Open the device profile key */
334  &DeviceExtension->RegistryPath,
336  NULL,
337  NULL);
338  Status = ZwOpenKey(&SourceKeyHandle, KEY_WRITE, &ObjectAttributes);
339  if (Status != STATUS_SUCCESS)
340  {
341  ERR_(VIDEOPRT, "ZwOpenKey failed for settings key: status 0x%lx\n", Status);
342  ObCloseHandle(DestKeyHandle, KernelMode);
343  return Status;
344  }
345 
346  IntCopyRegistryValue(SourceKeyHandle, DestKeyHandle, L"InstalledDisplayDrivers");
347  IntCopyRegistryValue(SourceKeyHandle, DestKeyHandle, L"Attach.ToDesktop");
348 
349  ObCloseHandle(SourceKeyHandle, KernelMode);
350  ObCloseHandle(DestKeyHandle, KernelMode);
351 
352  return STATUS_SUCCESS;
353 }
354 
355 NTSTATUS
356 NTAPI
358  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
359 {
360  static UNICODE_STRING VideoIdValueName = RTL_CONSTANT_STRING(L"VideoId");
361  static UNICODE_STRING ControlVideoPathName =
362  RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\");
363  HANDLE DevInstRegKey, SettingsKey, NewKey;
364  UCHAR VideoIdBuffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + GUID_STRING_LENGTH];
365  UNICODE_STRING VideoIdString;
366  UUID VideoId;
367  PKEY_VALUE_PARTIAL_INFORMATION ValueInformation ;
370  USHORT KeyMaxLength;
372 
373  /* Open the hardware key: HKLM\System\CurrentControlSet\Enum\... */
377  &DevInstRegKey);
378  if (Status != STATUS_SUCCESS)
379  {
380  ERR_(VIDEOPRT, "IoOpenDeviceRegistryKey failed: status 0x%lx\n", Status);
381  return Status;
382  }
383 
384  /* Query the VideoId value */
385  ValueInformation = (PKEY_VALUE_PARTIAL_INFORMATION)VideoIdBuffer;
386  Status = ZwQueryValueKey(DevInstRegKey,
387  &VideoIdValueName,
389  ValueInformation,
390  sizeof(VideoIdBuffer),
391  &ResultLength);
392  if (!NT_SUCCESS(Status))
393  {
394  /* Create a new video Id */
395  Status = ExUuidCreate(&VideoId);
396  if (!NT_SUCCESS(Status))
397  {
398  ERR_(VIDEOPRT, "ExUuidCreate failed: status 0x%lx\n", Status);
400  return Status;
401  }
402 
403  /* Convert the GUID into a string */
404  Status = RtlStringFromGUID(&VideoId, &VideoIdString);
405  if (!NT_SUCCESS(Status))
406  {
407  ERR_(VIDEOPRT, "RtlStringFromGUID failed: status 0x%lx\n", Status);
409  return Status;
410  }
411 
412  /* Copy the GUID String to our buffer */
413  ValueInformation->DataLength = min(VideoIdString.Length, GUID_STRING_LENGTH);
414  RtlCopyMemory(ValueInformation->Data,
415  VideoIdString.Buffer,
416  ValueInformation->DataLength);
417 
418  /* Free the GUID string */
419  RtlFreeUnicodeString(&VideoIdString);
420 
421  /* Write the VideoId registry value */
422  Status = ZwSetValueKey(DevInstRegKey,
423  &VideoIdValueName,
424  0,
425  REG_SZ,
426  ValueInformation->Data,
427  ValueInformation->DataLength);
428  if (!NT_SUCCESS(Status))
429  {
430  ERR_(VIDEOPRT, "ZwSetValueKey failed: status 0x%lx\n", Status);
432  return Status;
433  }
434  }
435 
436  /* Initialize the VideoId string from the registry data */
437  VideoIdString.Buffer = (PWCHAR)ValueInformation->Data;
438  VideoIdString.Length = (USHORT)ValueInformation->DataLength;
439  VideoIdString.MaximumLength = VideoIdString.Length;
440 
441  /* Close the hardware key */
443 
444  /* Calculate the size needed for the new registry path name */
445  KeyMaxLength = ControlVideoPathName.Length +
446  VideoIdString.Length +
447  sizeof(L"\\0000");
448 
449  /* Allocate the path name buffer */
450  DeviceExtension->NewRegistryPath.Length = 0;
451  DeviceExtension->NewRegistryPath.MaximumLength = KeyMaxLength;
453  KeyMaxLength,
455  if (DeviceExtension->NewRegistryPath.Buffer == NULL)
456  {
457  ERR_(VIDEOPRT, "Failed to allocate key name buffer.\n");
459  }
460 
461  /* Copy the root key name and append the VideoId string */
462  RtlCopyUnicodeString(&DeviceExtension->NewRegistryPath,
463  &ControlVideoPathName);
465  &VideoIdString);
466 
467  /* Check if we have the key already */
469  DeviceExtension->NewRegistryPath.Buffer);
470  if (Status != STATUS_SUCCESS)
471  {
472  /* Try to create the new key */
474  DeviceExtension->NewRegistryPath.Buffer);
475  }
476 
477  /* Append a the instance path */
478  RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"\\");
479  RtlAppendUnicodeToString(&DeviceExtension->NewRegistryPath, L"0000");
480 
481  /* Check this key again */
483  DeviceExtension->NewRegistryPath.Buffer);
484  if (Status != STATUS_SUCCESS)
485  {
486  /* Try to create the new key */
488  DeviceExtension->NewRegistryPath.Buffer);
489  if (!NT_SUCCESS(Status))
490  {
491  ERR_(VIDEOPRT, "Failed create key '%wZ'\n", &DeviceExtension->NewRegistryPath);
492  return Status;
493  }
494 
495  /* Open the new key */
497  &DeviceExtension->NewRegistryPath,
499  NULL,
500  NULL);
501  Status = ZwOpenKey(&NewKey, KEY_READ, &ObjectAttributes);
502  if (!NT_SUCCESS(Status))
503  {
504  ERR_(VIDEOPRT, "Failed to open settings key. Status 0x%lx\n", Status);
505  return Status;
506  }
507 
508  /* Open the device profile key */
510  &DeviceExtension->RegistryPath,
512  NULL,
513  NULL);
514  Status = ZwOpenKey(&SettingsKey, KEY_READ, &ObjectAttributes);
515  if (!NT_SUCCESS(Status))
516  {
517  ERR_(VIDEOPRT, "Failed to open settings key. Status 0x%lx\n", Status);
518  ObCloseHandle(NewKey, KernelMode);
519  return Status;
520  }
521 
522  /* Copy the registry data from the legacy key */
523  Status = IntCopyRegistryKey(SettingsKey, NewKey);
524  }
525 
526 
527  return Status;
528 }
529 
530 NTSTATUS
531 NTAPI
534  OUT PUNICODE_STRING DeviceRegistryPath)
535 {
536  static WCHAR RegistryMachineSystem[] = L"\\REGISTRY\\MACHINE\\SYSTEM\\";
537  static WCHAR CurrentControlSet[] = L"CURRENTCONTROLSET\\";
538  static WCHAR ControlSet[] = L"CONTROLSET";
539  static WCHAR Insert1[] = L"Hardware Profiles\\Current\\System\\CurrentControlSet\\";
540  static WCHAR Insert2[] = L"\\Device0";
541  BOOLEAN Valid;
542  UNICODE_STRING AfterControlSet;
543 
544  AfterControlSet = *DriverRegistryPath;
545 
546  /* Check if path begins with \\REGISTRY\\MACHINE\\SYSTEM\\ */
547  Valid = (DriverRegistryPath->Length > sizeof(RegistryMachineSystem) &&
548  0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem,
549  wcslen(RegistryMachineSystem)));
550  if (Valid)
551  {
552  AfterControlSet.Buffer += wcslen(RegistryMachineSystem);
553  AfterControlSet.Length -= sizeof(RegistryMachineSystem) - sizeof(UNICODE_NULL);
554 
555  /* Check if path contains CURRENTCONTROLSET */
556  if (AfterControlSet.Length > sizeof(CurrentControlSet) &&
557  0 == _wcsnicmp(AfterControlSet.Buffer, CurrentControlSet, wcslen(CurrentControlSet)))
558  {
559  AfterControlSet.Buffer += wcslen(CurrentControlSet);
560  AfterControlSet.Length -= sizeof(CurrentControlSet) - sizeof(UNICODE_NULL);
561  }
562  /* Check if path contains CONTROLSETnum */
563  else if (AfterControlSet.Length > sizeof(ControlSet) &&
564  0 == _wcsnicmp(AfterControlSet.Buffer, ControlSet, wcslen(ControlSet)))
565  {
566  AfterControlSet.Buffer += wcslen(ControlSet);
567  AfterControlSet.Length -= sizeof(ControlSet) - sizeof(UNICODE_NULL);
568  while (AfterControlSet.Length > 0 &&
569  *AfterControlSet.Buffer >= L'0' &&
570  *AfterControlSet.Buffer <= L'9')
571  {
572  AfterControlSet.Buffer++;
573  AfterControlSet.Length -= sizeof(WCHAR);
574  }
575 
576  Valid = (AfterControlSet.Length > 0 && L'\\' == *AfterControlSet.Buffer);
577  AfterControlSet.Buffer++;
578  AfterControlSet.Length -= sizeof(WCHAR);
579  AfterControlSet.MaximumLength = AfterControlSet.Length;
580  }
581  else
582  {
583  Valid = FALSE;
584  }
585  }
586 
587  if (Valid)
588  {
589  DeviceRegistryPath->MaximumLength = DriverRegistryPath->Length + sizeof(Insert1) + sizeof(Insert2);
590  DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(PagedPool,
591  DeviceRegistryPath->MaximumLength,
593  if (DeviceRegistryPath->Buffer != NULL)
594  {
595  /* Build device path */
596  wcsncpy(DeviceRegistryPath->Buffer,
598  AfterControlSet.Buffer - DriverRegistryPath->Buffer);
599  DeviceRegistryPath->Length = (AfterControlSet.Buffer - DriverRegistryPath->Buffer) * sizeof(WCHAR);
600  RtlAppendUnicodeToString(DeviceRegistryPath, Insert1);
601  RtlAppendUnicodeStringToString(DeviceRegistryPath, &AfterControlSet);
602  RtlAppendUnicodeToString(DeviceRegistryPath, Insert2);
603 
604  /* Check if registry key exists */
605  Valid = NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, DeviceRegistryPath->Buffer));
606 
607  if (!Valid)
608  ExFreePoolWithTag(DeviceRegistryPath->Buffer, TAG_VIDEO_PORT);
609  }
610  else
611  {
612  Valid = FALSE;
613  }
614  }
615  else
616  {
617  WARN_(VIDEOPRT, "Unparsable registry path %wZ\n", DriverRegistryPath);
618  }
619 
620  /* If path doesn't point to *ControlSet*, use DriverRegistryPath directly */
621  if (!Valid)
622  {
623  DeviceRegistryPath->MaximumLength = DriverRegistryPath->Length + sizeof(Insert2);
624  DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(NonPagedPool,
625  DeviceRegistryPath->MaximumLength,
627 
628  if (!DeviceRegistryPath->Buffer)
629  return STATUS_NO_MEMORY;
630 
631  RtlCopyUnicodeString(DeviceRegistryPath, DriverRegistryPath);
632  RtlAppendUnicodeToString(DeviceRegistryPath, Insert2);
633  }
634 
635  DPRINT("Formatted registry key '%wZ' -> '%wZ'\n",
636  DriverRegistryPath, DeviceRegistryPath);
637 
638  return STATUS_SUCCESS;
639 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define IN
Definition: typedefs.h:39
UNICODE_STRING NewRegistryPath
Definition: videoprt.h:91
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS NTAPI IntCreateNewRegistryPath(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:357
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2738
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:55
unsigned char * PUCHAR
Definition: retypes.h:3
#define GUID_STRING_LENGTH
Definition: wmip.h:6
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
NTSTATUS NTAPI IntSetupDeviceSettingsKey(PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: registry.c:296
uint16_t * PWCHAR
Definition: typedefs.h:55
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define TAG_VIDEO_PORT_BUFFER
Definition: videoprt.h:39
#define UNICODE_NULL
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI IntCopyRegistryKey(_In_ HANDLE SourceKeyHandle, _In_ HANDLE DestKeyHandle)
Definition: registry.c:30
void DPRINT(...)
Definition: polytest.cpp:61
NTKERNELAPI NTSTATUS ExUuidCreate(OUT UUID *Uuid)
Definition: uuid.c:385
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
NTSTATUS NTAPI IntCreateRegistryPath(IN PCUNICODE_STRING DriverRegistryPath, OUT PUNICODE_STRING DeviceRegistryPath)
Definition: registry.c:532
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
static const WCHAR L[]
Definition: oid.c:1250
#define PLUGPLAY_REGKEY_DRIVER
Definition: usbd.c:42
static const WCHAR Cleanup[]
Definition: register.c:80
#define RTL_REGISTRY_ABSOLUTE
Definition: nt_native.h:161
_In_ ULONG _In_ ACCESS_MASK _Out_ PHANDLE DevInstRegKey
Definition: iofuncs.h:1123
Status
Definition: gdiplustypes.h:24
#define _In_
Definition: no_sal2.h:204
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
unsigned short USHORT
Definition: pedump.c:61
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define min(a, b)
Definition: monoChain.cc:55
NTSTATUS NTAPI IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, IN ULONG DevInstKeyType, IN ACCESS_MASK DesiredAccess, OUT PHANDLE DevInstRegKey)
Definition: pnpmgr.c:4658
NTSTATUS NTAPI RtlCheckRegistryKey(IN ULONG RelativeTo, IN PWSTR Path)
Definition: registry.c:583
#define OUT
Definition: typedefs.h:40
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
NTSTATUS NTAPI RtlCreateRegistryKey(IN ULONG RelativeTo, IN PWSTR Path)
Definition: registry.c:607
return STATUS_SUCCESS
Definition: btrfs.c:3014
#define WARN_(ch,...)
Definition: debug.h:157
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
UNICODE_STRING DriverRegistryPath
Definition: ramdisk.c:124
NTSTATUS NTAPI IntCopyRegistryValue(HANDLE SourceKeyHandle, HANDLE DestKeyHandle, PWSTR ValueName)
Definition: registry.c:229
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define NT_ASSERT
Definition: rtlfuncs.h:3312
#define REG_SZ
Definition: layer.c:22