[RAPPS] Bulk install!
[reactos.git] / reactos / base / applications / rapps / misc.cpp
index 707cc32..1a26e58 100644 (file)
 #define EXTRACT_EXTRACTFILES  0x00000002
 
 static HANDLE hLog = NULL;
-ATL::CStringW szCachedINISectionLocale = L"Section.";
-ATL::CStringW szCachedINISectionLocaleNeutral;
-BYTE bCachedSectionStatus = FALSE;
-
-#define LOCALIZED_STRING_LEN MAX_PATH
-#define STR_VERSION_CURRENT L"CURRENT"
 
 typedef struct
 {
@@ -52,7 +46,6 @@ typedef struct
 typedef HRESULT(WINAPI *fnExtract)(SESSION *dest, LPCSTR szCabName);
 fnExtract pfnExtract;
 
-
 INT
 GetSystemColorDepth(VOID)
 {
@@ -62,7 +55,7 @@ GetSystemColorDepth(VOID)
     pDevMode.dmSize = sizeof(pDevMode);
     pDevMode.dmDriverExtra = 0;
 
-    if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
+    if (!EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
     {
         /* TODO: Error message */
         return ILC_COLOR;
@@ -176,7 +169,7 @@ ShowPopupMenu(HWND hwnd, UINT MenuID, UINT DefaultItem)
     ZeroMemory(&mii, sizeof(mii));
     mii.cbSize = sizeof(mii);
     mii.fMask = MIIM_STATE;
-    GetMenuItemInfo(hPopupMenu, DefaultItem, FALSE, &mii);
+    GetMenuItemInfoW(hPopupMenu, DefaultItem, FALSE, &mii);
 
     if (!(mii.fState & MFS_GRAYED))
         SetMenuDefaultItem(hPopupMenu, DefaultItem, FALSE);
@@ -404,91 +397,4 @@ WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg)
 }
 
 
-ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName)
-{
-    ATL::CStringW szDir;
-    static ATL::CStringW szBuffer;
-
-    GetStorageDirectory(szDir);
-    szBuffer.Format(L"%ls\\rapps\\%ls", szDir, FileName);
-
-    return szBuffer;
-}
-
-UINT ParserGetString(const ATL::CStringW& KeyName, const ATL::CStringW& FileName, ATL::CStringW& ResultString)
-{
-    ATL::CStringW FullFileName = GetINIFullPath(FileName);
-    DWORD dwResult;
-
-    /* we don't have cached section strings for the current system language, create them */
-    if (bCachedSectionStatus == FALSE)
-    {
-        ATL::CStringW szLocale;
-        const INT LocaleSize = 5;
-
-        /* find out what is the current system lang code (e.g. "0a") and append it to SectionLocale */
-        GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
-                       szLocale.GetBuffer(LocaleSize), LocaleSize);
-        szLocale.ReleaseBuffer();
-
-        /* turn "Section.0c0a" into "Section.0a", keeping just the neutral lang part */
-        szCachedINISectionLocaleNeutral = szCachedINISectionLocale + szLocale.Right(2);
-        szCachedINISectionLocale += szLocale;
-
-        /* finally, mark us as cache-friendly for the next time */
-        bCachedSectionStatus = TRUE;
-    }
-
-    LPWSTR ResultStringBuffer = ResultString.GetBuffer(MAX_PATH);
-    /* 1st - find localized strings (e.g. "Section.0c0a") */
-    dwResult = GetPrivateProfileStringW(szCachedINISectionLocale.GetString(),
-                                        KeyName.GetString(),
-                                        NULL,
-                                        ResultStringBuffer,
-                                        LOCALIZED_STRING_LEN,
-                                        FullFileName.GetString());
-
-    if (!dwResult)
-    {
-        /* 2nd - if they weren't present check for neutral sub-langs/ generic translations (e.g. "Section.0a") */
-        dwResult = GetPrivateProfileStringW(szCachedINISectionLocaleNeutral.GetString(),
-                                            KeyName.GetString(),
-                                            NULL,
-                                            ResultStringBuffer,
-                                            LOCALIZED_STRING_LEN,
-                                            FullFileName.GetString());
-        if (!dwResult)
-        {
-            /* 3rd - if they weren't present fallback to standard english strings (just "Section") */
-            dwResult = GetPrivateProfileStringW(L"Section",
-                                                KeyName.GetString(),
-                                                NULL,
-                                                ResultStringBuffer,
-                                                LOCALIZED_STRING_LEN,
-                                                FullFileName.GetString());
-        }
-    }
-
-    ResultString.ReleaseBuffer();
-    return (dwResult != 0 ? TRUE : FALSE);
-}
-
-UINT ParserGetInt(const ATL::CStringW& KeyName, const ATL::CStringW& FileName)
-{
-    ATL::CStringW Buffer;
-    UNICODE_STRING BufferW;
-    ULONG Result;
-
-    /* grab the text version of our entry */
-    if (!ParserGetString(KeyName, FileName, Buffer))
-        return FALSE;
 
-    if (Buffer.IsEmpty())
-        return FALSE;
-
-    /* convert it to an actual integer */
-    RtlInitUnicodeString(&BufferW, Buffer.GetString());
-    RtlUnicodeStringToInteger(&BufferW, 0, &Result);
-
-    return (UINT) Result;
-}