[RAPPS] CMainWindow: remove unused functions , and the globals g_MainWindow and hListView
[reactos.git] / base / applications / rapps / installed.cpp
index 83fdbe4..c35f141 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "installed.h"
 
-#include "gui.h"
 #include "misc.h"
 
 BOOL INSTALLED_INFO::GetApplicationString(LPCWSTR lpKeyName, ATL::CStringW& String)
@@ -38,48 +37,16 @@ BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
     return FALSE;
 }
 
-BOOL UninstallApplication(INT Index, BOOL bModify)
+BOOL UninstallApplication(PINSTALLED_INFO ItemInfo, BOOL bModify)
 {
     LPCWSTR szModify = L"ModifyPath";
     LPCWSTR szUninstall = L"UninstallString";
-    WCHAR szPath[MAX_PATH];
-    WCHAR szAppName[MAX_STR_LEN];
     DWORD dwType, dwSize;
-    INT ItemIndex;
-    LVITEMW Item;
-    HKEY hKey;
-    PINSTALLED_INFO ItemInfo;
-
-    if (!IsInstalledEnum(SelectedEnumType))
-        return FALSE;
-
-    if (Index == -1)
-    {
-        ItemIndex = (INT) SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
-        if (ItemIndex == -1)
-            return FALSE;
-    }
-    else
-    {
-        ItemIndex = Index;
-    }
-
-    ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
-    WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
-
-    ZeroMemory(&Item, sizeof(Item));
-
-    Item.mask = LVIF_PARAM;
-    Item.iItem = ItemIndex;
-    if (!ListView_GetItem(hListView, &Item))
-        return FALSE;
-
-    ItemInfo = (PINSTALLED_INFO) Item.lParam;
-    hKey = ItemInfo->hSubKey;
+    WCHAR szPath[MAX_PATH];
 
     dwType = REG_SZ;
     dwSize = MAX_PATH * sizeof(WCHAR);
-    if (RegQueryValueExW(hKey,
+    if (RegQueryValueExW(ItemInfo->hSubKey,
                          bModify ? szModify : szUninstall,
                          NULL,
                          &dwType,
@@ -92,44 +59,7 @@ BOOL UninstallApplication(INT Index, BOOL bModify)
     return StartProcess(szPath, TRUE);
 }
 
-VOID RemoveAppFromRegistry(INT Index)
-{
-    PINSTALLED_INFO Info;
-    WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
-    ATL::CStringW szMsgText, szMsgTitle;
-    INT ItemIndex = SendMessageW(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
-
-    if (!IsInstalledEnum(SelectedEnumType))
-        return;
-
-    Info = (PINSTALLED_INFO) ListViewGetlParam(Index);
-    if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
-
-    if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) ||
-        !szMsgTitle.LoadStringW(IDS_INFORMATION))
-        return;
-
-    if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
-    {
-        ATL::CStringW::CopyChars(szFullName,
-                                 MAX_PATH,
-                                 Info->szKeyName.GetString(),
-                                 MAX_PATH - wcslen(szFullName));
-
-        if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS)
-        {
-            ListView_DeleteItem(hListView, ItemIndex);
-            return;
-        }
-
-        if (!szMsgText.LoadStringW(IDS_UNABLE_TO_REMOVE))
-            return;
-
-        MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
-    }
-}
-
-BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
+BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param)
 {
     DWORD dwSize = MAX_PATH, dwType, dwValue;
     BOOL bIsSystemComponent, bIsUpdate;
@@ -199,7 +129,7 @@ BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumP
                         ((EnumType == ENUM_INSTALLED_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
                         ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */
                     {
-                        if (!lpEnumProc(ItemIndex, szDisplayName, &Info))
+                        if (!lpEnumProc(ItemIndex, szDisplayName, &Info, param))
                             break;
                     }
                     else