Write access failed for LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\PORTS\0000\Device Parameter

The below function call failed with error code : c000000d811 from DeviceConfigure in UMDF driver.

status=WdfDeviceOpenRegistryKey(device,
PLUGPLAY_REGKEY_DEVICE,
KEY_WRITE|KEY_QUERY_VALUE,
WDF_NO_OBJECT_ATTRIBUTES,
&key);

When look-up for Win32 error code not found(even in https://www.osr.com/wp-content/uploads/NTtoDos.pdf).

Any idea what would have caused it fail?

If third parameter value is changed from KEY_WRITE|KEY_QUERY_VALUE to KEY_QUERY_VALUE, It shall succeeded. Seems to be access permission issue.

Can we create or write to this device registry area from within UMDF?

c000000d811 is not a valid error number. Errors are only 32 bits. If you really meant 0xC000000D, that’s STATUS_INVALID_PARAMETER.

The table in the documentation implies that a UMDF driver only gets read access to that key. https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdfdevice/nf-wdfdevice-wdfdeviceopenregistrykey

1 Like

Thank you very much Tim for the reply!

When reg key is opened (using WdfDeviceOpenRegistryKey) with access ( PLUGPLAY_REGKEY_DEVICE|WDF_REGKEY_DEVICE_SUBKEY,
KEY_READ|KEY_SET_VALUE) , the key values were able to be written (using WdfRegistryAssignULong ) under nested folder with named as driver under the “Device Parameters” folder.

Reg Key Open API:
WdfDeviceOpenRegistryKey(pQueueContext->DeviceContext->Device,
PLUGPLAY_REGKEY_DEVICE|WDF_REGKEY_DEVICE_SUBKEY,
KEY_READ|KEY_SET_VALUE,
WDF_NO_OBJECT_ATTRIBUTES,
&key);

I had to specify WDF_REGKEY_DEVICE_SUBKEY; otherwise write shall succeeded but value shall not be reflected in the actual registry.

Thanks,
Remya