Identifying VMs through the registry
The underlying principle of all registry detection methods is that such registry keys and values do not exist on a typical host. Nevertheless, they exist in specific virtual environments.
The presence of VM artifacts on a typical system that has VMs installed can occasionally result in false positives when these tests are performed. In contrast to virtual environments, this system is treated cleanly in all other respects.
The first technique verifies the existence of specified registry paths. I can verify this using the following logic:
int registryKeyExist(HKEY rootKey, char* subKeyName) { HKEY registryKey = nullptr; LONG result = RegOpenKeyExA(rootKey, subKeyName, 0, KEY_READ, ®istryKey); if (result == ERROR_SUCCESS) { RegCloseKey(registryKey); return TRUE; } return FALSE; }
As you can see, I simply verify the existence of the registry key path. TRUE
is returned if...