45 OBJECT_ATTRIBUTES objectAttributes;
55 DBG_IRQL( == PASSIVE_LEVEL);
56 InitializeObjectAttributes(&objectAttributes,
57 Path, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL);
61 DBG_IRQL( == PASSIVE_LEVEL);
62 ntStatus = ZwOpenKey(HandleKey, KEY_READ, &objectAttributes);
64 FUNC_LEAVE_NTSTATUS(ntStatus);
96 IN PDEVICE_EXTENSION Pdx)
98 IO_STATUS_BLOCK ioStatusBlock;
108 KeInitializeEvent(&event, NotificationEvent, FALSE);
112 DBG_IRQL( == PASSIVE_LEVEL);
113 irp = IoBuildSynchronousFsdRequest(
115 Pdx->ParallelPortFdo,
126 ntStatus = STATUS_INSUFFICIENT_RESOURCES;
130 PIO_STACK_LOCATION irpSp;
138 DBG_IRQL( <= DISPATCH_LEVEL);
139 irpSp = IoGetNextIrpStackLocation(irp);
145 irpSp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
146 irpSp->Parameters.QueryDeviceRelations.Type = TargetDeviceRelation;
147 irpSp->FileObject = Pdx->ParallelPortFileObject;
151 DBG_IRQL( <= DISPATCH_LEVEL);
152 ntStatus = IoCallDriver(Pdx->ParallelPortFdo, irp);
160 ntStatus = STATUS_INSUFFICIENT_RESOURCES;
165 if (ntStatus == STATUS_PENDING)
167 DBG_IRQL( < DISPATCH_LEVEL);
168 KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
171 if (NT_SUCCESS(ntStatus))
173 PDEVICE_RELATIONS deviceRelations;
178 deviceRelations = (PDEVICE_RELATIONS) ioStatusBlock.Information;
185 pdo = deviceRelations->Objects[0];
189 DBG_IRQL( == PASSIVE_LEVEL);
192 PLUGPLAY_REGKEY_DEVICE,
203 DBG_IRQL( < DISPATCH_LEVEL);
204 ExFreePool(deviceRelations);
210 FUNC_LEAVE_NTSTATUS(ntStatus);
238 DBG_IRQL( == PASSIVE_LEVEL);
239 ntStatus = ZwClose(HandleKey);
241 FUNC_LEAVE_NTSTATUS(ntStatus);
272 DBG_IRQL( <= DISPATCH_LEVEL);
273 ObDereferenceObject(Pdo);
275 FUNC_LEAVE_NTSTATUS(ntStatus);
301 PKEY_VALUE_PARTIAL_INFORMATION p;
302 UNICODE_STRING keyNameUnicode;
305 CHAR buffer[
sizeof(KEY_VALUE_PARTIAL_INFORMATION)+
sizeof(ULONG)];
311 p = (PKEY_VALUE_PARTIAL_INFORMATION) buffer;
313 RtlInitUnicodeString(&keyNameUnicode, KeyName);
315 ntStatus = ZwQueryValueKey(HandleKey, &keyNameUnicode,
316 KeyValuePartialInformation,
317 buffer,
sizeof(buffer), &retValueSize);
319 if (NT_SUCCESS(ntStatus))
321 if (p->Type == REG_DWORD && p->DataLength ==
sizeof(ULONG))
323 ULONG retValue = *((PULONG) &p->Data);
334 FUNC_LEAVE_NTSTATUS(ntStatus);
358 PKEY_VALUE_PARTIAL_INFORMATION p;
359 UNICODE_STRING keyNameUnicode;
362 CHAR buffer[
sizeof(KEY_VALUE_PARTIAL_INFORMATION)+
sizeof(ULONG)];
368 p = (PKEY_VALUE_PARTIAL_INFORMATION) buffer;
370 RtlInitUnicodeString(&keyNameUnicode, KeyName);
372 ntStatus = ZwSetValueKey(HandleKey, &keyNameUnicode,
373 0, REG_DWORD, &Value,
sizeof(Value));
375 FUNC_LEAVE_NTSTATUS(ntStatus);
NTSTATUS cbm_registry_close_hardwarekey(IN HANDLE HandleKey, IN PDEVICE_OBJECT Pdo)
Close a hardware registry key.
NTSTATUS CbmOpenDeviceRegistryKey(IN PDEVICE_OBJECT a, IN ULONG b, IN ACCESS_MASK c, OUT PHANDLE d)
Stub for a function.
NTSTATUS cbm_registry_open_hardwarekey(OUT PHANDLE HandleKey, OUT PDEVICE_OBJECT *Pdo, IN PDEVICE_EXTENSION Pdx)
Open the hardware key for another driver.
NTSTATUS cbm_registry_open_for_read(OUT PHANDLE HandleKey, IN PUNICODE_STRING Path)
Open a registry path for reading.
NTSTATUS cbm_registry_read_ulong(IN HANDLE HandleKey, IN PCWSTR KeyName, OUT PULONG Value)
Read a ULONG value out of a registry key.
NTSTATUS cbm_registry_close(IN HANDLE HandleKey)
Close a registry key.
NTSTATUS cbm_registry_write_ulong(IN HANDLE HandleKey, IN PCWSTR KeyName, IN ULONG Value)
Write a ULONG value out of a registry key.
Definitions for the opencbm driver.