|
|
#1 |
|
Junior Member
Join Date: May 2007
Posts: 4
|
Detect Winamp Installation Directory via Registry
I'm writing an application which will be controlling winamp via the command line. The problem I'm running into is that the registry keys I'm using to locate the Winamp installation directory aren't the same on 64 bit installations of Windows (I understand why they aren't, that's not an issue) so I was wondering if there were any registry keys that are both A) the same on both 32 and 64 bit versions of Windows which B) point to the Winamp installation directory.
If not, I can always detect the bitness of the installed version of Windows to get at the correct registry key, but it'd be cleaner if there was one registry key to get me to the Winamp installation directory. Thanks |
|
|
|
|
|
#2 |
|
Join Date: Sep 2003
Posts: 27,873
|
there is no direct registry key to point to the installation directory. the only location is that of the last install via the uninstall option (HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp). i don't know how that varies between the 64 and 32-bit registry hives so is something you'd have to find out yourself. as a general rule, winamp doesn't use the registry apart from required file association aspects and the uninstall section
-daz |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: May 2007
Posts: 4
|
Quote:
I realize that Winamp is virtually registration free (which has its own pluses and minuses)...regardless, what is the standard way of retrieving the Winamp installation directory? How do the theme/plugin/etc writers retrieve this value? There is a concept known as registry redirection included in Windows x64 that I'm looking into...if that solves my issue I'll post the answer here. Thanks again for the reply. |
|
|
|
|
|
|
#4 | |
|
Join Date: Sep 2003
Posts: 27,873
|
for the moment (or indefinitely - just not sure on if x64 OSes will be handled any differently for such things in future), the winamp installer hasn't been altered in anyway to make use of the redirection (since the latest version of nsis now supports that but the winamp installer doesn't use any of that at the moment)
Quote:
-daz |
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: May 2007
Posts: 4
|
Fair enough. For now I'll just figure out the bitness of the OS during the installation of my app and get the correct reg key.
Thanks for your help! |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: May 2007
Posts: 4
|
This may come in handy for any C# developers out there attempting to automate Winamp via the command line...here is how to get the installation directory via the registry keys mentioned above for both 32 bit and 64 bit versions of Windows:
RegistryKey _winampKey; string _winampPath = string.Empty; _winampKey = Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp") != null ? Registry.LocalMachine.OpenSubKey(@"\Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp") // 32 bit : Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Winamp"); // 64 bit if (_winampKey != null) { _winampPath = (string)_winampKey.GetValue(@"UninstallString"); _winampPath = _winampPath.Remove(_winampPath.LastIndexOf(@"\")); _winampPath += @"\winamp.exe"; _winampPath = _winampPath.Insert(_winampPath.Length, new string(new char[] {'"'})); Maybe there is a cleaner way to do it, but this is what worked for me. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|