|
Navigation
- Home
- Community
- Development
- myReactOS
- Fundraiser 2012
Doxygen
- Main Page
- Alphabetical List
- Data Structures
- Directories
- File List
- Data Fields
- Globals
- Related Pages
Search
|
|
|
Definition at line 275 of file registry.cpp.
Referenced by CMiniportWaveCMI::loadChannelConfigFromRegistry(), and CMiniportWaveCMI::storeChannelConfigToRegistry().
{
HANDLE hHandle;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
CRegistryKey * RegistryKey;
PPCLASS_DEVICE_EXTENSION DeviceExt;
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor;
ISubdevice * Device;
PSYMBOLICLINK_ENTRY SymEntry;
BOOL CanDelete = FALSE;
DPRINT("PcNewRegistryKey entered\n");
if (!OutRegistryKey)
return STATUS_INVALID_PARAMETER;
if (RegistryKeyType != GeneralRegistryKey &&
RegistryKeyType != DeviceRegistryKey &&
RegistryKeyType != DriverRegistryKey &&
RegistryKeyType != HwProfileRegistryKey &&
RegistryKeyType != DeviceInterfaceRegistryKey)
{
return STATUS_INVALID_PARAMETER;
}
if (RegistryKeyType == GeneralRegistryKey)
{
if (!ObjectAttributes)
{
return STATUS_INVALID_PARAMETER;
}
Status = ZwCreateKey(&hHandle, DesiredAccess, ObjectAttributes, 0, NULL, CreateOptions, Disposition);
CanDelete = TRUE;
}
else if (RegistryKeyType == DeviceRegistryKey ||
RegistryKeyType == DriverRegistryKey ||
RegistryKeyType == HwProfileRegistryKey)
{
if (RegistryKeyType == HwProfileRegistryKey)
{
RegistryKeyType = PLUGPLAY_REGKEY_CURRENT_HWPROFILE | PLUGPLAY_REGKEY_DEVICE;
}
DeviceExt = (PPCLASS_DEVICE_EXTENSION) ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
Status = IoOpenDeviceRegistryKey(DeviceExt->PhysicalDeviceObject, RegistryKeyType, DesiredAccess, &hHandle);
}
else if (RegistryKeyType == DeviceInterfaceRegistryKey)
{
if (SubDevice == NULL)
{
return STATUS_INVALID_PARAMETER;
}
Status = ((PUNKNOWN)SubDevice)->QueryInterface(IID_ISubdevice, (LPVOID*)&Device);
if (!NT_SUCCESS(Status))
{
DPRINT("No ISubdevice interface\n");
return STATUS_INVALID_PARAMETER;
}
Status = Device->GetDescriptor(&SubDeviceDescriptor);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to get subdevice descriptor %x\n", Status);
((PUNKNOWN)SubDevice)->Release();
return STATUS_UNSUCCESSFUL;
}
if (IsListEmpty(&SubDeviceDescriptor->SymbolicLinkList))
{
DPRINT("No device interface registered\n");
((PUNKNOWN)SubDevice)->Release();
return STATUS_UNSUCCESSFUL;
}
SymEntry = (PSYMBOLICLINK_ENTRY)CONTAINING_RECORD(SubDeviceDescriptor->SymbolicLinkList.Flink, SYMBOLICLINK_ENTRY, Entry);
Status = IoOpenDeviceInterfaceRegistryKey(&SymEntry->SymbolicLink, DesiredAccess, &hHandle);
((PUNKNOWN)SubDevice)->Release();
}
if (!NT_SUCCESS(Status))
{
DPRINT1("PcNewRegistryKey failed with %lx\n", Status);
return Status;
}
RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hHandle, CanDelete);
if (!RegistryKey)
{
ZwClose(hHandle);
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = RegistryKey->QueryInterface(IID_IRegistryKey, (PVOID*)OutRegistryKey);
if (!NT_SUCCESS(Status))
{
delete RegistryKey;
}
DPRINT("PcNewRegistryKey result %p\n", *OutRegistryKey);
return STATUS_SUCCESS;
}
|
Generated on Sat May 26 2012 05:26:00 for ReactOS by
1.7.6.1
|