colombeen Posted May 6, 2014 Posted May 6, 2014 (edited) Hi guys, I have the following problem. I got a function from the forum to get info from the uninstall location in the windows registry. I've changed it a bit but when i run it, it goes through alot of the values, but it doesn't pass the one that I want. the error number I get is -1 on the RegRead (I've tried the same with the original but it fails) my function here : ;========================================================================; ; Function: Get info from uninstall section in the registry ;========================================================================; Func _UninstallGetInfo($varSearch, $varReturnKey = "DisplayName") $varLocation = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" $intEval = 1 While 1 $varResult = "" $varTemp = "" $varCurrent = RegEnumKey($varLocation, $intEval) If @error = 0 Then $varRegKey = $varLocation & $varCurrent $varTemp = RegRead($varRegKey, "DisplayName") If StringRegExp($varTemp, ".*" & $varSearch & ".*") Then $varResult = RegRead($varRegKey, $varReturnKey) If @error = 0 Then Return $varResult Else Return False EndIf ExitLoop EndIf Else ExitLoop EndIf $intEval += 1 WEnd Return False EndFunc ; _UninstallGetInfo And here's the way that I call it : $test = _UninstallGetInfo("Belgium e-ID", "DisplayVersion") MsgBox(0, "test", $test) I've used a MsgBox to see every value it checked and this one just doesn't go through the loop : The function exits on $intEval 190 if I'm not mistaken. Anyone who can help me out? If you would need the software that I'm checking for in the registry, you can find it on http://eid.belgium.be Edited May 6, 2014 by colombeen
Solution orbs Posted May 6, 2014 Solution Posted May 6, 2014 a quick shot in the dark: if you are using 64-bit OS, change HKLM to HKLM64. any difference? Signature - my forum contributions: Reveal hidden contents UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
colombeen Posted May 6, 2014 Author Posted May 6, 2014 (edited) what the hell... I never knew that that even existed... I always used to check for Wow6432Node but never checked HKLM64 Now it found the value that I wanted but I have another question... if I need HKLM64 to find the value in HKLMSoftwareMicrosoftWindowsCurrentVersionUninstall, where did the function look when I used the normal HKLM? And if my OS would have been a 64 bit WinXP... would I have to do the same thing? I just don't get in which case I have to use HKLM64 Edited May 6, 2014 by colombeen
orbs Posted May 6, 2014 Posted May 6, 2014 Windows 64-bit introduces many aspects of registry/filesystem redirection. start your reading here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384232(v=vs.85).aspx Signature - my forum contributions: Reveal hidden contents UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
JohnOne Posted May 6, 2014 Posted May 6, 2014 I believe you can just use HKLM64 and the OS takes care of the rest. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
orbs Posted May 6, 2014 Posted May 6, 2014 On 5/6/2014 at 9:07 PM, colombeen said: And if my OS would have been a 64 bit WinXP... would I have to do the same thing? I just don't get in which case I have to use HKLM64 read @OSArch to determine if you need to use HKLM or HKLM64 (also for HKCU or HKCU64) Signature - my forum contributions: Reveal hidden contents UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
colombeen Posted May 6, 2014 Author Posted May 6, 2014 yeah but like with my problem here, what if the software is in the HKLM location instead of the HKLM64 on a 64 bit system. I would have to check both to be sure. I'm just not sure how to add that to my function without writing alot of code extra.
orbs Posted May 6, 2014 Posted May 6, 2014 what you get in HKLM is a filtered view of the HKLM64 (if you are on a 64-bit OS, that is). you are quite safe using HKLM64. perhaps a different approach will ease your mind: this is by using WMI (i'm not sure how it's different, but it's not a direct registry reading): '?do=embed' frameborder='0' data-embedContent>> Signature - my forum contributions: Reveal hidden contents UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff
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