1

I am reading the documentation here about what is new in Inno Setup v6. To quote:

  • Added new [Registry] section Root value HKA. Equals HKLM in administrative install mode, and HKCU otherwise. Also supported by {reg:...} constants and HKA32/HKA64 are also supported. Note: HKA (like HKCU) should only be used for settings which are compatible with roaming profiles.

  • Using [Registry] section Root value HKCR is no longer recommended, use HKA with the Subkey parameter set to "Software\Classes" instead.

I have the following 4 registry entries:

; AJT v19.0.0 Download Help Documentation
; This registry key value is used by the Help Ribbon Panel.
; We set the preference registry value "DownloadHelpDocumentation"
; to 1 if the "downloadhelp" task was selected.
Root: "HKLM"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "1"; \
              Flags: uninsdeletevalue; \
              Tasks: downloadhelp;

Root: "HKLM64"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "1"; \
              Flags: uninsdeletevalue; \
              Check: IsWin64; \
              Tasks: downloadhelp;

; We set the preference registry value "DownloadHelpDocumentation"
; to 0 if the "downloadhelp" task was NOT selected.
Root: "HKLM"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "0"; \
              Flags: uninsdeletevalue; \
              Tasks: not downloadhelp;

Root: "HKLM64"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "0"; \
              Flags: uninsdeletevalue; \
              Check: IsWin64; \
              Tasks: not downloadhelp;

I was wondering if I could simplify the script to just two registry entries above or even one if the ValueData could be programatically determined.

There are two things going on:

  1. HKLM or HLM64
  2. ValueData of 1 or 0

But the quoted article refers to HKA -> HKLM or HKCU. So it is not the same thing. I confess that I don't really understand the difference between using HKLM or HKLM64.

Do I need four entries in the script?


Update

I saw this similar question which covers part of the issue. I have now reduced it to two entries:

; AJT v19.0.0 Download Help Documentation
; This registry key value is used by the Help Ribbon Panel.
; We set the preference registry value "DownloadHelpDocumentation"
; - to 1 if the "downloadhelp" task was selected.
; - to 0 if the "downloadhelp" task was NOT selected.
Root: "HKLM"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "{code:DownloadHelpDocumentation_ValueData}"; \
              Flags: uninsdeletevalue

Root: "HKLM64"; Subkey: "Software\Community Talks\Public Talks\Preferences"; \
              ValueType: dword; \
              ValueName: "DownloadHelpDocumentation"; \
              ValueData: "{code:DownloadHelpDocumentation_ValueData}"; \
              Flags: uninsdeletevalue; \
              Check: IsWin64
  • I added a {code:...} bit for the ValueData.
  • I removed the Task: downloadhelp etc. bits.
  • I added:

// Converts a Boolean to a String
function BoolToStr(bValue: boolean): string;
begin
    if(bValue = true) then
        result := '1'
    else
        result := '0';
end;

// AJT v19.0.0 Returns the selected task state
function DownloadHelpDocumentation_ValueData(Param: string): string;
begin
    result := BoolToStr(WizardIsTaskSelected('downloadhelp'));
end;

Update

Looking here it states:

A root key value without a suffix (for example, HKLM) is equivalent to the value with a suffix of 32 (for example, HKLM32) unless the install is running in 64-bit install mode, in which case it is equivalent to the value with a suffix of 64 (for example, HKLM64).

In my case I not using the ArchitecturesInstallIn64BitMode in my script. This is because my script installs for both 32 bit and 64 bit.

This is why I am confused. From my point of view the user will be running my software in one of three environments:

  1. Running 32bit app on 32bit Windows

I understand this to mean the registry will simply be HKLM.

  1. Running 32bit app on 64bit Windows

I understand this to mean the registry will be HKLM...\WOW6432Node.

  1. Running 64bit app on 64bit Windows

I understand this to mean the registry will simply be HKLM.

Thus I think I must have the two entries then, so that both bit edition locations are covered.

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • I think you should be able to use `ArchitecturesInstallIn64BitMode` and then use `HKLM64` with `Check: Is64BitInstallMode` for the 64-bit entries and `HKLM32` for the 32-bit entries. IIRC this would install both. (The same would apply for files.) – Bill_Stewart Jun 05 '19 at 16:11
  • @Bill_Stewart This would not affect any existing user setups by making these changes? – Andrew Truckle Jun 05 '19 at 18:08
  • Can you clarify? Are you saying you need to install both 64-bit and 32-bit if OS is 64-bit? Or are you saying you need to install only 64-bit if OS is 64-bit, and 32-bit if OS is 32-bit? – Bill_Stewart Jun 07 '19 at 16:28
  • @Bill_Stewart Yes, I install both 64 bit and 32 bit if the OS is 64 bit. This is because of the database drivers. Sometimes the user must run the 32 bit edition as they have 32 bit drivers. – Andrew Truckle Jun 07 '19 at 16:53
  • In that case, my first comment would be applicable. – Bill_Stewart Jun 07 '19 at 17:08
  • @Bill_Stewart Ok. But how does that differ to using HKLM / HKLM64? And, what if the PC OS is only 32 bit? – Andrew Truckle Jun 07 '19 at 18:39
  • You need `ArchitecturesInstallIn64BitMode` to install in 64-bit mode, and specify the 64-bit components using `Check: Is64BitInstallMode`. For the 32-bit components, specify `HKLM32` (which is just `HKLM` on a 32-bit OS). You will have to specify both if you want to install both. – Bill_Stewart Jun 07 '19 at 18:45

0 Answers0