RtlInitUnicodeString(&ValueName, L"DeviceDesc");
if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND)
{
- if (NT_SUCCESS(IoStatusBlock.Status) &&
+ if (NT_SUCCESS(Status) &&
IoStatusBlock.Information &&
(*(PWSTR)IoStatusBlock.Information != 0))
{
}
else
{
- UNICODE_STRING DeviceDesc;
- RtlInitUnicodeString(&DeviceDesc, L"Unknown Device");
- DPRINT("Driver didn't return DeviceDesc (Status %x), so place unknown device there\n", Status);
+ UNICODE_STRING DeviceDesc = RTL_CONSTANT_STRING(L"Unknown device");
+ DPRINT("Driver didn't return DeviceDesc (Status 0x%08lx), so place unknown device there\n", Status);
Status = ZwSetValueKey(InstanceKey,
&ValueName,
0,
REG_SZ,
- &DeviceDesc,
- (wcslen((PWSTR)&DeviceDesc) + 1) * sizeof(WCHAR));
+ DeviceDesc.Buffer,
+ DeviceDesc.MaximumLength);
if (!NT_SUCCESS(Status))
{
* device is started */
DPRINT("%wZ is using NULL driver\n", &DeviceNode->InstancePath);
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
+ DeviceNode->Flags |= DN_STARTED;
}
return STATUS_SUCCESS;
}
if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED)
{
if (Status != STATUS_IMAGE_ALREADY_LOADED)
+ {
+ DeviceNode->Flags |= DN_DRIVER_LOADED;
Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
&DeviceNode->ServiceName, FALSE, &DriverObject);
+ }
else
{
/* get existing DriverObject pointer */
if (!NT_SUCCESS(Status))
{
- /* FIXME: */
+ Device->DeviceDescription.Buffer = NULL;
}
DPRINT("Got device description: %S\n", DeviceDesc->Buffer);
{
DPRINT("Called\n");
- DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH) PnpRootPnpControl;
- DriverObject->MajorFunction[IRP_MJ_POWER] = (PDRIVER_DISPATCH) PnpRootPowerControl;
+ DriverObject->MajorFunction[IRP_MJ_PNP] = PnpRootPnpControl;
+ DriverObject->MajorFunction[IRP_MJ_POWER] = PnpRootPowerControl;
DriverObject->DriverExtension->AddDevice = PnpRootAddDevice;
return STATUS_SUCCESS;