ID3D12Device::SetStablePowerState
function call is only available if developer mode is turned on in the system. If not, it triggers a device removal.
Is there an API to detect if the developer mode is on, so far i found nothing on msdn allowing an application to query it.
It appears a simple registry key hold the information, here a simple function to query the developer mode status.
bool IsDeveloperModeEnabled() {
HKEY hKey;
auto err = RegOpenKeyExW(HKEY_LOCAL_MACHINE,LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)",0,KEY_READ,&hKey);
if (err!=ERROR_SUCCESS)
return false;
DWORD value{};
DWORD dwordSize = sizeof(DWORD);
err = RegQueryValueExW(hKey,L"AllowDevelopmentWithoutDevLicense",0,NULL,reinterpret_cast<LPBYTE>(&value),&dwordSize);
RegCloseKey(hKey);
if (err!=ERROR_SUCCESS)
return false;
return value != 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With