diff --git a/reactos/base/applications/rapps/available.cpp b/reactos/base/applications/rapps/available.cpp index 1ff3dbaa611..962a9f9f6bc 100644 --- a/reactos/base/applications/rapps/available.cpp +++ b/reactos/base/applications/rapps/available.cpp @@ -21,16 +21,16 @@ CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam) : m_Parser(sFileNameParam) { - LicenseType = LICENSE_TYPE::None; + m_LicenseType = LicenseType::LICENSE_NONE; - sFileName = sFileNameParam; + m_sFileName = sFileNameParam; RetrieveGeneralInfo(); } VOID CAvailableApplicationInfo::RefreshAppInfo() { - if (szUrlDownload.IsEmpty()) + if (m_szUrlDownload.IsEmpty()) { RetrieveGeneralInfo(); } @@ -39,23 +39,23 @@ VOID CAvailableApplicationInfo::RefreshAppInfo() // Lazily load general info from the file VOID CAvailableApplicationInfo::RetrieveGeneralInfo() { - Category = m_Parser.GetInt(L"Category"); + m_Category = m_Parser.GetInt(L"Category"); - if (!GetString(L"Name", szName) - || !GetString(L"URLDownload", szUrlDownload)) + if (!GetString(L"Name", m_szName) + || !GetString(L"URLDownload", m_szUrlDownload)) { return; } - GetString(L"RegName", szRegName); - GetString(L"Version", szVersion); - GetString(L"License", szLicense); - GetString(L"Description", szDesc); - GetString(L"Size", szSize); - GetString(L"URLSite", szUrlSite); - GetString(L"CDPath", szCDPath); - GetString(L"Language", szRegName); - GetString(L"SHA1", szSHA1); + GetString(L"RegName", m_szRegName); + GetString(L"Version", m_szVersion); + GetString(L"License", m_szLicense); + GetString(L"Description", m_szDesc); + GetString(L"Size", m_szSize); + GetString(L"URLSite", m_szUrlSite); + GetString(L"CDPath", m_szCDPath); + GetString(L"Language", m_szRegName); + GetString(L"SHA1", m_szSHA1); RetrieveLicenseType(); RetrieveLanguages(); @@ -68,16 +68,16 @@ VOID CAvailableApplicationInfo::RetrieveGeneralInfo() VOID CAvailableApplicationInfo::RetrieveInstalledStatus() { - m_IsInstalled = ::GetInstalledVersion(NULL, szRegName) - || ::GetInstalledVersion(NULL, szName); + m_IsInstalled = ::GetInstalledVersion(NULL, m_szRegName) + || ::GetInstalledVersion(NULL, m_szName); } VOID CAvailableApplicationInfo::RetrieveInstalledVersion() { - ATL::CStringW szNameVersion = szName + L" " + szVersion; - m_HasInstalledVersion = ::GetInstalledVersion(&szInstalledVersion, szRegName) - || ::GetInstalledVersion(&szInstalledVersion, szName) - || ::GetInstalledVersion(&szInstalledVersion, szNameVersion); + ATL::CStringW szNameVersion = m_szName + L" " + m_szVersion; + m_HasInstalledVersion = ::GetInstalledVersion(&m_szInstalledVersion, m_szRegName) + || ::GetInstalledVersion(&m_szInstalledVersion, m_szName) + || ::GetInstalledVersion(&m_szInstalledVersion, szNameVersion); } VOID CAvailableApplicationInfo::RetrieveLanguages() @@ -105,7 +105,7 @@ VOID CAvailableApplicationInfo::RetrieveLanguages() { if (StrToIntExW(m_szLocale.GetString(), STIF_DEFAULT, &iLCID)) { - Languages.Add(static_cast(iLCID)); + m_LanguageLCIDs.Add(static_cast(iLCID)); m_szLocale.Empty(); } } @@ -116,7 +116,7 @@ VOID CAvailableApplicationInfo::RetrieveLanguages() { if (StrToIntExW(m_szLocale.GetString(), STIF_DEFAULT, &iLCID)) { - Languages.Add(static_cast(iLCID)); + m_LanguageLCIDs.Add(static_cast(iLCID)); } } @@ -127,13 +127,13 @@ VOID CAvailableApplicationInfo::RetrieveLicenseType() { INT IntBuffer = m_Parser.GetInt(L"LicenseType"); - if (IntBuffer < 0 || IntBuffer > LICENSE_TYPE::Max) + if (IsLicenseType(IntBuffer)) { - LicenseType = LICENSE_TYPE::None; + m_LicenseType = static_cast(IntBuffer); } else { - LicenseType = (LICENSE_TYPE) IntBuffer; + m_LicenseType = LicenseType::LICENSE_NONE; } } @@ -145,10 +145,10 @@ BOOL CAvailableApplicationInfo::FindInLanguages(LCID what) const } //Find locale code in the list - const INT nLanguagesSize = Languages.GetSize(); + const INT nLanguagesSize = m_LanguageLCIDs.GetSize(); for (INT i = 0; i < nLanguagesSize; ++i) { - if (Languages[i] == what) + if (m_LanguageLCIDs[i] == what) { return TRUE; } @@ -184,12 +184,12 @@ BOOL CAvailableApplicationInfo::HasInstalledVersion() const BOOL CAvailableApplicationInfo::HasUpdate() const { - return (szInstalledVersion.Compare(szVersion) < 0) ? TRUE : FALSE; + return (m_szInstalledVersion.Compare(m_szVersion) < 0) ? TRUE : FALSE; } VOID CAvailableApplicationInfo::SetLastWriteTime(FILETIME* ftTime) { - RtlCopyMemory(&ftCacheStamp, ftTime, sizeof(FILETIME)); + RtlCopyMemory(&m_ftCacheStamp, ftTime, sizeof(FILETIME)); } inline BOOL CAvailableApplicationInfo::GetString(LPCWSTR lpKeyName, ATL::CStringW& ReturnedString) @@ -317,7 +317,7 @@ BOOL CAvailableApps::ForceUpdateAppsDB() return UpdateAppsDB(); } -BOOL CAvailableApps::EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc) +BOOL CAvailableApps::Enum(INT EnumType, AVAILENUMPROC lpEnumProc) { HANDLE hFind = INVALID_HANDLE_VALUE; @@ -343,10 +343,10 @@ BOOL CAvailableApps::EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnu Info = m_InfoList.GetNext(CurrentListPosition); // do we already have this entry in cache? - if (Info->sFileName == FindFileData.cFileName) + if (Info->m_sFileName == FindFileData.cFileName) { // is it current enough, or the file has been modified since our last time here? - if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->ftCacheStamp) == 1) + if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->m_ftCacheStamp) == 1) { // recreate our cache, this is the slow path m_InfoList.RemoveAt(LastListPosition); @@ -371,10 +371,10 @@ BOOL CAvailableApps::EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnu m_InfoList.AddTail(Info); skip_if_cached: - if (Info->Category == FALSE) + if (Info->m_Category == FALSE) continue; - if (EnumType != Info->Category && EnumType != ENUM_ALL_AVAILABLE) + if (EnumType != Info->m_Category && EnumType != ENUM_ALL_AVAILABLE) continue; Info->RefreshAppInfo(); @@ -388,7 +388,7 @@ skip_if_cached: return TRUE; } -CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppName) +CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppName) const { if (m_InfoList.IsEmpty()) { @@ -401,7 +401,7 @@ CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppNa while (CurrentListPosition != NULL) { info = m_InfoList.GetNext(CurrentListPosition); - if (info->szName == szAppName) + if (info->m_szName == szAppName) { return info; } @@ -409,7 +409,7 @@ CAvailableApplicationInfo* CAvailableApps::FindInfo(const ATL::CStringW& szAppNa return NULL; } -ATL::CSimpleArray CAvailableApps::FindInfoList(const ATL::CSimpleArray &arrAppsNames) +ATL::CSimpleArray CAvailableApps::FindInfoList(const ATL::CSimpleArray &arrAppsNames) const { ATL::CSimpleArray result; for (INT i = 0; i < arrAppsNames.GetSize(); ++i) @@ -423,32 +423,32 @@ ATL::CSimpleArray CAvailableApps::FindInfoList(const return result; } -const ATL::CStringW& CAvailableApps::GetFolderPath() +const ATL::CStringW& CAvailableApps::GetFolderPath() const { return m_szPath; } -const ATL::CStringW& CAvailableApps::GetAppPath() +const ATL::CStringW& CAvailableApps::GetAppPath() const { return m_szAppsPath; } -const ATL::CStringW& CAvailableApps::GetCabPath() +const ATL::CStringW& CAvailableApps::GetCabPath() const { return m_szCabPath; } -const LPCWSTR CAvailableApps::GetFolderPathString() +LPCWSTR CAvailableApps::GetFolderPathString() const { return m_szPath.GetString(); } -const LPCWSTR CAvailableApps::GetAppPathString() +LPCWSTR CAvailableApps::GetAppPathString() const { return m_szPath.GetString(); } -const LPCWSTR CAvailableApps::GetCabPathString() +LPCWSTR CAvailableApps::GetCabPathString() const { return m_szPath.GetString(); } diff --git a/reactos/base/applications/rapps/gui.cpp b/reactos/base/applications/rapps/gui.cpp index 04efed24795..3c126879127 100644 --- a/reactos/base/applications/rapps/gui.cpp +++ b/reactos/base/applications/rapps/gui.cpp @@ -90,7 +90,7 @@ class CAvailableAppView else InsertLoadedTextNewl_RichEdit(IDS_STATUS_INSTALLED, CFE_ITALIC); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_VERSION, Info->szInstalledVersion, CFE_BOLD, 0); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_VERSION, Info->m_szInstalledVersion, CFE_BOLD, 0); } else { @@ -102,29 +102,29 @@ class CAvailableAppView InsertLoadedTextNewl_RichEdit(IDS_STATUS_NOTINSTALLED, CFE_ITALIC); } - InsertTextAfterLoaded_RichEdit(IDS_AINFO_AVAILABLEVERSION, Info->szVersion, CFE_BOLD, 0); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_AVAILABLEVERSION, Info->m_szVersion, CFE_BOLD, 0); } static VOID InsertLicenseInfo_RichEdit(CAvailableApplicationInfo* Info) { ATL::CStringW szLicense; - switch (Info->LicenseType) + switch (Info->m_LicenseType) { - case LICENSE_TYPE::OpenSource: + case LicenseType::LICENSE_OPENSOURCE: szLicense.LoadStringW(IDS_LICENSE_OPENSOURCE); break; - case LICENSE_TYPE::Freeware: + case LicenseType::LICENSE_FREEWARE: szLicense.LoadStringW(IDS_LICENSE_FREEWARE); break; - case LICENSE_TYPE::Trial: + case LicenseType::LICENSE_TRIAL: szLicense.LoadStringW(IDS_LICENSE_TRIAL); break; default: - InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, Info->szLicense, CFE_BOLD, 0); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, Info->m_szLicense, CFE_BOLD, 0); return; } - szLicense += L" (" + Info->szLicense + L")"; + szLicense += L" (" + Info->m_szLicense + L")"; InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, szLicense, CFE_BOLD, 0); } @@ -135,7 +135,7 @@ class CAvailableAppView return; } - const INT nTranslations = Info->Languages.GetSize(); + const INT nTranslations = Info->m_LanguageLCIDs.GetSize(); ATL::CStringW szLangInfo; ATL::CStringW szLoadedTextAvailability; ATL::CStringW szLoadedAInfoText; @@ -189,15 +189,15 @@ public: CAvailableApplicationInfo* Info = (CAvailableApplicationInfo*) ListViewGetlParam(Index); if (!Info) return FALSE; - NewRichEditText(Info->szName, CFE_BOLD); + NewRichEditText(Info->m_szName, CFE_BOLD); InsertVersionInfo_RichEdit(Info); InsertLicenseInfo_RichEdit(Info); InsertLanguageInfo_RichEdit(Info); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_SIZE, Info->szSize, CFE_BOLD, 0); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLSITE, Info->szUrlSite, CFE_BOLD, CFE_LINK); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_DESCRIPTION, Info->szDesc, CFE_BOLD, 0); - InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLDOWNLOAD, Info->szUrlDownload, CFE_BOLD, CFE_LINK); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_SIZE, Info->m_szSize, CFE_BOLD, 0); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLSITE, Info->m_szUrlSite, CFE_BOLD, CFE_LINK); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_DESCRIPTION, Info->m_szDesc, CFE_BOLD, 0); + InsertTextAfterLoaded_RichEdit(IDS_AINFO_URLDOWNLOAD, Info->m_szUrlDownload, CFE_BOLD, CFE_LINK); return TRUE; } @@ -305,7 +305,7 @@ public: { 0, ID_INSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, (INT_PTR) szInstallBtn }, { 1, ID_UNINSTALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, (INT_PTR) szUninstallBtn }, { 2, ID_MODIFY, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, (INT_PTR) szModifyBtn }, - { 3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE,{0}, 0, (INT_PTR) szSelectAll}, + { 3, ID_CHECK_ALL, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, (INT_PTR) szSelectAll}, {-1, 0, TBSTATE_ENABLED, BTNS_SEP, { 0 }, 0, 0 }, { 4, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 }, { 5, ID_RESETDB, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 }, @@ -1414,13 +1414,13 @@ private: return StrStrIW(szHaystack, szNeedle) != NULL; } - static BOOL CALLBACK s_EnumInstalledAppProc(INT ItemIndex, ATL::CStringW &szName, PINSTALLED_INFO Info) + static BOOL CALLBACK s_EnumInstalledAppProc(INT ItemIndex, ATL::CStringW &m_szName, PINSTALLED_INFO Info) { PINSTALLED_INFO ItemInfo; ATL::CStringW szText; INT Index; - if (!SearchPatternMatch(szName.GetString(), szSearchPattern)) + if (!SearchPatternMatch(m_szName.GetString(), szSearchPattern)) { RegCloseKey(Info->hSubKey); return TRUE; @@ -1433,7 +1433,7 @@ private: return FALSE; } - Index = ListViewAddItem(ItemIndex, 0, szName, (LPARAM) ItemInfo); + Index = ListViewAddItem(ItemIndex, 0, m_szName, (LPARAM) ItemInfo); /* Get version info */ GetApplicationString(ItemInfo->hSubKey, L"DisplayVersion", szText); @@ -1453,15 +1453,15 @@ private: HIMAGELIST hImageListView = ListView_GetImageList(hListView, LVSIL_SMALL); - if (!SearchPatternMatch(Info->szName, szSearchPattern) && - !SearchPatternMatch(Info->szDesc, szSearchPattern)) + if (!SearchPatternMatch(Info->m_szName, szSearchPattern) && + !SearchPatternMatch(Info->m_szDesc, szSearchPattern)) { return TRUE; } /* Load icon from file */ ATL::CStringW szIconPath; - szIconPath.Format(L"%lsicons\\%ls.ico", szFolderPath, Info->szName); + szIconPath.Format(L"%lsicons\\%ls.ico", szFolderPath, Info->m_szName); hIcon = (HICON) LoadImageW(NULL, szIconPath.GetString(), IMAGE_ICON, @@ -1478,11 +1478,11 @@ private: Index = ImageList_AddIcon(hImageListView, hIcon); DestroyIcon(hIcon); - Index = ListViewAddItem(Info->Category, Index, Info->szName, (LPARAM) Info); + Index = ListViewAddItem(Info->m_Category, Index, Info->m_szName, (LPARAM) Info); ListView_SetImageList(hListView, hImageListView, LVSIL_SMALL); - ListView_SetItemText(hListView, Index, 1, const_cast(Info->szVersion.GetString())); - ListView_SetItemText(hListView, Index, 2, const_cast(Info->szDesc.GetString())); + ListView_SetItemText(hListView, Index, 1, const_cast(Info->m_szVersion.GetString())); + ListView_SetItemText(hListView, Index, 2, const_cast(Info->m_szDesc.GetString())); return TRUE; } @@ -1556,7 +1556,7 @@ private: } // Enum available applications - m_AvailableApps.EnumAvailableApplications(EnumType, s_EnumAvailableAppProc); + m_AvailableApps.Enum(EnumType, s_EnumAvailableAppProc); } SelectedEnumType = EnumType; diff --git a/reactos/base/applications/rapps/include/available.h b/reactos/base/applications/rapps/include/available.h index 454692be122..7711e474e93 100644 --- a/reactos/base/applications/rapps/include/available.h +++ b/reactos/base/applications/rapps/include/available.h @@ -4,6 +4,7 @@ #include #include #include + #include "misc.h" /* EnumType flags for EnumAvailableApplications */ @@ -31,41 +32,46 @@ enum AvailableCategories inline BOOL IsAvailableEnum(INT x) { - return (x >= ENUM_AVAILABLE_MIN && x <= ENUM_AVAILABLE_MAX); + return (x >= AvailableCategories::ENUM_AVAILABLE_MIN && x <= AvailableCategories::ENUM_AVAILABLE_MAX); } -typedef enum LICENSE_TYPE +enum LicenseType { - None, - OpenSource, - Freeware, - Trial, - Max = Trial, - Min = None -} *PLICENSE_TYPE; + LICENSE_NONE, + LICENSE_OPENSOURCE, + LICENSE_FREEWARE, + LICENSE_TRIAL, + LICENSE_MIN = LICENSE_NONE, + LICENSE_MAX = LICENSE_TRIAL +}; + +inline BOOL IsLicenseType(INT x) +{ + return (x >= LicenseType::LICENSE_MIN && x <= LicenseType::LICENSE_MAX); +} struct CAvailableApplicationInfo { - INT Category; - LICENSE_TYPE LicenseType; - ATL::CStringW szName; - ATL::CStringW szRegName; - ATL::CStringW szVersion; - ATL::CStringW szLicense; - ATL::CStringW szDesc; - ATL::CStringW szSize; - ATL::CStringW szUrlSite; - ATL::CStringW szUrlDownload; - ATL::CStringW szCDPath; - ATL::CSimpleArray Languages; + INT m_Category; + LicenseType m_LicenseType; + ATL::CStringW m_szName; + ATL::CStringW m_szRegName; + ATL::CStringW m_szVersion; + ATL::CStringW m_szLicense; + ATL::CStringW m_szDesc; + ATL::CStringW m_szSize; + ATL::CStringW m_szUrlSite; + ATL::CStringW m_szUrlDownload; + ATL::CStringW m_szCDPath; + ATL::CSimpleArray m_LanguageLCIDs; // Caching mechanism related entries - ATL::CStringW sFileName; - FILETIME ftCacheStamp; + ATL::CStringW m_sFileName; + FILETIME m_ftCacheStamp; // Optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string form) - ATL::CStringW szSHA1; - ATL::CStringW szInstalledVersion; + ATL::CStringW m_szSHA1; + ATL::CStringW m_szInstalledVersion; CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam); @@ -115,16 +121,18 @@ public: static BOOL UpdateAppsDB(); static BOOL ForceUpdateAppsDB(); + static VOID DeleteCurrentAppsDB(); VOID FreeCachedEntries(); - static VOID DeleteCurrentAppsDB(); - BOOL EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc); - CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName); - ATL::CSimpleArray FindInfoList(const ATL::CSimpleArray &arrAppsNames); - const ATL::CStringW& GetFolderPath(); - const ATL::CStringW& GetAppPath(); - const ATL::CStringW& GetCabPath(); - const LPCWSTR GetFolderPathString(); - const LPCWSTR GetAppPathString(); - const LPCWSTR GetCabPathString(); + BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc); + + CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName) const; + ATL::CSimpleArray FindInfoList(const ATL::CSimpleArray &arrAppsNames) const; + + const ATL::CStringW& GetFolderPath() const; + const ATL::CStringW& GetAppPath() const; + const ATL::CStringW& GetCabPath() const; + LPCWSTR GetFolderPathString() const; + LPCWSTR GetAppPathString() const; + LPCWSTR GetCabPathString() const; }; diff --git a/reactos/base/applications/rapps/loaddlg.cpp b/reactos/base/applications/rapps/loaddlg.cpp index f1cfd9ec96b..a594be90a1b 100644 --- a/reactos/base/applications/rapps/loaddlg.cpp +++ b/reactos/base/applications/rapps/loaddlg.cpp @@ -72,12 +72,12 @@ struct DownloadInfo { DownloadInfo() {} DownloadInfo(const CAvailableApplicationInfo& AppInfo) - :szUrl(AppInfo.szUrlDownload), szName(AppInfo.szName), szSHA1(AppInfo.szSHA1) + :szUrl(AppInfo.m_szUrlDownload), m_szName(AppInfo.m_szName), szSHA1(AppInfo.m_szSHA1) { } ATL::CStringW szUrl; - ATL::CStringW szName; + ATL::CStringW m_szName; ATL::CStringW szSHA1; }; @@ -259,7 +259,7 @@ public: { for (INT i = 0; i < arrInfo.GetSize(); ++i) { - AddRow(i, arrInfo[i].szName.GetString(), DOWNLOAD_STATUS::DLWaiting); + AddRow(i, arrInfo[i].m_szName.GetString(), DOWNLOAD_STATUS::DLWaiting); } } @@ -639,7 +639,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param) // Change caption to show the currently downloaded app if (!bCab) { - szNewCaption.Format(szCaption, CurrentInfo.szName.GetString()); + szNewCaption.Format(szCaption, CurrentInfo.m_szName.GetString()); } else { @@ -868,7 +868,7 @@ VOID CDownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) { static DownloadInfo DatabaseDLInfo; DatabaseDLInfo.szUrl = lpUrl; - DatabaseDLInfo.szName.LoadStringW(IDS_DL_DIALOG_DB_DISP); + DatabaseDLInfo.m_szName.LoadStringW(IDS_DL_DIALOG_DB_DISP); Download(DatabaseDLInfo, TRUE); } diff --git a/reactos/base/applications/rapps/unattended.cpp b/reactos/base/applications/rapps/unattended.cpp index ffdd252d8c4..128aa63abea 100644 --- a/reactos/base/applications/rapps/unattended.cpp +++ b/reactos/base/applications/rapps/unattended.cpp @@ -1,3 +1,11 @@ +/* +* PROJECT: ReactOS Applications Manager +* LICENSE: GPL - See COPYING in the top level directory +* FILE: base/applications/rapps/unattended.cpp +* PURPOSE: Functions to parse command-line flags and process them +* PROGRAMMERS: Alexander Shaposhnikov (chaez.san@gmail.com) +*/ + #include "unattended.h" #include "defines.h" #include "available.h" @@ -5,13 +13,14 @@ #include "setupapi.h" +#define MIN_ARGS 2 + BOOL CmdParser(LPWSTR lpCmdLine) { INT argc; LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc); - ATL::CString szName; - if (!argv || argc < 2) + if (!argv || argc < MIN_ARGS) { return FALSE; } @@ -56,8 +65,9 @@ BOOL CmdParser(LPWSTR lpCmdLine) } CAvailableApps apps; - CAvailableApps::UpdateAppsDB(); - apps.EnumAvailableApplications(ENUM_ALL_AVAILABLE, NULL); + apps.UpdateAppsDB(); + apps.Enum(ENUM_ALL_AVAILABLE, NULL); + ATL::CSimpleArray arrAppInfo = apps.FindInfoList(arrNames); if (arrAppInfo.GetSize() > 0) {