[NTOS:IO] IoRegisterDeviceInterface: create non-volatile keys for new device interfaces

Always create only non-volatile (sub)keys when registering a new device interface, so then they are saved after reboot.
On Windows, nearly all device interface keys are non-volatile, except the "Control" subkey, which is managed by IoSetDeviceInterfaceState instead.
In particular, it fixes MS sysaudio loading failure with MS audio drivers replacement (ks, portcls, swenum, sysaudio, wdmaud). My IoGetDeviceInterfaceAlias implementation is also required to be applied. MS sysaudio implementation(s) except that those keys are non-volatile (but we're creating them volatile instead), and trying to create a subkey(s) there (via other IoDeviceInterface* routines), to read/write some needed data. But then they fail to do that with STATUS_CHILD_MUST_BE_VOLATILE (0xc0000181), obviously because our keys are volatile.
The volatile keys can never have non-volatile subkeys.
CORE-17361
This commit is contained in:
Oleg Dubinskiy 2022-01-16 19:57:43 +02:00 committed by Robert Naumann
parent 215148267e
commit 7309801e5a

View File

@ -1060,7 +1060,7 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
&ObjectAttributes,
0, /* TileIndex */
NULL, /* Class */
REG_OPTION_VOLATILE,
REG_OPTION_NON_VOLATILE,
NULL); /* Disposition */
if (!NT_SUCCESS(Status))
@ -1111,7 +1111,7 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
&ObjectAttributes,
0, /* TileIndex */
NULL, /* Class */
REG_OPTION_VOLATILE,
REG_OPTION_NON_VOLATILE,
NULL); /* Disposition */
if (!NT_SUCCESS(Status))
@ -1175,7 +1175,7 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
&ObjectAttributes,
0, /* TileIndex */
NULL, /* Class */
REG_OPTION_VOLATILE,
REG_OPTION_NON_VOLATILE,
NULL); /* Disposition */
if (!NT_SUCCESS(Status))