![]() |
ReadRegStr maximum lenght?
Dear all,
I am trying to add a check to see if the software is installed or not. If it is installed the installation should abort, if it is not installed the installation should continue as planned. I currently have this: Quote:
However if I try: Quote:
Quote:
I also tried: Quote:
Is there a maximum lenght of the ReadRegStr? Can I only enter so many subfolders? Thanks in advanced, Ruud |
If there was a maximum length of 90 characters I'm sure you would have heard about it already, so no that is not your problem. Is it perhaps because you are running on Windows x64 and you haven't disabled registry redirection with SetRegView 64?
Stu |
Thanks for your quick reply.
All my test computers are 32bit, so that can't be the problem. I tried it so far on W7, Vista, and XP (all 32bit). - None seem to work. Thanks for the help, Ruud |
Here is the full code, I'm currently using.. Maybe I am missing something (but then the others shouldn't work either, right?)
Quote:
|
The limit is probably 1024, try running Process Monitor see what the issue is
|
Thank you for your reply.
This is what Process Monitor says: Quote:
So it seems like it actually does recognize / read the key.. But somehow my program does not recognize it? Edit01: Btw I changed the real program directory to ProgramDir. Thats why it shows "length: 98", its the length of the orignal program dir. |
Check the read value with a MessageBox.
Edit: Is there a reason you call Quit in both cases? Is that on purpose? Stu |
The registry entry holds the name of the directory so you need to check that the directory exists:
IfFileExists "$R0\*.*" +1 NotInstalled or else check that a particular file exists in that directory IfFileExists "$R0\somefile.exe" +1 NotInstalled |
Thank you guys for all the help.
Thank you pengyou, that seems to do the trick. Quote:
Quote:
Quote:
The docs doesn't say "Quit" is needed, so this issue might occur due to my lack of experience with NSIS. Am I missing something? Thanks, Ruud |
If you need to Quit your installation after then that is fine. You could also just use LogicLib:
Stucode: |
Hi guys...
Thanks for all the help, but I might have replied a bit to early. It is still not working probably, the following is going on: If using: code: It always runs programB (the program that runs when nothing is detected) If using: code: It always runs programA (the program that runs when something is detected) Currently my code looks like this (Thanks to the suggestion of Afrow UK) code: Maybe I should go for reading a different registry entry? I tried "UninstallString", which generates similair results. Thanks, Ruud |
What is the stored value?
Stu |
Thanks for your help Afrow UK.
Here is a screen of the whole register: http://www.uploadup.com/dt-4W8F.jpg |
I submitted a post a few seconds ago with a screen of the register, but this one has to be moderated so here is a quick overview:
Quote:
I added a function to check if its 32 or 64 bit, (which seems to properly function - not tested on 64bit yet), here is the full code: code: The code above always claims that the softare is installed. UninstallString or InstallLocation generate same, incorrect, results (both using "$R0\*.*" or using "$R0"). Note: I changed the string in the above code for the registry-entry, so the post doesn't rip open the forum design. If needed, here they are: {32bit} = {BF61699A-6D79-4A97-B879-7A890E5A9A48} {64bit} = {51C64AFF-0180-47E0-A535-2D99EBC10F09} |
When I asked what the value was I meant what is the path stored. Put in a MessageBox to display the value of $R0. I didn't want a screenshot from the registry editor! Plus you have blanked out half the values so it's not much help to us anyway!
As for 32/64 you should use the macro in x64.nsh (${If} ${RunningX64}). Also you need to use SetRegView 64 if the registry key isn't under Wow6432Node on 64-bit Windows (this has no effect/is ignored on 32-bit Windows). There are only two possible reasons that your code isn't working: 1. The path is wrong 2. The path has no read access Does the path end with a backstroke? Does it have any whitespace on the end? Can you open up cmd and cd to the directory it specifies? Stu |
I only blanked out 4 values (the one with the line through it), the rest are all empty.
Full path (direct copy-paste from the registry): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BF61699A-6D79-4A97-B879-7A890E5A9A48} $RO - doesn't print anything. But using the following it does work / does print something.. ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\ ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Themes Using the following (doesn't matter what inside it) doesn't work.. ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ Thats why my initial quetion about path length. But it might be something with permissions; Do I need special permission to acces the Uninstall path? How can I check for read access? Reg-Values Quote:
-- When computer with program NOT installed Quote:
Quote:
But why does it try to create a file at the UnistallString? It only has to check if the value exist or not, right? EDIT01: Quote:
|
UPDATE - SOLVED
So my findings conclude that in this case "CreateFile" is the issue. "CreateFile" seems to be creating a temp file to check if folder really exist. code: Quote:
Quote:
I'm using the following code, which seems to be doing the trick: code: Quote:
This will not work if you don't know the value of they key, or the key is not static. |
| All times are GMT. The time now is 17:33. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.