Virtual devices can open, read, write, create, and delete registry keys and values using the registry services provide by the VMM. There are these registry services:
_GetRegistryKey | |
_GetRegistryPath | |
_RegCloseKey | |
_RegCreateKey | |
_RegDeleteKey | |
_RegDeleteValue | |
_RegEnumKey | |
_RegEnumValue | |
_RegFlushKey | |
_RegOpenKey | |
_RegQueryValue | |
_RegQueryValueEx | |
_RegSetValue | |
_RegSetValueEx |
During the protected-mode initialization phases, the registry may be written to but the data will not be flushed to disk until the end of the Device_Init phase. Until the end of this phase, virtual devices may only access the HKEY_LOCAL_MACHINE key. No other predefined keys are available.
The registry services can be called from either assembly-language or C-language source in a VxD. To call the registry from a Ring 3 driver or application, refer to the SDK documentation for Win32 registry services. Assembly-language calls have this form:
include vmmreg.inc < VMMCall _RegCloseKey <phKey> < cmp eax,ERROR_SUCCESS < jnz CreateFail
C-language calls have this from:
include <vmmreg.h> < if (VMM_RegCloseKey(phKey) != ERROR_SUCCESS) { < MyErrorHandler("RegCloseKey Failed"); < }