Creating Registry Subkeys In UMDF2

I’m interested in trying to create registry subkeys under the device key. According to https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdfdevice/nf-wdfdevice-wdfdeviceopenregistrykey, it looks like PLUGPLAY_REGKEY_DEVICE | WDF_REGKEY_DEVICE_SUBKEY key can only only be opened with KEY_READ | KEY_SET_VALUE, not KEY_WRITE or KEY_CREATE_SUB_KEY permissions. This is in line with what I’ve observed from trying to open the key with KEY_CREATE_SUB_KEY, which fails. Calling WdfRegistryCreateKey fails when attempting to create a subkey under the device key opened with the recommended KEY_READ | KEY_SET_VALUE. It looks like this is the case for all UMDF driver/device keys, including the Parameters key. Is it possible to create subkeys under the device or parameters keys from a UMDF driver? It seems like that’s something that should be able to be done, but I don’t see a way in the WDF API to do so.

Are you trying to write private to the driver keys and values or is some other component going to read them? UMDF provides a different registry key where your driver can keep private state under driver created keys.

It is private device-specific configuration. What registry key should I be using for this? I find it odd that UMDF drivers can write values to the Parameters and Device keys, but not create subkeys. Is that correct?