BOOL
-IsInstalledApplication(LPWSTR lpRegName)
+IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey)
{
DWORD dwSize = MAX_PATH, dwType;
WCHAR szName[MAX_PATH];
HKEY hKey, hSubKey;
INT ItemIndex = 0;
- if (RegOpenKeyW(HKEY_LOCAL_MACHINE,
+ if (RegOpenKeyW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
&hKey) != ERROR_SUCCESS)
{
ItemIndex++;
}
- RegCloseKey(hSubKey);
RegCloseKey(hKey);
return TRUE;
BOOL GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString);
BOOL ShowInstalledAppInfo(INT Index);
BOOL UninstallApplication(INT Index, BOOL bModify);
-BOOL IsInstalledApplication(LPWSTR lpRegName);
+BOOL IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey);
/* winmain.c */
extern HWND hMainWnd;
INT SelectedEnumType = ENUM_ALL_COMPONENTS;
+VOID
+FreeInstalledAppList(VOID)
+{
+ INT Count = ListView_GetItemCount(hListView) - 1;
+ HKEY hKey;
+
+ while (Count >= 0)
+ {
+ hKey = ListViewGetlParam(Count);
+ if (hKey)
+ RegCloseKey(hKey);
+ Count--;
+ }
+}
+
BOOL
CALLBACK
EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, LPWSTR lpKeyName, LPARAM lParam)
PAPPLICATION_INFO ItemInfo;
INT Index;
- if (!IsInstalledApplication(Info.szRegName))
+ if (!IsInstalledApplication(Info.szRegName, FALSE) &&
+ !IsInstalledApplication(Info.szRegName, TRUE))
{
ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_INFO));
if (!ItemInfo) return FALSE;
if (EnumType == -1) EnumType = SelectedEnumType;
+ if (IS_INSTALLED_ENUM(SelectedEnumType))
+ FreeInstalledAppList();
+ else if (IS_AVAILABLE_ENUM(SelectedEnumType))
+ FreeAvailableAppList();
+
if (IS_INSTALLED_ENUM(EnumType))
{
/* Enum installed applications and updates */
}
else if (IS_AVAILABLE_ENUM(EnumType))
{
- if (IS_AVAILABLE_ENUM(SelectedEnumType))
- FreeAvailableAppList();
-
/* Enum availabled applications */
EnumAvailableApplications(EnumType, EnumAvailableAppProc);
}
{
if (IS_AVAILABLE_ENUM(SelectedEnumType))
FreeAvailableAppList();
+ if (IS_INSTALLED_ENUM(SelectedEnumType))
+ FreeInstalledAppList();
if (hImageListView) ImageList_Destroy(hImageListView);
if (hImageTreeView) ImageList_Destroy(hImageTreeView);
PostQuitMessage(0);