Kevinsyel Posted May 24, 2012 Share Posted May 24, 2012 Hi guys, I'm in need of some information here. I'm writing an uninstaller that reads the OS architecture and then determines whether it goes into just one uninstall registry (x86) or both uninstall registries (x64)The problem I have is, (im debuggin this on x64) when I finish going through the x64 registry, and start navigating the x86 registry, it STILL reads from the x64 one. of course, the main difference is the \Wow6432Node\ being in the 64bit version and not the 86bit. I have no idea why it's spitting out the same registries for BOTH paths.I found this thread: that seems to confirm what I'm doing is right, but I don't know if it's my OS being finicky or not.here is my code: expandcollapse popupFunc UninstallFiles() Dim $uArray[10][2] Local $uArraySize = 10 Local $uArrayElem = 0 Dim $aRegPaths[1] Local $numRegPaths = 1 Dim $aToDel[1] Local $numToDel = 1 Local $regVar = "" Local $display Local $uString64 = "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" Local $uString86 = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" $aRegPaths[0] = $numRegPaths $aToDel[0] = $numToDel $i = 0 If $arch = "x86" Then If FileExists(@ScriptDir & "\Uninstalls.txt")Then $file = FileOpen(@ScriptDir & "Uninstalls.txt") While 1 $tempString = FileReadLine($file) ;LogFile("--DEBUG: TempString: " & $tempString) If @error = -1 Or $tempString = "" Then ExitLoop EndIf $tempArray = StringSplit($tempString, ",") If $tempArray[0] = 2 Then $uArray[$uArrayElem][0] = $tempArray[1] $uArray[$uArrayElem][1] = $tempArray[2] ;LogFile("--DEBUG: Uarray " & $uArrayElem & " is: " & $uArray[$uArrayElem][0] & "|" & $uArray[$uArrayElem][1]) Else $OutString = "--Application String not formatted properly: " & $tempArray[1] LogFile($OutString) EndIf $uArrayElem = $uArrayElem + 1 If $uArrayElem >= $uArraySize Then $uArraySize = $uArraySize + 10 ReDim $uArray[$uArraySize][2] EndIf WEnd Else LogFile("--ERROR! Uninstalls.txt Not Found! Exiting Application (ERROR 3)") Exit 3 EndIf Else If FileExists(@ScriptDir & "\Uninstalls64.txt")Then $file = FileOpen(@ScriptDir & "\Uninstalls64.txt") While 1 $tempString = FileReadLine($file) ;LogFile("--DEBUG: TempString: " & $tempString) If @error = -1 Or $tempString = "" Then ExitLoop EndIf $tempArray = StringSplit($tempString, ",") If $tempArray[0] = 2 Then $uArray[$uArrayElem][0] = $tempArray[1] $uArray[$uArrayElem][1] = $tempArray[2] ;LogFile("--DEBUG: Uarray " & $uArrayElem & " is: " & $uArray[$uArrayElem][0] & "|" & $uArray[$uArrayElem][1]) Else $OutString = "--Application String not formatted properly: " & $tempArray[1] LogFile($OutString) EndIf $uArrayElem = $uArrayElem + 1 If $uArrayElem >= $uArraySize Then $uArraySize = $uArraySize + 10 ReDim $uArray[$uArraySize][2] EndIf WEnd Else LogFile("--ERROR! Uninstalls64.txt Not Found! Exiting Application (ERROR 3)") Exit 3 EndIf Do $regVar = RegEnumKey($uString64, $numRegPaths) LogFile("--DEBUG: Registry: " & $regVar) $display = RegRead($uString64 & "\" & $regVar, "DisplayName") LogFile("--DEBUG: Display: " & $regVar & ": " & $display) For $i = 0 To $uArrayElem -1 If StringCompare($uArray[$i][0], $display) = 0 Then _ArrayAdd($aToDel, $uString64 & "\" & $regVar) $numToDel = $numToDel + 1 $aToDel[0] = $numToDel LogFile("--Debug: aToDel: " & $aToDel[$numToDel-1]) ExitLoop EndIf Next $numRegPaths = $numRegPaths + 1 Until $regVar = "" EndIf LogFile("--DEBUG: " & $uString86) $numRegPaths = 1 Do $regVar = RegEnumKey($uString86, $numRegPaths) LogFile("--DEBUG: Registry: " & $uString86 & " : " & $regVar) $display = RegRead($uString86 & "\" & $regVar, "DisplayName") LogFile("--DEBUG: Display: " & $uString86 & " : " & $regVar & ": " & $display) For $i = 0 To $uArrayElem -1 If StringCompare($uArray[$i][0] , $display) = 0 Then _ArrayAdd($aToDel, $uString86 & "\" & $regVar) $numToDel = $numToDel + 1 $aToDel[0] = $numToDel LogFile("--DEBUG: aToDel: " & $aToDel[$numToDel-1]) ExitLoop EndIf Next $numRegPaths = $numRegPaths + 1 Until $regVar = "" ;DriveMapDel($drive) ;DirRemove("C:\QA",1) EndFuncI hope someone has an answer. Thanks Link to comment Share on other sites More sharing options...
Kevinsyel Posted May 24, 2012 Author Share Posted May 24, 2012 for easy compiles, I just realized, you probably want my "LogFile()" function too:Func LogFile($Logmsg) FileWriteLine($OutFile, @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " " & $Logmsg) ConsoleWrite(@MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " " & $Logmsg & @CRLF) ToolTip($Logmsg, @DesktopHeight / 2, @DesktopWidth / 2) EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now