RtlCopyMemory(FullImagePath, PathPrefix.Buffer, PathPrefix.MaximumLength);
wcscat(FullImagePath, ImagePath);
- DPRINT1("Using driver '%S' for device '%S'\n", ImagePath, DeviceId);;
+ DPRINT("Using driver '%S' for device '%S'\n", ImagePath, DeviceId);
/* Create service key */
RtlInitUnicodeString(&StringU, Driver);
NtClose(hDeviceKey);
return;
}
- else
+ else if (pPartialInformation)
{
for (HardwareID = (LPCWSTR)pPartialInformation->Data;
(PUCHAR)HardwareID < pPartialInformation->Data + pPartialInformation->DataLength
DPRINT1("NtQueryValueKey() failed with status 0x%08x\n", Status);
return;
}
- else
+ else if (pPartialInformation)
{
for (HardwareID = (LPCWSTR)pPartialInformation->Data;
(PUCHAR)HardwareID < pPartialInformation->Data + pPartialInformation->DataLength
hInf = *(HINF *)lpParameter;
InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_CASE_INSENSITIVE, NULL, NULL);
- Status = NtOpenKey(&hEnum, 0, &ObjectAttributes);
+ Status = NtOpenKey(&hEnum, KEY_QUERY_VALUE, &ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DPRINT1("NtOpenKey('%wZ') failed with status 0x%08lx\n", &EnumU, Status);
if (Status == STATUS_BUFFER_TOO_SMALL)
{
PnpEventSize += 0x400;
- PnpEvent = (PPLUGPLAY_EVENT_BLOCK)RtlReAllocateHeap(ProcessHeap, 0, PnpEvent, PnpEventSize);
+ RtlFreeHeap(ProcessHeap, 0, PnpEvent);
+ PnpEvent = (PPLUGPLAY_EVENT_BLOCK)RtlAllocateHeap(ProcessHeap, 0, PnpEventSize);
if (PnpEvent == NULL)
{
NtClose(hEnum);
/* Process the pnp event */
DPRINT("Received PnP Event\n");
- if (IsEqualIID(&PnpEvent->EventGuid, (REFGUID)&GUID_DEVICE_ARRIVAL))
+ if (IsEqualIID(&PnpEvent->EventGuid, (REFGUID)&GUID_DEVICE_ENUMERATED))
{
- DPRINT1("Device arrival event: %S\n", PnpEvent->TargetDevice.DeviceIds);
+ DPRINT("Device arrival event: %S\n", PnpEvent->TargetDevice.DeviceIds);
InstallDevice(hInf, hEnum, hServices, PnpEvent->TargetDevice.DeviceIds);
}
else