mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
get rid of the reactos-only RTL_REGISTRY_ENUM flag and added more debug messages to ease debugging failures
svn path=/trunk/; revision=13229
This commit is contained in:
parent
05934c33b6
commit
7b20e4cdbf
6 changed files with 60 additions and 26 deletions
|
@ -458,8 +458,7 @@ RtlZeroMemory (PVOID Destination, ULONG Length);
|
|||
#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
|
||||
|
|
|
@ -51,6 +51,13 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
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 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
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 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
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 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
if (Create == TRUE)
|
||||
if (Create)
|
||||
{
|
||||
Status = ZwCreateKey(KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
|
@ -144,6 +145,13 @@ RtlpGetRegistryHandle(ULONG RelativeTo,
|
|||
&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 @@ RtlWriteRegistryValue(IN ULONG RelativeTo,
|
|||
TRUE,
|
||||
&KeyHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("RtlpGetRegistryHandle() failed! Status: 0x%x\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
RtlInitUnicodeString(&Name,
|
||||
ValueName);
|
||||
|
@ -887,8 +898,12 @@ RtlWriteRegistryValue(IN ULONG RelativeTo,
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -242,7 +242,8 @@ CmImportHardwareHive(PCHAR ChunkBase,
|
|||
&Disposition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
NtClose (HardwareKey);
|
||||
|
||||
|
@ -263,7 +264,8 @@ CmImportHardwareHive(PCHAR ChunkBase,
|
|||
&Disposition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
NtClose (HardwareKey);
|
||||
|
||||
|
@ -284,7 +286,8 @@ CmImportHardwareHive(PCHAR ChunkBase,
|
|||
&Disposition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
NtClose (HardwareKey);
|
||||
|
||||
|
@ -305,7 +308,8 @@ CmImportHardwareHive(PCHAR ChunkBase,
|
|||
&Disposition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return FALSE;
|
||||
DPRINT1("NtCreateKey() failed, status: 0x%x\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
NtClose (HardwareKey);
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
CmiKeyType);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ObFindObject failed, Status: 0x%x\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
@ -89,6 +90,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
{
|
||||
ObDereferenceObject(Object);
|
||||
RtlFreeUnicodeString(&RemainingPath);
|
||||
DPRINT("Object marked for delete!\n");
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
|
@ -101,7 +103,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
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 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
{
|
||||
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 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
(PVOID*)&KeyObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("ObCreateObject() failed!\n");
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
@ -147,6 +151,7 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
{
|
||||
ObDereferenceObject(KeyObject);
|
||||
RtlFreeUnicodeString(&RemainingPath);
|
||||
DPRINT1("ObInsertObject() failed!\n");
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
@ -965,7 +970,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
|||
ObjectAttributes ? ObjectAttributes->ObjectName : NULL);
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
|
||||
if(PreviousMode != KernelMode)
|
||||
{
|
||||
_SEH_TRY
|
||||
|
|
|
@ -1378,6 +1378,13 @@ IopActionConfigureChildServices(
|
|||
|
||||
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,8 +1398,11 @@ IopActionConfigureChildServices(
|
|||
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))
|
||||
{
|
||||
|
|
|
@ -409,7 +409,8 @@ PnpRootFdoReadDeviceInfo(
|
|||
|
||||
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 @@ PnpRootFdoReadDeviceInfo(
|
|||
QueryTable[0].EntryContext = DeviceDesc;
|
||||
|
||||
Status = RtlQueryRegistryValues(
|
||||
RTL_REGISTRY_ENUM,
|
||||
RTL_REGISTRY_ABSOLUTE,
|
||||
KeyName,
|
||||
QueryTable,
|
||||
NULL,
|
||||
|
|
Loading…
Reference in a new issue