* PROJECT: ReactOS Applications Manager
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/rapps/available.cpp
- * PURPOSE: Functions for working with available applications
+ * PURPOSE: Classes for working with available applications
* PROGRAMMERS: Dmitry Chapyshev (dmitry@reactos.org)
* Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
* Alexander Shaposhnikov (chaez.san@gmail.com)
#include "rapps.h"
-ATL::CAtlList<PAPPLICATION_INFO> InfoList;
+ // CAvailableApplicationInfo
-inline void InsertTextAfterLoaded_RichEdit(UINT uStringID, const ATL::CStringW& szText, DWORD StringFlags, DWORD TextFlags)
+CAvailableApplicationInfo::CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam)
+ : m_Parser(sFileNameParam)
{
- ATL::CStringW szLoadedText;
- if (!szText.IsEmpty() && szLoadedText.LoadStringW(hInst, uStringID))
- {
- InsertRichEditText(szLoadedText, StringFlags);
- InsertRichEditText(szText, TextFlags);
- }
-}
+ LicenseType = LICENSE_TYPE::None;
+ sFileName = sFileNameParam;
-inline void InsertLoadedTextNewl_RichEdit(UINT uStringID, DWORD StringFlags)
-{
- ATL::CStringW szLoadedText;
- if (szLoadedText.LoadStringW(hInst, uStringID))
- {
- InsertRichEditText(L"\n", 0);
- InsertRichEditText(szLoadedText, StringFlags);
- InsertRichEditText(L"\n", 0);
- }
+ RetrieveGeneralInfo();
}
-inline BOOL GetString(LPCWSTR lpKeyName, ATL::CStringW& ReturnedString, const ATL::CStringW& cFileName)
+VOID CAvailableApplicationInfo::RefreshAppInfo()
{
- if (!ParserGetString(lpKeyName, cFileName, ReturnedString))
+ if (szUrlDownload.IsEmpty())
{
- ReturnedString.Empty();
- return FALSE;
+ RetrieveGeneralInfo();
}
- return TRUE;
}
-//App is "installed" if the RegName or Name is in the registry
-inline BOOL IsAppInstalledKey(PAPPLICATION_INFO Info, REGSAM key)
+VOID CAvailableApplicationInfo::RetrieveGeneralInfo()
{
- return (!Info->szRegName.IsEmpty()
- && (IsInstalledApplication(Info->szRegName, TRUE, key)
- || IsInstalledApplication(Info->szRegName, FALSE, key)))
- || (!Info->szName.IsEmpty()
- && (IsInstalledApplication(Info->szName, TRUE, key)
- || IsInstalledApplication(Info->szName, FALSE, key)));
-}
+ Category = m_Parser.GetInt(L"Category");
+ if (!GetString(L"Name", szName)
+ || !GetString(L"URLDownload", szUrlDownload))
+ {
+ return;
+ }
-//Check both registry keys in 64bit system
-//TODO: check system type beforehand to avoid double checks?
-inline BOOL IsAppInstalled(PAPPLICATION_INFO Info)
-{
- return IsAppInstalledKey(Info, KEY_WOW64_32KEY)
- || IsAppInstalledKey(Info, KEY_WOW64_64KEY);
+ 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);
+
+ RetrieveLicenseType();
+ RetrieveLanguages();
+ RetrieveInstalledStatus();
+ if (m_IsInstalled)
+ {
+ RetrieveInstalledVersion();
+ }
}
-//App is "installed" if the RegName or Name is in the registry
-inline BOOL GetInstalledVersionWithKey(PAPPLICATION_INFO Info, ATL::CStringW& szVersion, REGSAM key)
+VOID CAvailableApplicationInfo::RetrieveInstalledStatus()
{
- return (!Info->szRegName.IsEmpty()
- && (InstalledVersion(szVersion, Info->szRegName, TRUE, key)
- || InstalledVersion(szVersion, Info->szRegName, FALSE, key)))
- || (!Info->szName.IsEmpty()
- && (InstalledVersion(szVersion, Info->szName, TRUE, key)
- || InstalledVersion(szVersion, Info->szName, FALSE, key)));
+ m_IsInstalled = ::GetInstalledVersion(NULL, szRegName)
+ || ::GetInstalledVersion(NULL, szName);
}
-inline BOOL GetInstalledVersion(PAPPLICATION_INFO Info, ATL::CStringW& szVersion)
+VOID CAvailableApplicationInfo::RetrieveInstalledVersion()
{
- return GetInstalledVersionWithKey(Info, szVersion, KEY_WOW64_32KEY)
- || GetInstalledVersionWithKey(Info, szVersion, KEY_WOW64_64KEY);
+ m_HasInstalledVersion = ::GetInstalledVersion(&szInstalledVersion, szRegName)
+ || ::GetInstalledVersion(&szInstalledVersion, szName);
}
-LIST_ENTRY CachedEntriesHead = {&CachedEntriesHead, &CachedEntriesHead};
-PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
-
-BOOL
-ShowAvailableAppInfo(INT Index)
+VOID CAvailableApplicationInfo::RetrieveLanguages()
{
- PAPPLICATION_INFO Info = (PAPPLICATION_INFO) ListViewGetlParam(Index);
- ATL::CStringW szVersion;
- ATL::CStringW szLicense;
- BOOL bIsInstalled = IsAppInstalled(Info),
- bHasVersion = GetInstalledVersion(Info, szVersion);
+ const WCHAR cDelimiter = L'|';
+ ATL::CStringW szBuffer;
- if (!Info) return FALSE;
+ // TODO: Get multiline parameter
+ if (!m_Parser.GetString(L"Languages", szBuffer))
+ {
+ m_HasLanguageInfo = FALSE;
+ return;
+ }
- NewRichEditText(Info->szName, CFE_BOLD);
- //installed status
- if (bIsInstalled)
+ // Parse parameter string
+ ATL::CStringW m_szLocale;
+ int iLCID;
+ for (INT i = 0; szBuffer[i] != UNICODE_NULL; ++i)
{
- if (bHasVersion)
+ if (szBuffer[i] != cDelimiter && szBuffer[i] != L'\n')
{
- if (Info->szVersion.Compare(szVersion) > 0)
- InsertLoadedTextNewl_RichEdit(IDS_STATUS_UPDATE_AVAILABLE, CFE_ITALIC);
- else
- InsertLoadedTextNewl_RichEdit(IDS_STATUS_INSTALLED, CFE_ITALIC);
-
- InsertTextAfterLoaded_RichEdit(IDS_AINFO_VERSION, szVersion, CFE_BOLD, 0);
+ m_szLocale += szBuffer[i];
}
else
- InsertLoadedTextNewl_RichEdit(IDS_STATUS_INSTALLED, CFE_ITALIC);
-
+ {
+ if (StrToIntExW(m_szLocale.GetString(), STIF_DEFAULT, &iLCID))
+ {
+ Languages.Add(static_cast<LCID>(iLCID));
+ m_szLocale.Empty();
+ }
+ }
}
- else
- InsertLoadedTextNewl_RichEdit(IDS_STATUS_NOTINSTALLED, CFE_ITALIC);
- InsertTextAfterLoaded_RichEdit(IDS_AINFO_AVAILABLEVERSION, Info->szVersion, CFE_BOLD, 0);
- //license
- switch (Info->LicenseType)
+ // For the text after delimiter
+ if (!m_szLocale.IsEmpty())
{
- case LICENSE_TYPE::OpenSource:
- szLicense.LoadStringW(hInst, IDS_LICENSE_OPENSOURCE);
- break;
- case LICENSE_TYPE::Freeware:
- szLicense.LoadStringW(hInst, IDS_LICENSE_FREEWARE);
- break;
- case LICENSE_TYPE::Trial:
- szLicense.LoadStringW(hInst, IDS_LICENSE_TRIAL);
- break;
- default:
- break;
+ if (StrToIntExW(m_szLocale.GetString(), STIF_DEFAULT, &iLCID))
+ {
+ Languages.Add(static_cast<LCID>(iLCID));
+ }
}
- if (szLicense.IsEmpty())
+ m_HasLanguageInfo = TRUE;
+}
+
+VOID CAvailableApplicationInfo::RetrieveLicenseType()
+{
+ INT IntBuffer = m_Parser.GetInt(L"LicenseType");
+
+ if (IntBuffer < 0 || IntBuffer > LICENSE_TYPE::Max)
{
- InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, Info->szLicense, CFE_BOLD, 0);
+ LicenseType = LICENSE_TYPE::None;
}
else
{
- szLicense.Format(L"(%ls)", Info->szLicense);
- InsertTextAfterLoaded_RichEdit(IDS_AINFO_LICENSE, szLicense, CFE_BOLD, 0);
+ LicenseType = (LICENSE_TYPE) IntBuffer;
+ }
+}
+
+BOOL CAvailableApplicationInfo::FindInLanguages(LCID what) const
+{
+ if (!m_HasLanguageInfo)
+ {
+ return FALSE;
}
- 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);
+ //Find locale code in the list
+ const INT nLanguagesSize = Languages.GetSize();
+ for (INT i = 0; i < nLanguagesSize; ++i)
+ {
+ if (Languages[i] == what)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+BOOL CAvailableApplicationInfo::HasLanguageInfo() const
+{
+ return m_HasLanguageInfo;
+}
+
+BOOL CAvailableApplicationInfo::HasNativeLanguage() const
+{
+ return FindInLanguages(GetUserDefaultLCID());
+}
+
+BOOL CAvailableApplicationInfo::HasEnglishLanguage() const
+{
+ return FindInLanguages(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), SORT_DEFAULT));
+}
+
+BOOL CAvailableApplicationInfo::IsInstalled() const
+{
+ return m_IsInstalled;
+}
+
+BOOL CAvailableApplicationInfo::HasInstalledVersion() const
+{
+ return m_HasInstalledVersion;
+}
+
+BOOL CAvailableApplicationInfo::HasUpdate() const
+{
+ return (szInstalledVersion.Compare(szVersion) < 0) ? TRUE : FALSE;
+}
+
+VOID CAvailableApplicationInfo::SetLastWriteTime(FILETIME* ftTime)
+{
+ RtlCopyMemory(&ftCacheStamp, ftTime, sizeof(FILETIME));
+}
+
+inline BOOL CAvailableApplicationInfo::GetString(LPCWSTR lpKeyName, ATL::CStringW& ReturnedString)
+{
+ if (!m_Parser.GetString(lpKeyName, ReturnedString))
+ {
+ ReturnedString.Empty();
+ return FALSE;
+ }
return TRUE;
}
+// CAvailableApplicationInfo
+
+// CAvailableApps
+CAvailableApps::CAvailableApps()
+{
+ //set all paths
+ if (GetStorageDirectory(m_szPath))
+ {
+ m_szAppsPath = m_szPath + L"\\rapps\\";
+ m_szCabPath = m_szPath + L"\\rappmgr.cab";
+ m_szSearchPath = m_szAppsPath + L"*.txt";
+ }
+}
+
+VOID CAvailableApps::FreeCachedEntries()
+{
+ POSITION InfoListPosition = m_InfoList.GetHeadPosition();
+
+ /* loop and deallocate all the cached app infos in the list */
+ while (InfoListPosition)
+ {
+ CAvailableApplicationInfo* Info = m_InfoList.GetAt(InfoListPosition);
+ m_InfoList.RemoveHead();
+ delete Info;
+
+ InfoListPosition = m_InfoList.GetHeadPosition();
+ }
+}
-static BOOL
-DeleteCurrentAppsDB(VOID)
+BOOL CAvailableApps::DeleteCurrentAppsDB()
{
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATAW FindFileData;
- ATL::CStringW szCabPath;
- ATL::CStringW szSearchPath;
- ATL::CStringW szPath;
BOOL result = TRUE;
- if (!GetStorageDirectory(szPath))
+ if (m_szPath.IsEmpty())
return FALSE;
- szCabPath = szPath + L"\\rappmgr.cab";
- result = result && DeleteFileW(szCabPath.GetString());
-
- szPath += L"\\rapps\\";
- szSearchPath = szPath + L"*.txt";
-
- hFind = FindFirstFileW(szSearchPath.GetString(), &FindFileData);
+ result = result && DeleteFileW(m_szCabPath.GetString());
+ hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return result;
ATL::CStringW szTmp;
do
{
- szTmp = szPath + FindFileData.cFileName;
+ szTmp = m_szPath + FindFileData.cFileName;
result = result && DeleteFileW(szTmp.GetString());
} while (FindNextFileW(hFind, &FindFileData) != 0);
return result;
}
-BOOL
-UpdateAppsDB(VOID)
+BOOL CAvailableApps::UpdateAppsDB()
{
- ATL::CStringW szPath;
- ATL::CStringW szAppsPath;
- ATL::CStringW szCabPath;
-
if (!DeleteCurrentAppsDB())
return FALSE;
DownloadApplicationsDB(APPLICATION_DATABASE_URL);
- if (!GetStorageDirectory(szPath))
+ if (m_szPath.IsEmpty())
return FALSE;
- szCabPath = szPath + L"\\rappmgr.cab";
- szAppsPath = szPath + L"\\rapps\\";
-
- if (!ExtractFilesFromCab(szCabPath, szAppsPath))
+ if (!ExtractFilesFromCab(m_szCabPath, m_szAppsPath))
{
return FALSE;
}
return TRUE;
}
-
-BOOL
-EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
+BOOL CAvailableApps::EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
{
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATAW FindFileData;
- ATL::CStringW szPath;
- ATL::CStringW szAppsPath;
- ATL::CStringW szCabPath;
- PAPPLICATION_INFO Info;
-
-
- if (!GetStorageDirectory(szPath))
- return FALSE;
- szCabPath = szPath + L"\\rappmgr.cab";
- szPath += L"\\rapps\\";
- szAppsPath = szPath;
-
- if (!CreateDirectoryW(szPath.GetString(), NULL) &&
+ if (!CreateDirectoryW(m_szPath.GetString(), NULL) &&
GetLastError() != ERROR_ALREADY_EXISTS)
{
return FALSE;
}
- szPath += L"*.txt";
- hFind = FindFirstFileW(szPath.GetString(), &FindFileData);
+ hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
- if (GetFileAttributesW(szCabPath) == INVALID_FILE_ATTRIBUTES)
+ if (GetFileAttributesW(m_szCabPath) == INVALID_FILE_ATTRIBUTES)
DownloadApplicationsDB(APPLICATION_DATABASE_URL);
- ExtractFilesFromCab(szCabPath, szAppsPath);
- hFind = FindFirstFileW(szPath, &FindFileData);
+ ExtractFilesFromCab(m_szCabPath, m_szAppsPath);
+ hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return FALSE;
do
{
- /* loop for all the cached entries */
- POSITION CurrentListPosition = InfoList.GetHeadPosition();
+ // loop for all the cached entries
+ POSITION CurrentListPosition = m_InfoList.GetHeadPosition();
+ CAvailableApplicationInfo* Info = NULL;
while (CurrentListPosition != NULL)
{
POSITION LastListPosition = CurrentListPosition;
- Info = InfoList.GetNext(CurrentListPosition);
+ Info = m_InfoList.GetNext(CurrentListPosition);
- /* do we already have this entry in cache? */
- if (!Info->cFileName.Compare(FindFileData.cFileName))
+ // do we already have this entry in cache?
+ if (Info->sFileName == FindFileData.cFileName)
{
- /* is it current enough, or the file has been modified since our last time here? */
+ // is it current enough, or the file has been modified since our last time here?
if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->ftCacheStamp) == 1)
{
- /* recreate our cache, this is the slow path */
- InfoList.RemoveAt(LastListPosition);
+ // recreate our cache, this is the slow path
+ m_InfoList.RemoveAt(LastListPosition);
+
delete Info;
+ Info = nullptr;
break;
}
else
{
- /* speedy path, compare directly, we already have the data */
+ // speedy path, compare directly, we already have the data
goto skip_if_cached;
}
}
}
- /* create a new entry */
- Info = new APPLICATION_INFO();
-
- if (!Info)
- break;
-
- Info->Category = ParserGetInt(L"Category", FindFileData.cFileName);
- INT IntBuffer = ParserGetInt(L"LicenseType", FindFileData.cFileName);
- if (IntBuffer < LICENSE_TYPE::Max)
- {
- Info->LicenseType = (LICENSE_TYPE) IntBuffer;
- }
-
- /* copy the cache-related fields for the next time */
- Info->cFileName = FindFileData.cFileName;
- RtlCopyMemory(&Info->ftCacheStamp, &FindFileData.ftLastWriteTime, sizeof(FILETIME));
+ // create a new entry
+ Info = new CAvailableApplicationInfo(FindFileData.cFileName);
- /* add our cached entry to the cached list */
- InfoList.AddTail(Info);
+ // set a timestamp for the next time
+ Info->SetLastWriteTime(&FindFileData.ftLastWriteTime);
+ m_InfoList.AddTail(Info);
skip_if_cached:
-
if (Info->Category == FALSE)
continue;
if (EnumType != Info->Category && EnumType != ENUM_ALL_AVAILABLE)
continue;
- /* if our cache hit was only partial, we need to parse
- and lazily fill the rest of fields only when needed */
+ Info->RefreshAppInfo();
- if (Info->szUrlDownload.IsEmpty())
- {
- if (!GetString(L"Name", Info->szName, FindFileData.cFileName)
- || !GetString(L"URLDownload", Info->szUrlDownload, FindFileData.cFileName))
- {
- continue;
- }
-
- GetString(L"RegName", Info->szRegName, FindFileData.cFileName);
- GetString(L"Version", Info->szVersion, FindFileData.cFileName);
- GetString(L"License", Info->szLicense, FindFileData.cFileName);
- GetString(L"Description", Info->szDesc, FindFileData.cFileName);
- GetString(L"Size", Info->szSize, FindFileData.cFileName);
- GetString(L"URLSite", Info->szUrlSite, FindFileData.cFileName);
- GetString(L"CDPath", Info->szCDPath, FindFileData.cFileName);
- GetString(L"Language", Info->szRegName, FindFileData.cFileName);
- GetString(L"SHA1", Info->szSHA1, FindFileData.cFileName);
- }
-
- if (!lpEnumProc(Info))
+ if (!lpEnumProc(static_cast<PAPPLICATION_INFO>(Info), m_szAppsPath.GetString()))
break;
} while (FindNextFileW(hFind, &FindFileData) != 0);
FindClose(hFind);
-
return TRUE;
}
-VOID FreeCachedAvailableEntries(VOID)
+const ATL::CStringW & CAvailableApps::GetFolderPath()
{
- PAPPLICATION_INFO Info;
- POSITION InfoListPosition = InfoList.GetHeadPosition();
- /* loop and deallocate all the cached app infos in the list */
- while (InfoListPosition)
+ return m_szPath;
+}
+
+const ATL::CStringW & CAvailableApps::GetAppPath()
+{
+ return m_szAppsPath;
+}
+
+const ATL::CStringW & CAvailableApps::GetCabPath()
+{
+ return m_szCabPath;
+}
+
+const LPCWSTR CAvailableApps::GetFolderPathString()
+{
+ return m_szPath.GetString();
+}
+
+const LPCWSTR CAvailableApps::GetAppPathString()
+{
+ return m_szPath.GetString();
+}
+
+const LPCWSTR CAvailableApps::GetCabPathString()
+{
+ return m_szPath.GetString();
+}
+// CAvailableApps
+
+// CConfigParser
+ATL::CStringW CConfigParser::m_szLocaleID;
+ATL::CStringW CConfigParser::m_szCachedINISectionLocale;
+ATL::CStringW CConfigParser::m_szCachedINISectionLocaleNeutral;
+
+CConfigParser::CConfigParser(const ATL::CStringW& FileName) : szConfigPath(GetINIFullPath(FileName))
+{
+ // we don't have cached section strings for the current system language, create them, lazy
+ CacheINILocaleLazy();
+}
+
+ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
+{
+ ATL::CStringW szDir;
+ ATL::CStringW szBuffer;
+
+ GetStorageDirectory(szDir);
+ szBuffer.Format(L"%ls\\rapps\\%ls", szDir, FileName);
+
+ return szBuffer;
+}
+
+VOID CConfigParser::CacheINILocaleLazy()
+{
+ if (m_szLocaleID.IsEmpty())
{
- Info = InfoList.GetAt(InfoListPosition);
- InfoList.RemoveHead();
+ // TODO: Set default locale if call fails
+ // find out what is the current system lang code (e.g. "0a") and append it to SectionLocale
+ GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
+ m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
- /* flush them down the toilet :D */
- delete Info;
+ m_szLocaleID.ReleaseBuffer();
+ m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
+
+ // turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part
+ m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale + m_szLocaleID.Right(2);
+ }
+}
+
+const ATL::CStringW& CConfigParser::GetLocale()
+{
+ CacheINILocaleLazy();
+ return m_szLocaleID;
+}
+
+INT CConfigParser::GetLocaleSize()
+{
+ return m_cchLocaleSize;
+}
- InfoListPosition = InfoList.GetHeadPosition();
+UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString)
+{
+ DWORD dwResult;
+
+ LPWSTR ResultStringBuffer = ResultString.GetBuffer(MAX_PATH);
+ // 1st - find localized strings (e.g. "Section.0c0a")
+ dwResult = GetPrivateProfileStringW(m_szCachedINISectionLocale.GetString(),
+ KeyName.GetString(),
+ NULL,
+ ResultStringBuffer,
+ MAX_PATH,
+ szConfigPath.GetString());
+
+ if (!dwResult)
+ {
+ // 2nd - if they weren't present check for neutral sub-langs/ generic translations (e.g. "Section.0a")
+ dwResult = GetPrivateProfileStringW(m_szCachedINISectionLocaleNeutral.GetString(),
+ KeyName.GetString(),
+ NULL,
+ ResultStringBuffer,
+ MAX_PATH,
+ szConfigPath.GetString());
+ if (!dwResult)
+ {
+ // 3rd - if they weren't present fallback to standard english strings (just "Section")
+ dwResult = GetPrivateProfileStringW(L"Section",
+ KeyName.GetString(),
+ NULL,
+ ResultStringBuffer,
+ MAX_PATH,
+ szConfigPath.GetString());
+ }
}
-}
\ No newline at end of file
+
+ ResultString.ReleaseBuffer();
+ return (dwResult != 0 ? TRUE : FALSE);
+}
+
+UINT CConfigParser::GetInt(const ATL::CStringW& KeyName)
+{
+ ATL::CStringW Buffer;
+
+ // grab the text version of our entry
+ if (!GetString(KeyName, Buffer))
+ return FALSE;
+
+ if (Buffer.IsEmpty())
+ return FALSE;
+
+ // convert it to an actual integer
+ int result = StrToIntW(Buffer.GetString());
+
+ return (UINT) (result <= 0) ? 0 : result;
+}
+// CConfigParser
\ No newline at end of file