Reputation: 651
I want to write installer for the application which is designed for x64 Windows 10. I have defined in Inno Setup Script:
[Setup]
MinVersion=10.0.14393
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
AlwaysRestart=yes
Also I want that during the installation, long paths will be enabled in Windows registry. I added following code:
[Registry]
Root: HKLM64; Subkey: "System\CurrentcontrolSet\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify
Root: HKLM64; Subkey: "System\ControlSet001\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Flags: createvalueifdoesntexist; Permissions: users-modify
When I run the installer on my personal computer and restart, registry entries are changed, but when my colleague runs the installer and restarts, entries are not changed. The application itself works on both our computers. We both have x64 Windows 10 systems and administrator rights. What might be the reasons this script is failing on some computers?
The log file content for the computer, where entries are not changed:
2019-10-09 09:44:41.296 Key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296 Value name: LongPathsEnabled
2019-10-09 09:44:41.296 Setting permissions on key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
2019-10-09 09:44:41.296 Starting 64-bit helper process.
2019-10-09 09:44:41.328 Helper process PID: 3248
2019-10-09 09:44:41.343 Creating or opening the key.
2019-10-09 09:44:41.343 Successfully created the key.
2019-10-09 09:44:41.343 -- Registry entry --
2019-10-09 09:44:41.343 Key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343 Value name: LongPathsEnabled
2019-10-09 09:44:41.343 Setting permissions on key: HKEY_LOCAL_MACHINE\System\ControlSet001\Control\FileSystem
2019-10-09 09:44:41.343 Creating or opening the key.
2019-10-09 09:44:41.343 Successfully created the key.
Upvotes: 2
Views: 2125
Reputation: 202272
Just remove the createvalueifdoesntexist
flag.
That's what causes the problem and you do not want it in the first place.
Upvotes: 2
Reputation: 651
What finally seems to be working is checking if the value is already in the register, and if not setting the value with flag createvalueifdoesntexist
. Otherwise, the value is jus changed.
[Registry]
Root: HKLM64; Subkey: "System\CurrentControlSet\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Permissions: users-modify; Flags: createvalueifdoesntexist; Check: LPECurrentControlSetNotInRegistry
Root: HKLM64; Subkey: "System\ControlSet001\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Permissions: users-modify; Flags: createvalueifdoesntexist; Check: LPEControlSet001NotInRegistry
Root: HKLM64; Subkey: "System\CurrentControlSet\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Permissions: users-modify; Check: LPECurrentControlSetNotInRegistry
Root: HKLM64; Subkey: "System\ControlSet001\Control\FileSystem"; ValueType: dword; ValueName: "LongPathsEnabled"; ValueData: "1"; Permissions: users-modify; Check: LPEControlSet001NotInRegistry
[Code]
function LPECurrentControlSetNotInRegistry: Boolean;
begin
if not RegValueExists(HKEY_LOCAL_MACHINE, 'System\CurrentControlSet\Control\FileSystem', 'LongPathsEnabled') then
begin
Result := True;
Exit;
end;
Result := False;
end;
function LPEControlSet001NotInRegistry: Boolean;
begin
if not RegValueExists(HKEY_LOCAL_MACHINE, 'System\ControlSet001\Control\FileSystem', 'LongPathsEnabled') then
begin
Result := True;
Exit;
end;
Result := False;
end;
Upvotes: 0