get rid of the reactos-only RTL_REGISTRY_ENUM flag and added more debug messages to ease debugging failures Modified: trunk/reactos/include/ntos/rtl.h Modified: trunk/reactos/lib/rtl/registry.c Modified: trunk/reactos/ntoskrnl/cm/import.c Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnproot.c _____
Modified: trunk/reactos/include/ntos/rtl.h --- trunk/reactos/include/ntos/rtl.h 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/include/ntos/rtl.h 2005-01-23 20:58:28 UTC (rev 13229) @@ -458,8 +458,7 @@
#define RTL_REGISTRY_WINDOWS_NT 3 #define RTL_REGISTRY_DEVICEMAP 4 #define RTL_REGISTRY_USER 5 -#define RTL_REGISTRY_ENUM 6 /* ReactOS specific: Used internally in kernel only */ -#define RTL_REGISTRY_MAXIMUM 7 +#define RTL_REGISTRY_MAXIMUM 6
#define RTL_REGISTRY_HANDLE 0x40000000 #define RTL_REGISTRY_OPTIONAL 0x80000000 _____
Modified: trunk/reactos/lib/rtl/registry.c --- trunk/reactos/lib/rtl/registry.c 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/lib/rtl/registry.c 2005-01-23 20:58:28 UTC (rev 13229) @@ -51,6 +51,13 @@
0, FALSE, DUPLICATE_SAME_ACCESS); +#ifndef NDEBUG + if(!NT_SUCCESS(Status)) + { + DPRINT("ZwDuplicateObject() failed! Status: 0x%x\n", Status); + } +#endif + return(Status); }
@@ -58,18 +65,20 @@ RelativeTo &= ~RTL_REGISTRY_OPTIONAL;
if (RelativeTo >= RTL_REGISTRY_MAXIMUM) + { + DPRINT("Invalid relative flag, parameter invalid!\n"); return(STATUS_INVALID_PARAMETER); + }
KeyName.Length = 0; - KeyName.MaximumLength = MAX_PATH; + KeyName.MaximumLength = sizeof(KeyBuffer); KeyName.Buffer = KeyBuffer; KeyBuffer[0] = 0;
switch (RelativeTo) { case RTL_REGISTRY_ABSOLUTE: - RtlAppendUnicodeToString(&KeyName, - L"\"); + /* nothing to prefix! */ break;
case RTL_REGISTRY_SERVICES: @@ -102,16 +111,8 @@ RtlAppendUnicodeToString (&KeyName, L"\"); break; - - /* ReactOS specific */ - case RTL_REGISTRY_ENUM: - RtlAppendUnicodeToString(&KeyName, - L"\Registry\Machine\System\CurrentControlSet\Enum\"); - break; }
- DPRINT("KeyName %wZ\n", &KeyName); - if (Path[0] == L'\' && RelativeTo != RTL_REGISTRY_ABSOLUTE) { Path++; @@ -127,7 +128,7 @@ NULL, NULL);
- if (Create == TRUE) + if (Create) { Status = ZwCreateKey(KeyHandle, KEY_ALL_ACCESS, @@ -144,6 +145,13 @@ &ObjectAttributes); }
+#ifndef NDEBUG + if(!NT_SUCCESS(Status)) + { + DPRINT("%s failed! Status: 0x%x\n", (Create ? "ZwCreateKey" : "ZwOpenKey"), Status); + } +#endif + return(Status); }
@@ -876,7 +884,10 @@ TRUE, &KeyHandle); if (!NT_SUCCESS(Status)) + { + DPRINT("RtlpGetRegistryHandle() failed! Status: 0x%x\n", Status); return(Status); + }
RtlInitUnicodeString(&Name, ValueName); @@ -887,9 +898,13 @@ ValueType, ValueData, ValueLength); - if (NT_SUCCESS(Status)) - ZwClose(KeyHandle); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwSetValueKey() failed! Status: 0x%x\n", Status); + }
+ ZwClose(KeyHandle); + return(Status); }
_____
Modified: trunk/reactos/ntoskrnl/cm/import.c --- trunk/reactos/ntoskrnl/cm/import.c 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/ntoskrnl/cm/import.c 2005-01-23 20:58:28 UTC (rev 13229) @@ -242,7 +242,8 @@
&Disposition); if (!NT_SUCCESS(Status)) { - return FALSE; + DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status); + return FALSE; } NtClose (HardwareKey);
@@ -263,7 +264,8 @@ &Disposition); if (!NT_SUCCESS(Status)) { - return FALSE; + DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status); + return FALSE; } NtClose (HardwareKey);
@@ -284,7 +286,8 @@ &Disposition); if (!NT_SUCCESS(Status)) { - return FALSE; + DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status); + return FALSE; } NtClose (HardwareKey);
@@ -305,7 +308,8 @@ &Disposition); if (!NT_SUCCESS(Status)) { - return FALSE; + DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status); + return FALSE; } NtClose (HardwareKey);
_____
Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c --- trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-01-23 20:58:28 UTC (rev 13229) @@ -77,6 +77,7 @@
CmiKeyType); if (!NT_SUCCESS(Status)) { + DPRINT("ObFindObject failed, Status: 0x%x\n", Status); return(Status); }
@@ -89,6 +90,7 @@ { ObDereferenceObject(Object); RtlFreeUnicodeString(&RemainingPath); + DPRINT("Object marked for delete!\n"); return(STATUS_UNSUCCESSFUL); }
@@ -101,7 +103,7 @@ TRUE, KeyHandle);
- DPRINT("Status %x\n", Status); + DPRINT("ObCreateHandle failed Status 0x%x\n", Status); ObDereferenceObject(Object); RtlFreeUnicodeString(&RemainingPath); return Status; @@ -118,6 +120,7 @@ { ObDereferenceObject(Object); RtlFreeUnicodeString(&RemainingPath); + DPRINT1("NtCreateKey() can't create trees! (found '\' in remaining path: "%wZ"!)\n", &RemainingPath); return STATUS_OBJECT_NAME_NOT_FOUND; }
@@ -134,6 +137,7 @@ (PVOID*)&KeyObject); if (!NT_SUCCESS(Status)) { + DPRINT1("ObCreateObject() failed!\n"); return(Status); }
@@ -147,6 +151,7 @@ { ObDereferenceObject(KeyObject); RtlFreeUnicodeString(&RemainingPath); + DPRINT1("ObInsertObject() failed!\n"); return(Status); }
@@ -965,7 +970,7 @@ ObjectAttributes ? ObjectAttributes->ObjectName : NULL);
PreviousMode = ExGetPreviousMode(); - + if(PreviousMode != KernelMode) { _SEH_TRY _____
Modified: trunk/reactos/ntoskrnl/io/pnpmgr.c --- trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/ntoskrnl/io/pnpmgr.c 2005-01-23 20:58:28 UTC (rev 13229) @@ -1378,6 +1378,13 @@
if (!IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED)) { + WCHAR RegKeyBuffer[MAX_PATH]; + UNICODE_STRING RegKey; + + RegKey.Length = 0; + RegKey.MaximumLength = sizeof(RegKeyBuffer); + RegKey.Buffer = RegKeyBuffer; + /* * Retrieve configuration from Enum key */ @@ -1391,9 +1398,12 @@ QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; QueryTable[0].EntryContext = Service;
- Status = RtlQueryRegistryValues(RTL_REGISTRY_ENUM, - DeviceNode->InstancePath.Buffer, QueryTable, NULL, NULL); + RtlAppendUnicodeToString(&RegKey, L"\Registry\Machine\System\CurrentControlSet\Enum\"); + RtlAppendUnicodeStringToString(&RegKey, &DeviceNode->InstancePath);
+ Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + RegKey.Buffer, QueryTable, NULL, NULL); + if (!NT_SUCCESS(Status)) { DPRINT("RtlQueryRegistryValues() failed (Status %x)\n", Status); _____
Modified: trunk/reactos/ntoskrnl/io/pnproot.c --- trunk/reactos/ntoskrnl/io/pnproot.c 2005-01-23 20:57:45 UTC (rev 13228) +++ trunk/reactos/ntoskrnl/io/pnproot.c 2005-01-23 20:58:28 UTC (rev 13229) @@ -409,7 +409,8 @@
DeviceDesc = &Device->DeviceDescription;
- wcscpy(KeyName, ENUM_NAME_ROOT); + wcscpy(KeyName, L"\Registry\Machine\System\CurrentControlSet\Enum\"); + wcscat(KeyName, ENUM_NAME_ROOT); wcscat(KeyName, L"\"); wcscat(KeyName, Device->ServiceName.Buffer); wcscat(KeyName, L"\"); @@ -426,7 +427,7 @@ QueryTable[0].EntryContext = DeviceDesc;
Status = RtlQueryRegistryValues( - RTL_REGISTRY_ENUM, + RTL_REGISTRY_ABSOLUTE, KeyName, QueryTable, NULL,