[RAPPS]
[reactos.git] / reactos / base / applications / rapps / installed.cpp
index f255507..e132577 100644 (file)
@@ -1,29 +1,26 @@
 /*
- * PROJECT:         ReactOS Applications Manager
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            base/applications/rapps/installed.cpp
- * PURPOSE:         Functions for working with installed applications
- * PROGRAMMERS:     Dmitry Chapyshev            (dmitry@reactos.org)
- *                  Alexander Shaposhnikov      (chaez.san@gmail.com)
+ * PROJECT:     ReactOS Applications Manager
+ * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * FILE:        base/applications/rapps/installed.cpp
+ * PURPOSE:     Functions for working with installed applications
+ * COPYRIGHT:   Copyright 2009 Dmitry Chapyshev         (dmitry@reactos.org)
+ *              Copyright 2017 Alexander Shaposhnikov   (sanchaez@reactos.org)
  */
-
-#include "defines.h"
+#include "rapps.h"
 
 #include "installed.h"
 
 #include "gui.h"
 #include "misc.h"
 
-BOOL
-GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, ATL::CStringW& String)
+BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, ATL::CStringW& String)
 {
     BOOL result = GetApplicationString(hKey, lpKeyName, String.GetBuffer(MAX_PATH));
     String.ReleaseBuffer();
     return result;
 }
 
-BOOL
-GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
+BOOL GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
 {
     DWORD dwSize = MAX_PATH * sizeof(WCHAR);
 
@@ -41,8 +38,7 @@ GetApplicationString(HKEY hKey, LPCWSTR lpKeyName, LPWSTR szString)
     return FALSE;
 }
 
-BOOL
-UninstallApplication(INT Index, BOOL bModify)
+BOOL UninstallApplication(INT Index, BOOL bModify)
 {
     LPCWSTR szModify = L"ModifyPath";
     LPCWSTR szUninstall = L"UninstallString";
@@ -54,7 +50,7 @@ UninstallApplication(INT Index, BOOL bModify)
     HKEY hKey;
     PINSTALLED_INFO ItemInfo;
 
-    if (!IS_INSTALLED_ENUM(SelectedEnumType))
+    if (!IsInstalledEnum(SelectedEnumType))
         return FALSE;
 
     if (Index == -1)
@@ -96,8 +92,7 @@ UninstallApplication(INT Index, BOOL bModify)
     return StartProcess(szPath, TRUE);
 }
 
-BOOL
-ShowInstalledAppInfo(INT Index)
+BOOL ShowInstalledAppInfo(INT Index)
 {
     ATL::CStringW szText;
     ATL::CStringW szInfo;
@@ -112,7 +107,7 @@ ShowInstalledAppInfo(INT Index)
 #define GET_INFO(a, b, c, d) \
     if (GetApplicationString(Info->hSubKey, a, szInfo)) \
     { \
-        szText.LoadStringW(hInst, b); \
+        szText.LoadStringW(b); \
         InsertRichEditText(szText, c); \
         InsertRichEditText(szInfo, d); \
     } \
@@ -138,22 +133,21 @@ ShowInstalledAppInfo(INT Index)
     return TRUE;
 }
 
-VOID
-RemoveAppFromRegistry(INT Index)
+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 (!IS_INSTALLED_ENUM(SelectedEnumType))
+    if (!IsInstalledEnum(SelectedEnumType))
         return;
 
     Info = (PINSTALLED_INFO) ListViewGetlParam(Index);
     if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
 
-    if (!szMsgText.LoadStringW(hInst, IDS_APP_REG_REMOVE) ||
-        !szMsgTitle.LoadStringW(hInst, IDS_INFORMATION))
+    if (!szMsgText.LoadStringW(IDS_APP_REG_REMOVE) ||
+        !szMsgTitle.LoadStringW(IDS_INFORMATION))
         return;
 
     if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
@@ -169,15 +163,14 @@ RemoveAppFromRegistry(INT Index)
             return;
         }
 
-        if (!szMsgText.LoadStringW(hInst, IDS_UNABLE_TO_REMOVE))
+        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)
 {
     DWORD dwSize = MAX_PATH, dwType, dwValue;
     BOOL bIsSystemComponent, bIsUpdate;
@@ -238,13 +231,13 @@ EnumInstalledApplications(INT EnumType, BOOL IsUserKey, APPENUMPROC lpEnumProc)
                                  &dwSize) == ERROR_SUCCESS)
             {
                 szDisplayName.ReleaseBuffer();
-                if (EnumType < ENUM_ALL_COMPONENTS || EnumType > ENUM_UPDATES)
-                    EnumType = ENUM_ALL_COMPONENTS;
+                if (EnumType < ENUM_ALL_INSTALLED || EnumType > ENUM_UPDATES)
+                    EnumType = ENUM_ALL_INSTALLED;
 
                 if (!bIsSystemComponent)
                 {
-                    if ((EnumType == ENUM_ALL_COMPONENTS) || /* All components */
-                        ((EnumType == ENUM_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
+                    if ((EnumType == ENUM_ALL_INSTALLED) || /* All components */
+                        ((EnumType == ENUM_INSTALLED_APPLICATIONS) && (!bIsUpdate)) || /* Applications only */
                         ((EnumType == ENUM_UPDATES) && (bIsUpdate))) /* Updates only */
                     {
                         if (!lpEnumProc(ItemIndex, szDisplayName, &Info))