raoulvolfoni
24th October 2011 17:33 UTC
SetRegView 32 doesn't seem to do what it's supposed to
Hi
I'm making an installer for a 32bit app installable on Windows XP 32bit and Seven 32 or 64bit.
Under a 64bit Windows Seven, this app needs to be run in "Windows XP SP3 compatibility mode" due to a third party lib problem.
Also, I run the installer in "admin" exec level (RequestExecutionLevel admin) because I write in the HKLM path.
So in my nsis script I added the following lines:
SetRegView 32
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" $INSTDIR\MyApp.exe WINXPSP3
SetRegView 64
Which should avoid the Wow6432Node reflection and write directly into this specific key.
But in Windows Seven x64 it doesn't: it still writes in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers.
Normally it shouldn't be a problem because, if I understand correctly, Windows should take care of the reflection. However, after installation, the compatibility mode for Windows XP SP3 isn't checked in MyApp.exe's properties.
What am I doing wrong ?
Afrow UK
24th October 2011 17:44 UTC
You've got it the wrong way around. SetRegView 64 will ensure NSIS writes to the 64-bit registry (i.e. NOT Wow6432Node).
Stu
MSG
25th October 2011 07:35 UTC
To clarify: 32 bits applications should write to the Wow6432Node, NOT to native x64 registry. If you app is 64 bits however, then you can use setregview 64.
Also: "requestexecutionlevel admin" is not sufficient to enforce admin access. You also need to use the userinfo plugin to verify admin access in .onInit. (Reason being: requestexecutionlevel does nothing on WinXP, and also does nothing on win7 if UAC is turned off.)
raoulvolfoni
25th October 2011 09:50 UTC
Originally posted by Afrow UK
You've got it the wrong way around. SetRegView 64 will ensure NSIS writes to the 64-bit registry (i.e. NOT Wow6432Node).
Stu
You're right, now it works as intended. I hadn't understood the principle of SetRegView.
Originally posted by MSG
To clarify: 32 bits applications should write to the Wow6432Node, NOT to native x64 registry. If you app is 64 bits however, then you can use setregview 64.
The problem is that, although it's a 32bit app, when I set this value in the Wow6432Node it isn't taken into account and my app's compatibility isn't set to Windows XP SP3.
Originally posted by MSG
Also: "requestexecutionlevel admin" is not sufficient to enforce admin access. You also need to use the userinfo plugin to verify admin access in .onInit. (Reason being: requestexecutionlevel does nothing on WinXP, and also does nothing on win7 if UAC is turned off.)
I'll be doing that.
Thanks a lot for your help ! :)