goto cleanup;
}
RtlCopyMemory(NewBuffer, ReturnBuffer.Buffer, ReturnBuffer.Length);
- ExFreePool(ReturnBuffer.Buffer);
+ if (ReturnBuffer.Buffer)
+ ExFreePool(ReturnBuffer.Buffer);
ReturnBuffer.Buffer = NewBuffer;
}
DPRINT("Adding symbolic link %wZ\n", &KeyName);
Status = STATUS_SUCCESS;
cleanup:
- if (!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status) && ReturnBuffer.Buffer)
ExFreePool(ReturnBuffer.Buffer);
if (InterfaceKey != INVALID_HANDLE_VALUE)
ZwClose(InterfaceKey);
ZwClose(ReferenceKey);
if (ControlKey != INVALID_HANDLE_VALUE)
ZwClose(ControlKey);
- ExFreePool(DeviceBi);
- ExFreePool(ReferenceBi);
- ExFreePool(bip);
+ if (DeviceBi)
+ ExFreePool(DeviceBi);
+ if (ReferenceBi)
+ ExFreePool(ReferenceBi);
+ if (bip)
+ ExFreePool(bip);
return Status;
}
Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name);
if (!NT_SUCCESS(Status) && ReferenceString == NULL)
{
- DPRINT("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status);
+ DPRINT1("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status);
ZwClose(SubKey);
ZwClose(InterfaceKey);
ZwClose(ClassKey);
SymbolicLinkName->Length);
if (!NT_SUCCESS(Status))
{
- DPRINT("ZwSetValueKey() failed with status 0x%08lx\n", Status);
+ DPRINT1("ZwSetValueKey() failed with status 0x%08lx\n", Status);
ExFreePool(SymbolicLinkName->Buffer);
}
else
if (SymbolicLinkName == NULL)
return STATUS_INVALID_PARAMETER_1;
- DPRINT("IoSetDeviceInterfaceState('%wZ', %d)\n", SymbolicLinkName, Enable);
+ DPRINT1("IoSetDeviceInterfaceState('%wZ', %d)\n", SymbolicLinkName, Enable);
/* Symbolic link name is \??\ACPI#PNP0501#1#{GUID}\ReferenceString */
/* Get GUID from SymbolicLinkName */
EndPosition = wcschr(SymbolicLinkName->Buffer, L'}');
if (!StartPosition ||!EndPosition || StartPosition > EndPosition)
{
- DPRINT("IoSetDeviceInterfaceState() returning STATUS_INVALID_PARAMETER_1\n");
+ DPRINT1("IoSetDeviceInterfaceState() returning STATUS_INVALID_PARAMETER_1\n");
return STATUS_INVALID_PARAMETER_1;
}
GuidString.Buffer = StartPosition;
SymLink.Buffer = SymbolicLinkName->Buffer;
SymLink.MaximumLength = SymLink.Length = (USHORT)((ULONG_PTR)(EndPosition + 1) - (ULONG_PTR)SymLink.Buffer);
-
-
+ DPRINT1("IoSetDeviceInterfaceState('%wZ', %d)\n", SymbolicLinkName, Enable);
/* Get pointer to the PDO */
Status = IoGetDeviceObjectPointer(
&SymLink,
&PhysicalDeviceObject);
if (!NT_SUCCESS(Status))
{
- DPRINT("IoGetDeviceObjectPointer() failed with status 0x%08lx\n", Status);
+ DPRINT1("IoGetDeviceObjectPointer() failed with status 0x%08lx\n", Status);
return Status;
}
(PVOID)SymbolicLinkName);
ObDereferenceObject(FileObject);
-
+DPRINT1("Status %x\n", Status);
return STATUS_SUCCESS;
}