How to detect if developer mode is active on windows 10?
Asked Answered
F

1

9

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.

Flatworm answered 19/12, 2016 at 21:49 Comment(2)
This may help you. Looks like a registry thing and can be done via powershell, so maybe you could use that info to construct your own method in code and post as an answer.Halfhour
@Adrian Yes, it was that simple, i answered to my question for later reference to whom may need it.Flatworm
F
12

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;
}
Flatworm answered 19/12, 2016 at 22:36 Comment(1)
That code is not building.Cagey

© 2022 - 2024 — McMap. All rights reserved.