mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
[RAPPS] CMainWindow: Move gui part of UninstallApplication in it
This commit is contained in:
parent
85d6055201
commit
8a401eb299
3 changed files with 24 additions and 48 deletions
|
@ -511,7 +511,6 @@ public:
|
||||||
PVOID GetLParam(INT Index)
|
PVOID GetLParam(INT Index)
|
||||||
{
|
{
|
||||||
INT ItemIndex;
|
INT ItemIndex;
|
||||||
LVITEMW Item;
|
|
||||||
|
|
||||||
if (Index == -1)
|
if (Index == -1)
|
||||||
{
|
{
|
||||||
|
@ -524,14 +523,7 @@ public:
|
||||||
ItemIndex = Index;
|
ItemIndex = Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&Item, sizeof(Item));
|
return (PVOID) GetItemData(ItemIndex);
|
||||||
|
|
||||||
Item.mask = LVIF_PARAM;
|
|
||||||
Item.iItem = ItemIndex;
|
|
||||||
if (!GetItem(&Item))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return (PVOID) Item.lParam;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL AddColumn(INT Index, ATL::CStringW& Text, INT Width, INT Format)
|
BOOL AddColumn(INT Index, ATL::CStringW& Text, INT Width, INT Format)
|
||||||
|
@ -1134,6 +1126,23 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL UninstallSelectedApp(BOOL bModify)
|
||||||
|
{
|
||||||
|
WCHAR szAppName[MAX_STR_LEN];
|
||||||
|
|
||||||
|
if (!IsInstalledEnum(SelectedEnumType))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
INT ItemIndex = m_ListView->GetNextItem(-1, LVNI_FOCUSED);
|
||||||
|
if (ItemIndex == -1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
m_ListView->GetItemText(ItemIndex, 0, szAppName, _countof(szAppName));
|
||||||
|
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
|
||||||
|
|
||||||
|
PINSTALLED_INFO ItemInfo = (PINSTALLED_INFO)m_ListView->GetItemData(ItemIndex);
|
||||||
|
return UninstallApplication(ItemInfo, bModify);
|
||||||
|
}
|
||||||
BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId)
|
BOOL ProcessWindowMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT& theResult, DWORD dwMapId)
|
||||||
{
|
{
|
||||||
theResult = 0;
|
theResult = 0;
|
||||||
|
@ -1593,12 +1602,12 @@ private:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_UNINSTALL:
|
case ID_UNINSTALL:
|
||||||
if (UninstallApplication(-1, FALSE))
|
if (UninstallSelectedApp(FALSE))
|
||||||
UpdateApplicationsList(-1);
|
UpdateApplicationsList(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODIFY:
|
case ID_MODIFY:
|
||||||
if (UninstallApplication(-1, TRUE))
|
if (UninstallSelectedApp(TRUE))
|
||||||
UpdateApplicationsList(-1);
|
UpdateApplicationsList(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -18,5 +18,4 @@ typedef BOOL(CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &Name, PINSTALL
|
||||||
BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param);
|
BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc, PVOID param);
|
||||||
BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
|
BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString);
|
||||||
|
|
||||||
BOOL UninstallApplication(INT Index, BOOL bModify);
|
BOOL UninstallApplication(PINSTALLED_INFO ItemInfo, BOOL bModify);
|
||||||
VOID RemoveAppFromRegistry(INT Index);
|
|
||||||
|
|
|
@ -38,48 +38,16 @@ BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL UninstallApplication(INT Index, BOOL bModify)
|
BOOL UninstallApplication(PINSTALLED_INFO ItemInfo, BOOL bModify)
|
||||||
{
|
{
|
||||||
LPCWSTR szModify = L"ModifyPath";
|
LPCWSTR szModify = L"ModifyPath";
|
||||||
LPCWSTR szUninstall = L"UninstallString";
|
LPCWSTR szUninstall = L"UninstallString";
|
||||||
WCHAR szPath[MAX_PATH];
|
|
||||||
WCHAR szAppName[MAX_STR_LEN];
|
|
||||||
DWORD dwType, dwSize;
|
DWORD dwType, dwSize;
|
||||||
INT ItemIndex;
|
WCHAR szPath[MAX_PATH];
|
||||||
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;
|
|
||||||
|
|
||||||
dwType = REG_SZ;
|
dwType = REG_SZ;
|
||||||
dwSize = MAX_PATH * sizeof(WCHAR);
|
dwSize = MAX_PATH * sizeof(WCHAR);
|
||||||
if (RegQueryValueExW(hKey,
|
if (RegQueryValueExW(ItemInfo->hSubKey,
|
||||||
bModify ? szModify : szUninstall,
|
bModify ? szModify : szUninstall,
|
||||||
NULL,
|
NULL,
|
||||||
&dwType,
|
&dwType,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue