From aa4379b26794e1a881a4c1cb3e92c01e7e998844 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sat, 3 Oct 2009 09:34:19 +0000 Subject: [PATCH] - Implement delete of the program information from the registry - Store settings information in HKEY_LOCAL_MACHINE instead HKEY_CURRENT_USER svn path=/trunk/; revision=43260 --- reactos/base/applications/rapps/installed.c | 64 +++++++++++++++---- reactos/base/applications/rapps/lang/bg-BG.rc | 7 ++ reactos/base/applications/rapps/lang/de-DE.rc | 7 ++ reactos/base/applications/rapps/lang/en-US.rc | 7 ++ reactos/base/applications/rapps/lang/es-ES.rc | 7 ++ reactos/base/applications/rapps/lang/ja-JP.rc | 7 ++ reactos/base/applications/rapps/lang/no-NO.rc | 7 ++ reactos/base/applications/rapps/lang/pl-PL.rc | 7 ++ reactos/base/applications/rapps/lang/ru-RU.rc | 9 ++- reactos/base/applications/rapps/lang/sk-SK.rc | 7 ++ reactos/base/applications/rapps/lang/uk-UA.rc | 7 ++ reactos/base/applications/rapps/rapps.h | 11 +++- reactos/base/applications/rapps/resource.h | 4 ++ reactos/base/applications/rapps/winmain.c | 34 +++++++--- 14 files changed, 160 insertions(+), 25 deletions(-) diff --git a/reactos/base/applications/rapps/installed.c b/reactos/base/applications/rapps/installed.c index a9b9aa1acac..80991c91df7 100644 --- a/reactos/base/applications/rapps/installed.c +++ b/reactos/base/applications/rapps/installed.c @@ -136,17 +136,17 @@ BOOL ShowInstalledAppInfo(INT Index) { WCHAR szText[MAX_PATH], szInfo[MAX_PATH]; - HKEY hKey = (HKEY) ListViewGetlParam(Index); + PINSTALLED_INFO Info = ListViewGetlParam(Index); - if (!hKey) return FALSE; + if (!Info || !Info->hSubKey) return FALSE; - GetApplicationString(hKey, L"DisplayName", szText); + GetApplicationString(Info->hSubKey, L"DisplayName", szText); NewRichEditText(szText, CFE_BOLD); InsertRichEditText(L"\n", 0); #define GET_INFO(a, b, c, d) \ - if (GetApplicationString(hKey, a, szInfo)) \ + if (GetApplicationString(Info->hSubKey, a, szInfo)) \ { \ LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \ InsertRichEditText(szText, c); \ @@ -175,32 +175,70 @@ ShowInstalledAppInfo(INT Index) } +VOID +RemoveAppFromRegistry(INT Index) +{ + PINSTALLED_INFO Info; + WCHAR szFullName[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"; + WCHAR szMsgText[MAX_STR_LEN], szMsgTitle[MAX_STR_LEN]; + INT ItemIndex = SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_FOCUSED); + + if (!IS_INSTALLED_ENUM(SelectedEnumType)) + return; + + Info = ListViewGetlParam(Index); + if (!Info || !Info->hSubKey || (ItemIndex == -1)) return; + + if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)) || + !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, sizeof(szMsgTitle) / sizeof(WCHAR))) + return; + + if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES) + { + wcsncat(szFullName, Info->szKeyName, MAX_PATH - wcslen(szFullName)); + + if (RegDeleteKeyW(Info->hRootKey, szFullName) == ERROR_SUCCESS) + { + (VOID) ListView_DeleteItem(hListView, ItemIndex); + return; + } + + if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR))) + return; + + MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR); + } +} + + BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc) { DWORD dwSize = MAX_PATH, dwType, dwValue; BOOL bIsSystemComponent, bIsUpdate; - WCHAR pszName[MAX_PATH]; WCHAR pszParentKeyName[MAX_PATH]; WCHAR pszDisplayName[MAX_PATH]; - HKEY hKey, hSubKey; + INSTALLED_INFO Info; + HKEY hKey; LONG ItemIndex = 0; - if (RegOpenKeyW(IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, + Info.hRootKey = IsUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; + + if (RegOpenKeyW(Info.hRootKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", &hKey) != ERROR_SUCCESS) { return FALSE; } - while (RegEnumKeyExW(hKey, ItemIndex, pszName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + while (RegEnumKeyExW(hKey, ItemIndex, Info.szKeyName, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - if (RegOpenKeyW(hKey, pszName, &hSubKey) == ERROR_SUCCESS) + if (RegOpenKeyW(hKey, Info.szKeyName, &Info.hSubKey) == ERROR_SUCCESS) { dwType = REG_DWORD; dwSize = sizeof(DWORD); - if (RegQueryValueExW(hSubKey, + if (RegQueryValueExW(Info.hSubKey, L"SystemComponent", NULL, &dwType, @@ -216,7 +254,7 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc) dwType = REG_SZ; dwSize = MAX_PATH; - bIsUpdate = (RegQueryValueExW(hSubKey, + bIsUpdate = (RegQueryValueExW(Info.hSubKey, L"ParentKeyName", NULL, &dwType, @@ -224,7 +262,7 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc) &dwSize) == ERROR_SUCCESS); dwSize = MAX_PATH; - if (RegQueryValueExW(hSubKey, + if (RegQueryValueExW(Info.hSubKey, L"DisplayName", NULL, &dwType, @@ -240,7 +278,7 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc) ((EnumType == ENUM_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */ ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */ { - if (!lpEnumProc(ItemIndex, pszDisplayName, pszName, (LPARAM)hSubKey)) + if (!lpEnumProc(ItemIndex, pszDisplayName, Info)) break; } } diff --git a/reactos/base/applications/rapps/lang/bg-BG.rc b/reactos/base/applications/rapps/lang/bg-BG.rc index a104bc791d9..b3775c63cc8 100644 --- a/reactos/base/applications/rapps/lang/bg-BG.rc +++ b/reactos/base/applications/rapps/lang/bg-BG.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "&Махане",ID_UNINSTALL MENUITEM "&Промяна", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "О&пресняване", ID_REFRESH END POPUP "Помощ" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Махане", ID_UNINSTALL MENUITEM "&Промяна", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "О&пресняване", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/de-DE.rc b/reactos/base/applications/rapps/lang/de-DE.rc index 21c4df7e345..8a1db9cae58 100644 --- a/reactos/base/applications/rapps/lang/de-DE.rc +++ b/reactos/base/applications/rapps/lang/de-DE.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "&Deinstallieren",ID_UNINSTALL MENUITEM "&Дndern", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Aktualisieren", ID_REFRESH END POPUP "Hilfe" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Deinstallieren", ID_UNINSTALL MENUITEM "&Дndern", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Aktualisieren", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/en-US.rc b/reactos/base/applications/rapps/lang/en-US.rc index dde66e048c7..c7503d92083 100644 --- a/reactos/base/applications/rapps/lang/en-US.rc +++ b/reactos/base/applications/rapps/lang/en-US.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "&Uninstall",ID_UNINSTALL MENUITEM "&Modify", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Refresh", ID_REFRESH END POPUP "Help" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Uninstall", ID_UNINSTALL MENUITEM "&Modify", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Refresh", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/es-ES.rc b/reactos/base/applications/rapps/lang/es-ES.rc index 72ab621a570..09971d0bffe 100644 --- a/reactos/base/applications/rapps/lang/es-ES.rc +++ b/reactos/base/applications/rapps/lang/es-ES.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "&Desinstalar",ID_UNINSTALL MENUITEM "&Modificar", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Refrescar", ID_REFRESH END POPUP "Ayuda" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Desinstalar", ID_UNINSTALL MENUITEM "&Modificar", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Refrescar", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/ja-JP.rc b/reactos/base/applications/rapps/lang/ja-JP.rc index 4dc6cf589da..e0a16c40ab1 100644 --- a/reactos/base/applications/rapps/lang/ja-JP.rc +++ b/reactos/base/applications/rapps/lang/ja-JP.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "ѓAѓ“ѓCѓ“ѓXѓgЃ[ѓ‹(&U)",ID_UNINSTALL MENUITEM "•ПЌX(&M)", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "ЌXђV(&R)", ID_REFRESH END POPUP "ѓwѓ‹ѓv" @@ -40,6 +42,8 @@ BEGIN MENUITEM "ѓAѓ“ѓCѓ“ѓXѓgЃ[ѓ‹(&U)", ID_UNINSTALL MENUITEM "•ПЌX(&M)", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "ЌXђV(&R)", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "ѓvѓЌѓOѓ‰ѓЂ‚Мѓ_ѓEѓ“ѓЌЃ[ѓh‚ЙЋg—p‚·‚йѓtѓHѓ‹ѓ_‚р‘I‘р‚µ‚Д‚­‚ѕ‚і‚ў:" IDS_CHOOSE_FOLDER_ERROR "Ћw’и‚і‚к‚ЅѓtѓHѓ‹ѓ_‚Н‘¶ЌЭ‚µ‚Ь‚№‚с!" IDS_USER_NOT_ADMIN """ReactOS ѓAѓvѓЉѓPЃ[ѓVѓ‡ѓ“ ѓ}ѓlЃ[ѓWѓѓЃ["" ‚р‹N“®‚·‚й‚Й‚НЉЗ—ќЋТЊ ЊА‚Е‚ ‚й•K—v‚Є‚ ‚и‚Ь‚·!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/no-NO.rc b/reactos/base/applications/rapps/lang/no-NO.rc index fd2cb9a5568..642e0f06f3a 100644 --- a/reactos/base/applications/rapps/lang/no-NO.rc +++ b/reactos/base/applications/rapps/lang/no-NO.rc @@ -14,6 +14,8 @@ BEGIN MENUITEM "&Avinstallere",ID_UNINSTALL MENUITEM "&Endre", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Oppdatere", ID_REFRESH END POPUP "Hjelp" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Avinstallere", ID_UNINSTALL MENUITEM "&Endre", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Oppdater", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/pl-PL.rc b/reactos/base/applications/rapps/lang/pl-PL.rc index c7a62619e1f..fc79e8a205b 100644 --- a/reactos/base/applications/rapps/lang/pl-PL.rc +++ b/reactos/base/applications/rapps/lang/pl-PL.rc @@ -16,6 +16,8 @@ BEGIN MENUITEM "&Odinstaluj",ID_UNINSTALL MENUITEM "&Modyfikuj", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "O&dњwieї", ID_REFRESH END POPUP "Pomoc" @@ -42,6 +44,8 @@ BEGIN MENUITEM "&odinstaluj", ID_UNINSTALL MENUITEM "&Modyfikuj", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Odњwieї", ID_REFRESH END END @@ -185,4 +189,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/ru-RU.rc b/reactos/base/applications/rapps/lang/ru-RU.rc index e55dee4c2ea..a8f8ea7d67b 100644 --- a/reactos/base/applications/rapps/lang/ru-RU.rc +++ b/reactos/base/applications/rapps/lang/ru-RU.rc @@ -10,10 +10,12 @@ BEGIN END POPUP "&Программы" BEGIN - MENUITEM "&Установить", ID_INSTALL + MENUITEM "У&становить", ID_INSTALL MENUITEM "&Удалить", ID_UNINSTALL MENUITEM "&Изменить", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "У&далить из реестра", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Обновить", ID_REFRESH END POPUP "Справка" @@ -40,6 +42,8 @@ BEGIN MENUITEM "&Удалить", ID_UNINSTALL MENUITEM "&Изменить", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "У&далить из реестра", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Обновить", ID_REFRESH END END @@ -183,4 +187,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Выберите папку, которая будет использоваться для загрузки программ:" IDS_CHOOSE_FOLDER_ERROR "Вы указали несуществующую папку!" IDS_USER_NOT_ADMIN "Вы должны быть администратором для запуска ""Менеджера приложений ReactOS""!" + IDS_APP_REG_REMOVE "Вы действительно хотите удалить данные об установленной программе из реестра?" + IDS_INFORMATION "Информация" + IDS_UNABLE_TO_REMOVE "Не удалось удалить данные о программе из реестра!" END diff --git a/reactos/base/applications/rapps/lang/sk-SK.rc b/reactos/base/applications/rapps/lang/sk-SK.rc index 333c1e35715..2b592c24eac 100644 --- a/reactos/base/applications/rapps/lang/sk-SK.rc +++ b/reactos/base/applications/rapps/lang/sk-SK.rc @@ -19,6 +19,8 @@ BEGIN MENUITEM "O&dinљtalovaќ", ID_UNINSTALL MENUITEM "&Zmeniќ", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Obnoviќ", ID_REFRESH END POPUP "Pomocnнk" @@ -45,6 +47,8 @@ BEGIN MENUITEM "O&dinљtalovaќ", ID_UNINSTALL MENUITEM "&Zmeniќ", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Obnoviќ", ID_REFRESH END END @@ -188,4 +192,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Vyberte prieиinok, ktorэ sa pouћije pre sќahovanie programov:" IDS_CHOOSE_FOLDER_ERROR "Zvolili ste si neexistujъci prieиinok!" IDS_USER_NOT_ADMIN "Mali by ste byќ administrбtor pre spustenie ""Manaћйra aplikбciн systйmu ReactOS""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/lang/uk-UA.rc b/reactos/base/applications/rapps/lang/uk-UA.rc index b6a44c33a05..27c47a786a4 100644 --- a/reactos/base/applications/rapps/lang/uk-UA.rc +++ b/reactos/base/applications/rapps/lang/uk-UA.rc @@ -22,6 +22,8 @@ BEGIN MENUITEM "&Видалити",ID_UNINSTALL MENUITEM "&Змінити", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Оновити", ID_REFRESH END POPUP "Довідка" @@ -48,6 +50,8 @@ BEGIN MENUITEM "&Видалити", ID_UNINSTALL MENUITEM "&Змінити", ID_MODIFY MENUITEM SEPARATOR + MENUITEM "&Remove from Registry", ID_REGREMOVE + MENUITEM SEPARATOR MENUITEM "&Оновити", ID_REFRESH END END @@ -191,4 +195,7 @@ BEGIN IDS_CHOOSE_FOLDER_TEXT "Choose a folder which will be used for downloading of programs:" IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!" IDS_USER_NOT_ADMIN "You should be administrator for start ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?" + IDS_INFORMATION "Information" + IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!" END diff --git a/reactos/base/applications/rapps/rapps.h b/reactos/base/applications/rapps/rapps.h index c6e5d17c98e..09a64c273a6 100644 --- a/reactos/base/applications/rapps/rapps.h +++ b/reactos/base/applications/rapps/rapps.h @@ -69,6 +69,14 @@ typedef struct } APPLICATION_INFO, *PAPPLICATION_INFO; +typedef struct +{ + HKEY hRootKey; + HKEY hSubKey; + WCHAR szKeyName[MAX_PATH]; + +} INSTALLED_INFO, *PINSTALLED_INFO; + typedef struct { BOOL bSaveWndPos; @@ -95,12 +103,13 @@ BOOL UpdateAppsDB(VOID); BOOL InstallApplication(INT Index); /* installed.c */ -typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, LPWSTR lpName, LPWSTR lpKeyName, LPARAM lParam); +typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, LPWSTR lpName, INSTALLED_INFO Info); BOOL EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc); BOOL GetApplicationString(HKEY hKey, LPWSTR lpKeyName, LPWSTR lpString); BOOL ShowInstalledAppInfo(INT Index); BOOL UninstallApplication(INT Index, BOOL bModify); BOOL IsInstalledApplication(LPWSTR lpRegName, BOOL IsUserKey); +VOID RemoveAppFromRegistry(INT Index); /* winmain.c */ extern HWND hMainWnd; diff --git a/reactos/base/applications/rapps/resource.h b/reactos/base/applications/rapps/resource.h index 8e9bf5bbd77..a4faeae3203 100644 --- a/reactos/base/applications/rapps/resource.h +++ b/reactos/base/applications/rapps/resource.h @@ -69,6 +69,7 @@ #define ID_COPY_LINK 557 #define ID_SETTINGS 558 #define ID_REFRESH 559 +#define ID_REGREMOVE 560 /* Strings */ #define IDS_APPTITLE 100 @@ -87,6 +88,9 @@ #define IDS_CHOOSE_FOLDER_TEXT 113 #define IDS_CHOOSE_FOLDER_ERROR 114 #define IDS_USER_NOT_ADMIN 115 +#define IDS_APP_REG_REMOVE 116 +#define IDS_INFORMATION 117 +#define IDS_UNABLE_TO_REMOVE 118 /* Tooltips */ #define IDS_TOOLTIP_INSTALL 200 diff --git a/reactos/base/applications/rapps/winmain.c b/reactos/base/applications/rapps/winmain.c index 5940ab4a3b7..f39b34ab7e8 100644 --- a/reactos/base/applications/rapps/winmain.c +++ b/reactos/base/applications/rapps/winmain.c @@ -15,6 +15,7 @@ HIMAGELIST hImageTreeView = NULL; INT SelectedEnumType = ENUM_ALL_COMPONENTS; SETTINGS_INFO SettingsInfo; + VOID FillDafaultSettings(PSETTINGS_INFO pSettingsInfo) { @@ -37,7 +38,7 @@ LoadSettings(VOID) HKEY hKey; DWORD dwSize; - if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { dwSize = sizeof(SETTINGS_INFO); if (RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS) @@ -70,7 +71,7 @@ SaveSettings(HWND hwnd) SettingsInfo.Maximized = (IsZoomed(hwnd) || (wp.flags & WPF_RESTORETOMAXIMIZED)); } - if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, NULL, + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"Software\\ReactOS\\rapps", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { RegSetValueEx(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO)); @@ -82,31 +83,40 @@ VOID FreeInstalledAppList(VOID) { INT Count = ListView_GetItemCount(hListView) - 1; - HKEY hKey; + PINSTALLED_INFO Info; while (Count >= 0) { - hKey = ListViewGetlParam(Count); - if (hKey) - RegCloseKey(hKey); + Info = ListViewGetlParam(Count); + if (Info) + { + RegCloseKey(Info->hSubKey); + HeapFree(GetProcessHeap(), 0, Info); + } Count--; } } BOOL CALLBACK -EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, LPWSTR lpKeyName, LPARAM lParam) +EnumInstalledAppProc(INT ItemIndex, LPWSTR lpName, INSTALLED_INFO Info) { + PINSTALLED_INFO ItemInfo; WCHAR szText[MAX_PATH]; INT Index; - Index = ListViewAddItem(ItemIndex, 0, lpName, lParam); + ItemInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO)); + if (!ItemInfo) return FALSE; + + *ItemInfo = Info; + + Index = ListViewAddItem(ItemIndex, 0, lpName, (LPARAM)ItemInfo); /* Get version info */ - GetApplicationString((HKEY)lParam, L"DisplayVersion", szText); + GetApplicationString((HKEY)ItemInfo->hSubKey, L"DisplayVersion", szText); ListView_SetItemText(hListView, Index, 1, szText); /* Get comments */ - GetApplicationString((HKEY)lParam, L"Comments", szText); + GetApplicationString((HKEY)ItemInfo->hSubKey, L"Comments", szText); ListView_SetItemText(hListView, Index, 2, szText); return TRUE; @@ -399,6 +409,10 @@ MainWndOnCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) UpdateApplicationsList(-1); break; + case ID_REGREMOVE: + RemoveAppFromRegistry(-1); + break; + case ID_REFRESH: UpdateApplicationsList(-1); break;