https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ba80f057c581bd886eb78…
commit ba80f057c581bd886eb78a298c41fe51c606d1f6
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Sun Apr 28 06:45:12 2019 +0300
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Tue Aug 20 00:43:47 2019 +0200
[RAPPS] CMainWindow: move RemoveAppFromRegistry in it
---
base/applications/rapps/gui.cpp | 40 ++++++++++++++++++++++++++++++++++-
base/applications/rapps/installed.cpp | 37 --------------------------------
2 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 89eb62efb24..064ec4ee463 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -1094,6 +1094,44 @@ private:
}
+ VOID RemoveSelectedAppFromRegistry()
+ {
+ PINSTALLED_INFO Info;
+ WCHAR szFullName[MAX_PATH] =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
+ ATL::CStringW szMsgText, szMsgTitle;
+ INT ItemIndex = m_ListView->GetNextItem(-1, LVNI_FOCUSED);
+
+ if (!IsInstalledEnum(SelectedEnumType))
+ return;
+
+ Info =
reinterpret_cast<PINSTALLED_INFO>(m_ListView->GetItemData(ItemIndex));
+ if (!Info || !Info->hSubKey || (ItemIndex == -1))
+ return;
+
+ if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) ||
+ !szMsgTitle.LoadStringW(IDS_INFORMATION))
+ return;
+
+ if (MessageBoxW(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)
+ {
+ m_ListView->DeleteItem(ItemIndex);
+ return;
+ }
+
+ if (!szMsgText.LoadStringW(IDS_UNABLE_TO_REMOVE))
+ return;
+
+ MessageBoxW(szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR);
+ }
+ }
+
BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam,
LRESULT& theResult, DWORD dwMapId)
{
theResult = 0;
@@ -1563,7 +1601,7 @@ private:
break;
case ID_REGREMOVE:
- RemoveAppFromRegistry(-1);
+ RemoveSelectedAppFromRegistry();
break;
case ID_REFRESH:
diff --git a/base/applications/rapps/installed.cpp
b/base/applications/rapps/installed.cpp
index fb0bf03219f..cb53b88be7f 100644
--- a/base/applications/rapps/installed.cpp
+++ b/base/applications/rapps/installed.cpp
@@ -92,43 +92,6 @@ 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,
PVOID param)
{
DWORD dwSize = MAX_PATH, dwType, dwValue;