Old 18th November 2014, 14:02   #1
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Uninstall string not detected in Vista x64 and XP x64

Far as I am aware, this had always worked and I can't think why this won't work any longer.

PHP Code:
ReadRegStr $R0 HKLM \
  
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\
  
"UninstallString"
  
MessageBox MB_OK  "R0 val: $R0IDOK  # debugging purposes -jw
  
StrCmp $R0 "" no_remove_uninstaller 
On a Vista x64 box, the R0 value is blank, even though there is indeed an entry in the registry at that point.

On WinXP x64, however, the uninstall string doesn't even get populated. That part of the code had always worked and wouldn't had changed. I am not too sure why it stopped working for these two OSes. As it works fine in Win 7 x86/x64 and Win 8 x86/x64.

I am guessing it is something to do with the Wow6432 but why would it work fine in Win 7 and 8 x64?
jweinraub is offline   Reply With Quote
Old 18th November 2014, 19:09   #2
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Okay, I think the problem is actually $INSTDIR is blanked on Vista x64 systems. So that is why it is failing. Any idea why $instdir will not be populated on Vista x64 but it is fine on other systems?
jweinraub is offline   Reply With Quote
Old 19th November 2014, 11:25   #3
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
So how are you writing $instdir to the registry? Are you using InstallDirRegKey? Are you copying to/from $instdir anywhere in the code? Are you using SetRegView?

The Wow6432Node thing is done inside the registry call, so it could be a bug in the XP/Vista API code, unlikely though.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 19th November 2014, 13:07   #4
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Quote:
Originally Posted by JasonFriday13 View Post
So how are you writing $instdir to the registry? Are you using InstallDirRegKey? Are you copying to/from $instdir anywhere in the code? Are you using SetRegView?
PHP Code:
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" 
It does work in Win 7 x64 and Win 8 x64. Just not Vista x64 (and apparently XP x64 but I don't have that OS with me to fully test and verify now I've added the setregview below).

However, it now does detect it, it just doesn't run the uninstaller at least in vista x64. The message pops up but doesnt run it, as $instdir returns a null string at that point, but in all other OSes I've tested, it is properly populated, and thus works.

Quote:
The Wow6432Node thing is done inside the registry call, so it could be a bug in the XP/Vista API code, unlikely though.
This is fixed by adding an additional setregview.
PHP Code:
${If} ${RunningX64}
  
SetRegView 64
  ReadRegStr $R0 HKLM 
\
  
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\
  
"UninstallString"
 
MessageBox MB_OK  "val: $R0IDOK  # debugging purposes -jw
  
StrCmp $R0 "" no_remove_uninstaller
${Else}
  
SetRegView 32
  ReadRegStr $R0 HKLM 
\
  
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\
  
"UninstallString"
 
MessageBox MB_OK  "val: $R0IDOK  # debugging purposes -jw
  
StrCmp $R0 "" no_remove_uninstaller
${EndIf} 
jweinraub is offline   Reply With Quote
Old 19th November 2014, 13:37   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
The Windows WOW64 registry reflection/redirection has changed at least 3 times. WinXP had the most basic version, then Vista added more reflected keys and in Win7 reflection was removed and keys are only redirected. See http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx for more.

This should not affect the uninstall key (in the default Windows configuration at least) but when dealing with registry issues on WOW64 you always have to remember that things might not be as they seem because you might be looking at a different key in Regedit etc.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th November 2014, 13:44   #6
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Anders,

Yeah I understand that part. But how does $INSTDIR get defined? Isn't that at runtime? Because I think that is where the problem is laying right now. It calls the uninstaller via $instdir\uninst.exe rather than the $R0 as it caused additional problems with something else, iirc (since tht line was commented out)
jweinraub is offline   Reply With Quote
Old 19th November 2014, 14:50   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Quote:
Originally Posted by jweinraub View Post
But how does $INSTDIR get defined?
The installer basically does something like this:

Quote:
StrCpy $InstDir ""
IfAttribute(InstallDir)
StrCpy $InstDir InstallDir
EndIf
IfAttribute(InstallDirRegKey)
RegReadStr $InstDir ...
StripQuotesAndParameters $InstDir
EndIf
IfCommandLine("/D")
StrCpy $InstDir GetCommandLine("/D")
EndIf
Call .onInit
....
and the uninstaller just does StrCpy $InstDir $ExeDir

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th November 2014, 14:05   #8
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
In the uninst label I do this:
PHP Code:
   ExecWait '"$INSTDIR\uninst.exe" _?=$INSTDIR' $R1
   StrCmp $R1 0 no_remove_uninstaller 
Success? If so we are done...
   
Abort Uninstaller was canceled or failedwe cannot continue 
For some reason I had the $R0 method but htat failed because I have that commented out. I think the issue was a user pressing cancel and the install allowed it to be continued without aborting since it is mandatory to uninstall previous version before installing new one.
jweinraub is offline   Reply With Quote
Old 19th November 2014, 15:09   #9
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
So that being said, is it better to use $R0 again?

Or something like: StrCpy $0 $r0
and then ExecWait '$0 _?=$INSTDIR' $R1
because it is weird how that one thing isn't being populated and far as i can tell, it had always worked in the past.
jweinraub is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump