Skip to content

Commit

Permalink
Detect developer mode in Windows installer (crystal-lang#13681)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored and Blacksmoke16 committed Dec 11, 2023
1 parent 940a103 commit 00ed9b4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion etc/win-ci/crystal.iss
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ begin
HasWinSDKAt(HKEY_CURRENT_USER, Win10SDK32);
end;
function IsDeveloperModeEnabled: Boolean;
var
regValue: Cardinal;
begin
result := False;
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock', 'AllowDevelopmentWithoutDevLicense', regValue) then
if regValue <> 0 then
result := True;
end;
{ Adopted from https://stackoverflow.com/a/46609047 }
procedure EnvAddPath(Path: string; IsSystem: Boolean);
var
Expand Down Expand Up @@ -302,7 +312,13 @@ begin
'Please install the missing components using one of the following options: \line\line ' +
'\emspace\bullet\emspace https://aka.ms/vs/17/release/vs_BuildTools.exe for the build tools alone \line ' +
'\emspace\bullet\emspace https://visualstudio.microsoft.com/downloads/ for the build tools + Visual Studio 2022 \line\line ' +
'The {\b Desktop development with C++} workload should be selected.';
'The {\b Desktop development with C++} workload should be selected. \line\line ';
if not IsDeveloperModeEnabled() then
message := message +
'{\b WARNING:} Developer Mode is not enabled on this machine. Please refer to ' +
'https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development ' +
'for instructions on how to enable Developer Mode. \line\line ';
if message <> '' then
warningsPage := CreateOutputMsgMemoPage(wpInfoAfter,
Expand Down

0 comments on commit 00ed9b4

Please sign in to comment.