|
|
#1 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
Is there a InstallDirRegKey analog for $APPDATA
I am updating an existing installer for Vista/Windows 7 which currently was designed for XP and below. For the installation directory I use this code:
PHP Code:
PHP Code:
|
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,776
|
No but you can make your own by using the registry functions in .oninit
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
Do you know where in the registry the information read by InstallDirRegKey is located? I have been unable to locate it. My installer is finding it, but where it is finding it I don't know. If it is any help I currently have these lines which might be a clue:
PHP Code:
PHP Code:
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,776
|
Where? You are telling it where to look with InstallDirRegKey lol
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
Yes you are right of course! What is contained there in the registry is:
default REG_SZ C:\Program Files\BPQ32\BPQ32.exe I see now that the command InstallDirRegKey will remove BPQ32.exe leaving just the path. Apparently it was pointless to include \BPQ32.exe in the WriteRegStr to start with. Thanks again for your help, it has been very valuable for one just learning! |
|
|
|
|
|
#6 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
This it would seem would be written in the registry at the HKLM root key, however what is actually happening is that for XP it is written at HKLM, but for Windows 7 it is written at HKCU.
PHP Code:
|
|
|
|
|
|
#7 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,840
|
Could be that win7 is "fixing" your installer because it's trying to write to HKLM without having admin access. Add "requestexecutionlevel admin" and use the userinfo plugin in .onInit to verify that you have admin (and throw an error and quit if you don't).
|
|
|
|
|
|
#8 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
I already had "requestexecutionlevel admin".
I added the following in .onInit: PHP Code:
So there is more to it apparently. |
|
|
|
|
|
#9 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
That was kind of ugly...here is the actual code I am using to do the test:
PHP Code:
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,776
|
Use Process Monitor to see what happens to the reg write...
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#11 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,840
|
Note: The above code is correct, but only for testing purposes. However, you need to use this code in your final installer as well, because 'requestexecutionlevel' does nothing if UAC is disabled, or on older OS versions... For that, you need to actually call the abort (or quit) command if the user isn't admin.
|
|
|
|
|
|
#12 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
I am using the following code to install a DLL:
PHP Code:
|
|
|
|
|
|
#13 | |
|
Major Dude
Join Date: Oct 2006
Posts: 1,840
|
Quote:
|
|
|
|
|
|
|
#14 |
|
Member
Join Date: Oct 2005
Location: Minnesota
Posts: 57
|
How far back does that go? XP, W2K, or is this just Vista and later?
|
|
|
|
|
|
#15 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,840
|
All NT operating systems (NT, 2000, XP, Vista, etc..) have a protected $SYSDIR folder. The same applies to $WINDIR and $PROGRAMFILES, among others. (This means that if your default install directory is in program files and you don't check for admin access, your installer is kind of defective.)
|
|
|
|
![]() |
|
|||||||
| Tags |
| $appdata, installdirregkey |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|