
Originally Posted by
Blagojce
In registry under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall I have keys which starts with "{some number" but application skip this keys and start with application name keys.
I search through the code,but didn't notice how you did this.
Those programs are programs that have been installed by a Windows Installer (MSI) setup program. For each of the registry keys under that location you mentioned, my code checks to see if they have the WindowsInstaller value within them set to 1, if they do then we just get the name of the key (so{DJFHDFH34} for example) and pass it to our GetInstallerKeyNameFromGuid function which takes the name and works out the MSI installer ID for it (which is done by just moving some of the characters around, just look at the function to see exactly what it does). Then we look for that MSI installer ID in another part of the registry (HKEY_CLASSES_ROOT\MSI_installer_ID_here) to actually get the program name and other information.
This is the part of the code that does it (within the GetUninstallKeyPrograms method):
vb.net Code:
If Not CInt(CurrentSubKey.GetValue("WindowsInstaller", 0)) = 1 Then
'...
'... irrelevent code here
'...
Else 'If WindowsInstaller
Dim ProgVersion As String = String.Empty
Dim Name As String = String.Empty
Dim FoundName As Boolean = False
Try
Dim MsiKeyName As String = GetInstallerKeyNameFromGuid(SubKeyName)
Dim CrGuidKey As RegistryKey = ClassesKey.OpenSubKey(MsiKeyName)
If Not CrGuidKey Is Nothing Then
Name = CStr(CrGuidKey.GetValue("ProductName", String.Empty))
End If
Catch ex As Exception
Debug.WriteLine(SubKeyName & " - " & ex.Message)
End Try
Hope that explains it - I know its not very straight forward, that's why it took me ages to figure it out and get this code working