OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
ClassesKey,
NULL);
- Status = ZwOpenKey(GuidKeyRealP,
- DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
- &ObjectAttributes);
+ Status = ZwCreateKey(GuidKeyRealP,
+ DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
ZwClose(ClassesKey);
if (!NT_SUCCESS(Status))
{
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
*GuidKeyRealP,
NULL);
- Status = ZwOpenKey(DeviceKeyRealP,
- DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
- &ObjectAttributes);
+ Status = ZwCreateKey(DeviceKeyRealP,
+ DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to open %wZ%wZ\\%wZ\n", &BaseKeyU, &GuidString, &SubKeyName);
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
*DeviceKeyRealP,
NULL);
- Status = ZwOpenKey(InstanceKeyRealP,
- DesiredAccess,
- &ObjectAttributes);
+ Status = ZwCreateKey(InstanceKeyRealP,
+ DesiredAccess,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to open %wZ%wZ\\%wZ%\\%wZ (%x)\n", &BaseKeyU, &GuidString, &SubKeyName, &ReferenceString, Status);
PDEVICE_OBJECT PhysicalDeviceObject;
PFILE_OBJECT FileObject;
UNICODE_STRING GuidString;
- UNICODE_STRING SymLink;
PWCHAR StartPosition;
PWCHAR EndPosition;
NTSTATUS Status;
/* Symbolic link name is \??\ACPI#PNP0501#1#{GUID}\ReferenceString */
/* Get GUID from SymbolicLinkName */
- StartPosition = wcschr(SymbolicLinkName->Buffer, L'{');
- EndPosition = wcschr(SymbolicLinkName->Buffer, L'}');
+ StartPosition = wcsrchr(SymbolicLinkName->Buffer, L'{');
+ EndPosition = wcsrchr(SymbolicLinkName->Buffer, L'}');
if (!StartPosition ||!EndPosition || StartPosition > EndPosition)
{
DPRINT1("IoSetDeviceInterfaceState() returning STATUS_INVALID_PARAMETER_1\n");
GuidString.Buffer = StartPosition;
GuidString.MaximumLength = GuidString.Length = (USHORT)((ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)StartPosition);
- SymLink.Buffer = SymbolicLinkName->Buffer;
- SymLink.MaximumLength = SymLink.Length = (USHORT)((ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)SymLink.Buffer);
- DPRINT("IoSetDeviceInterfaceState('%wZ', %u)\n", SymbolicLinkName, Enable);
-
Status = OpenRegistryHandlesFromSymbolicLink(SymbolicLinkName,
KEY_CREATE_SUB_KEY,
NULL,
/* Get pointer to the PDO */
Status = IoGetDeviceObjectPointer(
- &SymLink,
+ SymbolicLinkName,
0, /* DesiredAccess */
&FileObject,
&PhysicalDeviceObject);