- Replace the hardcoded calls to Unicode-Functions. Use the module configuration...
authorEric Kohl <eric.kohl@reactos.org>
Wed, 5 Sep 2007 14:24:45 +0000 (14:24 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 5 Sep 2007 14:24:45 +0000 (14:24 +0000)
- Cleaned up a lot of coding-style and indentation issues.
- No code changes.

svn path=/trunk/; revision=28876

13 files changed:
reactos/dll/cpl/intl/advanced.c
reactos/dll/cpl/intl/currency.c
reactos/dll/cpl/intl/date.c
reactos/dll/cpl/intl/generalp.c
reactos/dll/cpl/intl/inplocale.c
reactos/dll/cpl/intl/intl.c
reactos/dll/cpl/intl/intl.h
reactos/dll/cpl/intl/intl.rbuild
reactos/dll/cpl/intl/languages.c
reactos/dll/cpl/intl/misc.c
reactos/dll/cpl/intl/numbers.c
reactos/dll/cpl/intl/setupreg.c
reactos/dll/cpl/intl/time.c

index 75a8e45..c455e0a 100644 (file)
@@ -8,16 +8,17 @@
 /* Property page dialog callback */
 INT_PTR CALLBACK
 AdvancedPageProc(HWND hwndDlg,
-            UINT uMsg,
-            WPARAM wParam,
-            LPARAM lParam)
+                 UINT uMsg,
+                 WPARAM wParam,
+                 LPARAM lParam)
 {
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
-      break;
-  }
-  return FALSE;
+    switch(uMsg)
+    {
+        case WM_INITDIALOG:
+            break;
+    }
+
+    return FALSE;
 }
 
 /* EOF */
index a7a7850..b433bf7 100644 (file)
@@ -32,8 +32,8 @@
 #include "intl.h"
 #include "resource.h"
 
-#define POSITIVE_EXAMPLE   L"123456789.00"
-#define NEGATIVE_EXAMPLE   L"-123456789.00"
+#define POSITIVE_EXAMPLE   _T("123456789.00")
+#define NEGATIVE_EXAMPLE   _T("-123456789.00")
 #define MAX_FIELD_DIG_SAMPLES       3
 
 
@@ -90,9 +90,9 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
     }
 
     /* Get decimal separator */
-    ret = GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                         LOCALE_SMONDECIMALSEP,
-                         pGlobalData->szDecimalSep, 4);
+    ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
+                        LOCALE_SMONDECIMALSEP,
+                        pGlobalData->szDecimalSep, 4);
 
     /* Get group separator */
     ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
@@ -103,7 +103,6 @@ GetInitialCurrencyValues(PGLOBAL_DATA pGlobalData)
     ret = GetLocaleInfo(LOCALE_USER_DEFAULT,
                         LOCALE_SMONGROUPING,
                         pGlobalData->szGrouping, 10);
-
 }
 
 
@@ -121,20 +120,20 @@ UpdateExamples(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
     cyFmt.PositiveOrder = pGlobalData->PositiveOrder;
     cyFmt.NegativeOrder = pGlobalData->NegativeOrder;
     cyFmt.lpCurrencySymbol = pGlobalData->szCurrencySymbol;
-       
+
     /* positive example */
-    GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
+    GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
                       POSITIVE_EXAMPLE,
                       &cyFmt, szBuffer, MAX_FMT_SIZE);
 
-       SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
 
     /* negative example */
-    GetCurrencyFormatW(LOCALE_USER_DEFAULT, 0,
+    GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
                       NEGATIVE_EXAMPLE,
                       &cyFmt, szBuffer, MAX_FMT_SIZE);
-                                  
-       SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
+
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGSAMPLE), WM_SETTEXT, 0, (LPARAM)szBuffer);
 }
 
 
@@ -148,12 +147,12 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
     GetInitialCurrencyValues(pGlobalData);
 
     /* Set currency symbol */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
                 CB_ADDSTRING,
                 0,
                 (LPARAM)pGlobalData->szCurrencySymbol);
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
                 CB_SETCURSEL,
                 0, /* index */
                 0);
@@ -175,13 +174,13 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
                           _T("1.1"),
                           &cyFmt, szBuffer, MAX_FMT_SIZE);
 
-        SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
+        SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
                     CB_INSERTSTRING,
                     -1,
                     (LPARAM)szBuffer);
     }
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
                 CB_SETCURSEL,
                 pGlobalData->PositiveOrder,
                 0);
@@ -195,53 +194,52 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
                           _T("-1.1"),
                           &cyFmt, szBuffer, MAX_FMT_SIZE);
 
-        SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
+        SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
                     CB_INSERTSTRING,
                     -1,
                     (LPARAM)szBuffer);
     }
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
                 CB_SETCURSEL,
                 pGlobalData->NegativeOrder, /* index */
                 0);
 
     /* decimal separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
                 CB_ADDSTRING,
                 0,
                 (LPARAM)pGlobalData->szDecimalSep);
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
                 CB_SETCURSEL,
                 0, /* index */
                 0);
 
-
     /* */
     for (i = 0; i < 10; i++)
     {
         szBuffer[0] = _T('0') + i;
         szBuffer[1] = 0;
-        SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
+        SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
                     CB_ADDSTRING,
                     0,
                     (LPARAM)szBuffer);
     }
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
                 CB_SETCURSEL,
                 pGlobalData->NumDigits, /* index */
                 0);
 
 
     /* digit group separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
                 CB_ADDSTRING,
                 0,
                 (LPARAM)pGlobalData->szThousandSep);
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
                 CB_SETCURSEL,
                 0, /* index */
                 0);
@@ -257,7 +255,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
     GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
                       _T("123456789"),
                       &cyFmt, szBuffer, MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
                 CB_INSERTSTRING,
                 -1,
                 (LPARAM)szBuffer);
@@ -266,7 +264,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
     GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
                       _T("123456789"),
                       &cyFmt, szBuffer, MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
                 CB_INSERTSTRING,
                 -1,
                 (LPARAM)szBuffer);
@@ -275,7 +273,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
     GetCurrencyFormat(LOCALE_USER_DEFAULT, 0,
                       _T("123456789"),
                       &cyFmt, szBuffer, MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
                 CB_INSERTSTRING,
                 -1,
                 (LPARAM)szBuffer);
@@ -290,7 +288,7 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
             i = 1;
     }
 
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
                 CB_SETCURSEL,
                 i, /* index */
                 0);
@@ -300,149 +298,148 @@ OnInitDialog(HWND hwndDlg, PGLOBAL_DATA pGlobalData)
 }
 
 /* Set number of digidts in field  */
-BOOL
+static BOOL
 SetCurrencyDigNum(HWND hwndDlg)
 {
-    WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    TCHAR szFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
     {
-        L"0;0",
-        L"3;0",
-        L"3;2;0"
+        _T("0;0"),
+        _T("3;0"),
+        _T("3;2;0")
     };
 
     int nCurrSel;
 
     /* Get setted number of digidts in field */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPNUM),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* Save number of digidts in field */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, wszFieldDigNumSamples[nCurrSel]);
-
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONGROUPING, szFieldDigNumSamples[nCurrSel]);
 
     return TRUE;
 }
 
 /* Set currency field separator */
-BOOL
+static BOOL
 SetCurrencyFieldSep(HWND hwndDlg)
 {
-    WCHAR wszCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szCurrencyFieldSep[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted currency field separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszCurrencyFieldSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYGRPSEP),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szCurrencyFieldSep);
 
     /* Save currency field separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, wszCurrencyFieldSep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHOUSANDSEP, szCurrencyFieldSep);
 
     return TRUE;
 }
 
 /* Set number of fractional symbols */
-BOOL
+static BOOL
 SetCurrencyFracSymNum(HWND hwndDlg)
 {
-    WCHAR wszCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
+    TCHAR szCurrencyFracSymNum[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted number of fractional symbols */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECNUM),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszCurrencyFracSymNum,DECIMAL_RADIX);
+    _itot(nCurrSel, szCurrencyFracSymNum, DECIMAL_RADIX);
 
     /* Save number of fractional symbols */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wszCurrencyFracSymNum);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, szCurrencyFracSymNum);
 
     return TRUE;
 }
 
 /* Set currency separator */
-BOOL
+static BOOL
 SetCurrencySep(HWND hwndDlg)
 {
-    WCHAR wszCurrencySep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szCurrencySep[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted currency decimal separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszCurrencySep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYDECSEP),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szCurrencySep);
 
     /* TODO: Add check for correctly input */
 
     /* Save currency separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, wszCurrencySep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONDECIMALSEP, szCurrencySep);
 
     return TRUE;
 }
 
 /* Set negative currency sum format */
-BOOL
+static BOOL
 SetNegCurrencySumFmt(HWND hwndDlg)
 {
-    WCHAR wszNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNegCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted currency unit */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYNEGVALUE),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszNegCurrencySumFmt,DECIMAL_RADIX);
+    _itot(nCurrSel, szNegCurrencySumFmt, DECIMAL_RADIX);
 
     /* Save currency sum format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, wszNegCurrencySumFmt);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGCURR, szNegCurrencySumFmt);
 
     return TRUE;
 }
 
 /* Set positive currency sum format */
-BOOL
+static BOOL
 SetPosCurrencySumFmt(HWND hwndDlg)
 {
-    WCHAR wszPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szPosCurrencySumFmt[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted currency unit */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYPOSVALUE),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszPosCurrencySumFmt,DECIMAL_RADIX);
+    _itot(nCurrSel, szPosCurrencySumFmt, DECIMAL_RADIX);
 
     /* Save currency sum format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, wszPosCurrencySumFmt);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY, szPosCurrencySumFmt);
 
     return TRUE;
 }
 
 /* Set currency unit */
-BOOL
+static BOOL
 SetCurrencyUnit(HWND hwndDlg)
 {
-    WCHAR wszCurrencyUnit[MAX_SAMPLES_STR_SIZE];
+    TCHAR szCurrencyUnit[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted currency unit */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszCurrencyUnit);
+    SendMessage(GetDlgItem(hwndDlg, IDC_CURRENCYSYMBOL),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)(LPCSTR)szCurrencyUnit);
 
     /* Save currency unit */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wszCurrencyUnit);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, szCurrencyUnit);
 
     return TRUE;
 }
@@ -461,48 +458,61 @@ CurrencyPageProc(HWND hwndDlg,
     switch (uMsg)
     {
         case WM_INITDIALOG:
-               {
             pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLOBAL_DATA));
             SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
             OnInitDialog(hwndDlg, pGlobalData);
-               }
-        break;
-               case WM_COMMAND:
-               {
-                       switch (LOWORD(wParam))
-                       {
-                               case IDC_CURRENCYSYMBOL:
-                               case IDC_CURRENCYPOSVALUE:
-                               case IDC_CURRENCYNEGVALUE:
-                               case IDC_CURRENCYDECSEP:
-                               case IDC_CURRENCYDECNUM:
-                               case IDC_CURRENCYGRPSEP:
-                               case IDC_CURRENCYGRPNUM:
-                               if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
-                               {
-                                       /* Set "Apply" button enabled */
-                                       PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
-                               }
-                       }
-               }
-               break;
-               case WM_NOTIFY:
-               {
-                       LPNMHDR lpnm = (LPNMHDR)lParam;
-                       /* If push apply button */
-                       if (lpnm->code == (UINT)PSN_APPLY)
-                       {       
-                               if(!SetCurrencyDigNum(hwndDlg))    break;
-                               if(!SetCurrencyUnit(hwndDlg))      break;
-                               if(!SetPosCurrencySumFmt(hwndDlg)) break;
-                               if(!SetNegCurrencySumFmt(hwndDlg)) break;
-                               if(!SetCurrencySep(hwndDlg))       break;
-                               if(!SetCurrencyFracSymNum(hwndDlg)) break;
-                               if(!SetCurrencyFieldSep(hwndDlg))   break;
-                               UpdateExamples(hwndDlg, pGlobalData);
-                       }
-               }
-               break;
+            break;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDC_CURRENCYSYMBOL:
+                case IDC_CURRENCYPOSVALUE:
+                case IDC_CURRENCYNEGVALUE:
+                case IDC_CURRENCYDECSEP:
+                case IDC_CURRENCYDECNUM:
+                case IDC_CURRENCYGRPSEP:
+                case IDC_CURRENCYGRPNUM:
+                    if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
+                    {
+                        /* Set "Apply" button enabled */
+                        PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+                    }
+            }
+            break;
+
+        case WM_NOTIFY:
+            {
+                LPNMHDR lpnm = (LPNMHDR)lParam;
+                /* If push apply button */
+                if (lpnm->code == (UINT)PSN_APPLY)
+                {
+                    if (!SetCurrencyDigNum(hwndDlg))
+                        break;
+
+                    if (!SetCurrencyUnit(hwndDlg))
+                        break;
+
+                    if (!SetPosCurrencySumFmt(hwndDlg))
+                        break;
+
+                    if (!SetNegCurrencySumFmt(hwndDlg))
+                        break;
+
+                    if (!SetCurrencySep(hwndDlg))
+                        break;
+
+                    if (!SetCurrencyFracSymNum(hwndDlg))
+                        break;
+
+                    if (!SetCurrencyFieldSep(hwndDlg))
+                        break;
+
+                    UpdateExamples(hwndDlg, pGlobalData);
+                }
+            }
+            break;
+
         case WM_DESTROY:
             HeapFree(GetProcessHeap(), 0, pGlobalData);
             break;
index 57160b3..fe4bbc6 100644 (file)
  * PROGRAMMER:      Eric Kohl
  */
 
-#define WINVER 0x0500
-
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
 
 /* GLOBALS ******************************************************************/
 
-const INT YEAR_STR_MAX_SIZE=4;
-const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
+#define YEAR_STR_MAX_SIZE        4
 #define MAX_SHORT_FMT_SAMPLES    5
 #define MAX_LONG_FMT_SAMPLES     2
 #define MAX_SHRT_DATE_SEPARATORS 3
-#define STD_DATE_SEP             L"."
+#define STD_DATE_SEP             _T(".")
 #define YEAR_DIFF                (99)
 #define MAX_YEAR                 (9999)
 
@@ -48,231 +46,231 @@ const INT EOLN_SIZE=sizeof(WCHAR); /* size of EOLN char */
 
 /* if char is 'y' or 'M' or 'd' return TRUE, else FALSE */
 BOOL
-isDateCompAl(WCHAR walpha)
+isDateCompAl(TCHAR alpha)
 {
-    
-    if((walpha == L'y') || (walpha == L'M') || (walpha == L'd') || (walpha == L' ')) return TRUE;
-    else return FALSE;
+    if ((alpha == _T('y')) || (alpha == _T('M')) || (alpha == _T('d')) || (alpha == _T(' ')))
+        return TRUE;
+    else
+        return FALSE;
 }
 
 /* Find first date separator in string */
-WCHAR*
-FindDateSep(const WCHAR *wszSourceStr)
+LPTSTR
+FindDateSep(const TCHAR *szSourceStr)
 {
-    int nDateCompCount=0;
-    int nDateSepCount=0;
+    LPTSTR pszFoundSep;
+    INT nDateCompCount=0;
+    INT nDateSepCount=0;
 
-       WCHAR* wszFindedSep;
-       wszFindedSep=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
+    pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
 
-    wcscpy(wszFindedSep,STD_DATE_SEP);
+    _tcscpy(pszFoundSep,STD_DATE_SEP);
 
-    while(nDateCompCount<wcslen(wszSourceStr))
+    while (nDateCompCount < _tcslen(szSourceStr))
     {
-        if(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
+        if (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
         {
-            while(!isDateCompAl(wszSourceStr[nDateCompCount]) && (wszSourceStr[nDateCompCount]!=L'\''))
+            while (!isDateCompAl(szSourceStr[nDateCompCount]) && (szSourceStr[nDateCompCount] != _T('\'')))
             {
-                wszFindedSep[nDateSepCount++]=wszSourceStr[nDateCompCount];
+                pszFoundSep[nDateSepCount++] = szSourceStr[nDateCompCount];
                 nDateCompCount++;
             }
-            wszFindedSep[nDateSepCount]='\0';
-            return wszFindedSep;
+
+            pszFoundSep[nDateSepCount] = _T('\0');
+            return pszFoundSep;
         }
+
         nDateCompCount++;
     }
 
-    return wszFindedSep;
+    return pszFoundSep;
 }
 
 /* Replace given template in source string with string to replace and return recieved string */
 
 
 /* Setted up short date separator to registry */
-BOOL
+static BOOL
 SetShortDateSep(HWND hwndDlg)
 {
-    WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
-    int nSepStrSize;
-    int nSepCount;
+    TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
+    INT nSepStrSize;
+    INT nSepCount;
 
     /* Get setted separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszShortDateSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szShortDateSep);
 
     /* Get setted separator string size */
-    nSepStrSize = wcslen(wszShortDateSep);
+    nSepStrSize = _tcslen(szShortDateSep);
 
     /* Check date components */
-    for(nSepCount=0;nSepCount<nSepStrSize;nSepCount++)
+    for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++)
     {
-        if(iswalnum(wszShortDateSep[nSepCount]) || (wszShortDateSep[nSepCount]=='\''))
+        if (_istalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == _T('\'')))
         {
-            MessageBoxW(NULL,
-                        L"Entered short date separator contain incorrect symbol",
-                        L"Error", MB_OK | MB_ICONERROR);
+            MessageBox(NULL,
+                       _T("Entered short date separator contain incorrect symbol"),
+                       _T("Error"), MB_OK | MB_ICONERROR);
             return FALSE;
         }
-        
     }
 
     /* Save date separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDATE, wszShortDateSep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, szShortDateSep);
 
     return TRUE;
 }
 
 /* Setted up short date format to registry */
-BOOL
+static BOOL
 SetShortDateFormat(HWND hwndDlg)
 {
-    WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszFindedDateSep[MAX_SAMPLES_STR_SIZE];
-
-    WCHAR* pwszResultStr;
+    TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szFindedDateSep[MAX_SAMPLES_STR_SIZE];
+    LPTSTR pszResultStr;
     BOOL OpenApostFlg = FALSE;
-    int nFmtStrSize;
-    int nDateCompCount;
+    INT nFmtStrSize;
+    INT nDateCompCount;
 
     /* Get setted format */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszShortDateFmt);
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szShortDateFmt);
 
     /* Get setted separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszShortDateSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szShortDateSep);
 
     /* Get setted format-string size */
-    nFmtStrSize = wcslen(wszShortDateFmt);
+    nFmtStrSize = _tcslen(szShortDateFmt);
 
     /* Check date components */
-    for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
+    for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
     {
-        if(wszShortDateFmt[nDateCompCount]==L'\'')
+        if (szShortDateFmt[nDateCompCount] == _T('\''))
         {
-            OpenApostFlg=!OpenApostFlg;
+            OpenApostFlg = !OpenApostFlg;
         }
-        if(iswalnum(wszShortDateFmt[nDateCompCount]) &&
-           !isDateCompAl(wszShortDateFmt[nDateCompCount]) &&
-           !OpenApostFlg)
+
+        if (_istalnum(szShortDateFmt[nDateCompCount]) &&
+            !isDateCompAl(szShortDateFmt[nDateCompCount]) &&
+            !OpenApostFlg)
         {
-            MessageBoxW(NULL,
-                        L"Entered short date format contain incorrect symbol",
-                        L"Error", MB_OK | MB_ICONERROR);
+            MessageBox(NULL,
+                       _T("Entered short date format contain incorrect symbol"),
+                       _T("Error"), MB_OK | MB_ICONERROR);
             return FALSE;
         }
         
     }
 
-    if(OpenApostFlg)
+    if (OpenApostFlg)
     {
         MessageBoxW(NULL,
-                    L"Entered short date format contain incorrect symbol",
-                    L"Error", MB_OK | MB_ICONERROR);
+                    _T("Entered short date format contain incorrect symbol"),
+                    _T("Error"), MB_OK | MB_ICONERROR);
         return FALSE;
     }
 
     /* substring replacement of separator */
-    wcscpy(wszFindedDateSep,FindDateSep(wszShortDateFmt));
-    pwszResultStr = ReplaceSubStr(wszShortDateFmt,wszShortDateSep,wszFindedDateSep);
-    wcscpy(wszShortDateFmt,pwszResultStr);
-    free(pwszResultStr);
+    _tcscpy(szFindedDateSep, FindDateSep(szShortDateFmt));
+    pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFindedDateSep);
+    _tcscpy(szShortDateFmt, pszResultStr);
+    free(pszResultStr);
 
     /* Save short date format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, wszShortDateFmt);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, szShortDateFmt);
 
     return TRUE;
 }
 
 /* Setted up long date format to registry */
-BOOL
+static BOOL
 SetLongDateFormat(HWND hwndDlg)
 {
-    WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
     BOOL OpenApostFlg = FALSE;
-    int nFmtStrSize;
-    int nDateCompCount;
+    INT nFmtStrSize;
+    INT nDateCompCount;
 
     /* Get setted format */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszLongDateFmt);
+    SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szLongDateFmt);
 
     /* Get setted format string size */
-    nFmtStrSize = wcslen(wszLongDateFmt);
+    nFmtStrSize = _tcslen(szLongDateFmt);
 
     /* Check date components */
-    for(nDateCompCount=0;nDateCompCount<nFmtStrSize;nDateCompCount++)
+    for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++)
     {
-        if(wszLongDateFmt[nDateCompCount]==L'\'')
+        if (szLongDateFmt[nDateCompCount] == _T('\''))
         {
-            OpenApostFlg=!OpenApostFlg;
+            OpenApostFlg = !OpenApostFlg;
         }
-        if(iswalnum(wszLongDateFmt[nDateCompCount]) &&
-           !isDateCompAl(wszLongDateFmt[nDateCompCount]) &&
-           !OpenApostFlg)
+
+        if (_istalnum(szLongDateFmt[nDateCompCount]) &&
+            !isDateCompAl(szLongDateFmt[nDateCompCount]) &&
+            !OpenApostFlg)
         {
-            MessageBoxW(NULL,
-                        L"Entered long date format contain incorrect symbol",
-                        L"Error", MB_OK | MB_ICONERROR);
+            MessageBox(NULL,
+                       _T("Entered long date format contain incorrect symbol"),
+                       _T("Error"), MB_OK | MB_ICONERROR);
             return FALSE;
         }
         
     }
 
-    if(OpenApostFlg)
+    if (OpenApostFlg)
     {
         MessageBoxW(NULL,
-                    L"Entered long date format contain incorrect symbol",
-                    L"Error", MB_OK | MB_ICONERROR);
+                    _T("Entered long date format contain incorrect symbol"),
+                    _T("Error"), MB_OK | MB_ICONERROR);
         return FALSE;
     }
 
     /* Save short date format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, wszLongDateFmt);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, szLongDateFmt);
 
     return TRUE;
 }
 
 /* Init short date separator control box */
-VOID
+static VOID
 InitShortDateSepSamples(HWND hwndDlg)
 {
-    WCHAR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR ShortDateSepSamples[MAX_SHRT_DATE_SEPARATORS] =
     {
-        L".",
-        L"/",
-        L"-"
+        _T("."),
+        _T("/"),
+        _T("-")
     };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszShortDateSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current short date separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SDATE,
-                   wszShortDateSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SDATE,
+                  szShortDateSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of separators */
-    for(nCBIndex=0;nCBIndex<MAX_SHRT_DATE_SEPARATORS;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_SHRT_DATE_SEPARATORS; nCBIndex++)
     {
         SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
                      CB_ADDSTRING,
@@ -281,22 +279,22 @@ InitShortDateSepSamples(HWND hwndDlg)
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszShortDateSep);
+                           (LPARAM)szShortDateSep);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
-                     CB_ADDSTRING,
-                     MAX_SHRT_DATE_SEPARATORS+1,
-                     (LPARAM)wszShortDateSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
+                    CB_ADDSTRING,
+                    MAX_SHRT_DATE_SEPARATORS+1,
+                    (LPARAM)szShortDateSep);
         SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESEP_COMBO),
                      CB_SELECTSTRING,
                      -1,
-                     (LPARAM)(LPCSTR)wszShortDateSep);
+                     (LPARAM)szShortDateSep);
     }
 }
 
@@ -304,128 +302,124 @@ InitShortDateSepSamples(HWND hwndDlg)
 VOID
 InitShortDateCB(HWND hwndDlg)
 {
-    WCHAR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR ShortDateFmtSamples[MAX_SHORT_FMT_SAMPLES] =
     {
-        L"dd.MM.yyyy",
-        L"dd.MM.yy",
-        L"d.M.yy",
-        L"dd/MM/yy",
-        L"yyyy-MM-dd"
+        _T("dd.MM.yyyy"),
+        _T("dd.MM.yy"),
+        _T("d.M.yy"),
+        _T("dd/MM/yy"),
+        _T("yyyy-MM-dd")
     };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszShortDateFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current short date format */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SSHORTDATE,
-                   wszShortDateFmt,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SSHORTDATE,
+                  szShortDateFmt,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of date formats */
-    for(nCBIndex=0;nCBIndex<MAX_SHORT_FMT_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_SHORT_FMT_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)ShortDateFmtSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)ShortDateFmtSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszShortDateFmt);
+                           (LPARAM)szShortDateFmt);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
-                     CB_ADDSTRING,
-                     MAX_SHORT_FMT_SAMPLES+1,
-                     (LPARAM)wszShortDateFmt);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszShortDateFmt);
+        SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+                    CB_ADDSTRING,
+                    MAX_SHORT_FMT_SAMPLES+1,
+                    (LPARAM)szShortDateFmt);
+        SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATEFMT_COMBO),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szShortDateFmt);
     }
 }
 
 /* Init long date control box */
-VOID
+static VOID
 InitLongDateCB(HWND hwndDlg)
 {
     /* Where this data stored? */
-    WCHAR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR LongDateFmtSamples[MAX_LONG_FMT_SAMPLES] =
     {
-        L"d MMMM yyyy 'y.'",
-        L"dd MMMM yyyy 'y.'"
+        _T("d MMMM yyyy 'y.'"),
+        _T("dd MMMM yyyy 'y.'")
     };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszLongDateFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current long date format */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SLONGDATE,
-                   wszLongDateFmt,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SLONGDATE,
+                  szLongDateFmt,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of date formats */
-    for(nCBIndex=0;nCBIndex<MAX_LONG_FMT_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_LONG_FMT_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)LongDateFmtSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)LongDateFmtSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszLongDateFmt);
+                           (LPARAM)szLongDateFmt);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
-                     CB_ADDSTRING,
-                     MAX_LONG_FMT_SAMPLES+1,
-                     (LPARAM)wszLongDateFmt);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszLongDateFmt);
+        SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+                    CB_ADDSTRING,
+                    MAX_LONG_FMT_SAMPLES+1,
+                    (LPARAM)szLongDateFmt);
+        SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATEFMT_COMBO),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szLongDateFmt);
     }
 }
 
 /* Set up max date value to registry */
-VOID
+static VOID
 SetMaxDate(HWND hwndDlg)
 {
-    const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
-    WCHAR wszMaxDateVal[YEAR_STR_MAX_SIZE];
+    TCHAR szMaxDateVal[YEAR_STR_MAX_SIZE];
+    HWND hWndYearSpin;
     INT nSpinVal;
 
+    hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
+
     /* Get spin value */
     nSpinVal=LOWORD(SendMessage(hWndYearSpin,
                     UDM_GETPOS,
@@ -433,131 +427,131 @@ SetMaxDate(HWND hwndDlg)
                     0));
 
     /* convert to wide char */
-    _itow(nSpinVal,wszMaxDateVal,DECIMAL_RADIX);
+    _itot(nSpinVal, szMaxDateVal, DECIMAL_RADIX);
 
     /* Save max date value */
-    SetCalendarInfoW(LOCALE_USER_DEFAULT,
-                     CAL_GREGORIAN,
-                     48 , /* CAL_ITWODIGITYEARMAX */
-                     (LPCWSTR)&wszMaxDateVal);
+    SetCalendarInfo(LOCALE_USER_DEFAULT,
+                    CAL_GREGORIAN,
+                    48 , /* CAL_ITWODIGITYEARMAX */
+                    (LPCTSTR)&szMaxDateVal);
 }
 
 /* Get max date value from registry set */
-INT
-GetMaxDate()
+static INT
+GetMaxDate(VOID)
 {
-    int nMaxDateVal;
+    INT nMaxDateVal;
 
-    GetCalendarInfoW(LOCALE_USER_DEFAULT,
-                     CAL_GREGORIAN,
-                     CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
-                     NULL,
-                     0, /* ret type - number */
-                     (LPDWORD)&nMaxDateVal);
+    GetCalendarInfo(LOCALE_USER_DEFAULT,
+                    CAL_GREGORIAN,
+                    CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
+                    NULL,
+                    0, /* ret type - number */
+                    (LPDWORD)&nMaxDateVal);
 
     return nMaxDateVal;
 }
 
 /* Set's MIN data edit control value to MAX-99 */
-static
-VOID
+static VOID
 SetMinData(HWND hwndDlg)
 {
-    WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
-    const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
+    TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
+    HWND hWndYearSpin;
+    INT nSpinVal;
+
+    hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
 
     /* Get spin value */
-    INT nSpinVal=LOWORD(SendMessage(hWndYearSpin,
-                        UDM_GETPOS,
-                        0,
-                        0));
+    nSpinVal = LOWORD(SendMessage(hWndYearSpin,
+                                  UDM_GETPOS,
+                                  0,
+                                  0));
 
     /* Set min year value */
-    wsprintf(OutBuffer, L"%d", (DWORD)nSpinVal-YEAR_DIFF);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
-                 WM_SETTEXT,
-                 0,
-                 (LPARAM)OutBuffer);
+    wsprintf(OutBuffer, _T("%d"), (DWORD)nSpinVal - YEAR_DIFF);
+    SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
+                WM_SETTEXT,
+                0,
+                (LPARAM)OutBuffer);
 }
 
 /* Init spin control */
-static
-VOID
+static VOID
 InitMinMaxDateSpin(HWND hwndDlg)
 {
-    WCHAR OutBuffer[YEAR_STR_MAX_SIZE];
-    const HWND hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
+    TCHAR OutBuffer[YEAR_STR_MAX_SIZE];
+    HWND hWndYearSpin;
+
+    hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR);
 
     /* Init max date value */
-    wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate());
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
-                 WM_SETTEXT,
-                 0,
-                 (LPARAM)OutBuffer);
+    wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate());
+    SendMessage(GetDlgItem(hwndDlg, IDC_SECONDYEAR_EDIT),
+                WM_SETTEXT,
+                0,
+                (LPARAM)OutBuffer);
 
     /* Init min date value */
-    wsprintf(OutBuffer, L"%04d", (DWORD)GetMaxDate()-YEAR_DIFF);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
-                 WM_SETTEXT,
-                 0,
-                 (LPARAM)OutBuffer);
+    wsprintf(OutBuffer, _T("%04d"), (DWORD)GetMaxDate()-YEAR_DIFF);
+    SendMessage(GetDlgItem(hwndDlg, IDC_FIRSTYEAR_EDIT),
+                WM_SETTEXT,
+                0,
+                (LPARAM)OutBuffer);
 
     /* Init updown control */
     /* Set bounds */
-    SendMessageW(hWndYearSpin,
-                 UDM_SETRANGE,
-                 0,
-                 MAKELONG(MAX_YEAR,YEAR_DIFF));
+    SendMessage(hWndYearSpin,
+                UDM_SETRANGE,
+                0,
+                MAKELONG(MAX_YEAR,YEAR_DIFF));
 
     /* Set current value */
-    SendMessageW(hWndYearSpin,
-                 UDM_SETPOS,
-                 0,
-                 MAKELONG(GetMaxDate(),0));
-
+    SendMessage(hWndYearSpin,
+                UDM_SETPOS,
+                0,
+                MAKELONG(GetMaxDate(),0));
 }
 
 /* Update all date locale samples */
-static
-VOID
+static VOID
 UpdateDateLocaleSamples(HWND hwndDlg,
                         LCID lcidLocale)
 {
-    WCHAR OutBuffer[MAX_FMT_SIZE];
+    TCHAR OutBuffer[MAX_FMT_SIZE];
 
     /* Get short date format sample */
-    GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
+    GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
         MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHRTDATESAMPLE_EDIT), WM_SETTEXT,
         0, (LPARAM)OutBuffer);
 
     /* Get long date sample */
-    GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
+    GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
         MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
+    SendMessage(GetDlgItem(hwndDlg, IDC_LONGDATESAMPLE_EDIT),
         WM_SETTEXT, 0, (LPARAM)OutBuffer);
 }
 
 /* Property page dialog callback */
 INT_PTR CALLBACK
 DatePageProc(HWND hwndDlg,
-            UINT uMsg,
-            WPARAM wParam,
-            LPARAM lParam)
+             UINT uMsg,
+             WPARAM wParam,
+             LPARAM lParam)
 {
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
+    switch (uMsg)
     {
-        InitMinMaxDateSpin(hwndDlg);
-        UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
-        InitShortDateCB(hwndDlg);
-        InitLongDateCB(hwndDlg);
-        InitShortDateSepSamples(hwndDlg);
-        /* TODO: Add other calendar types */
-    }
-    break;
-       case WM_COMMAND:
+        case WM_INITDIALOG:
+            InitMinMaxDateSpin(hwndDlg);
+            UpdateDateLocaleSamples(hwndDlg, LOCALE_USER_DEFAULT);
+            InitShortDateCB(hwndDlg);
+            InitLongDateCB(hwndDlg);
+            InitShortDateSepSamples(hwndDlg);
+            /* TODO: Add other calendar types */
+            break;
+
+        case WM_COMMAND:
     {
         switch (LOWORD(wParam))
         {
@@ -608,8 +602,9 @@ DatePageProc(HWND hwndDlg,
         }
     }
     break;
-  }
-  return FALSE;
+    }
+
+    return FALSE;
 }
 
 /* EOF */
index 65ab903..4d77d5d 100644 (file)
  *                  Aleksey Bragin
  */
 
-#define WINVER 0x0501
-#define SAMPLE_NUMBER   L"123456789"
-#define NO_FLAG         0
-
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
-
+#include <tchar.h>
 #include <stdio.h>
 
 #include "intl.h"
 #include "resource.h"
 
+#define SAMPLE_NUMBER   _T("123456789")
+#define NO_FLAG         0
+
 HWND hList;
 HWND hLocaleList, hGeoList;
 
-BOOL CALLBACK LocalesEnumProc(
-  LPTSTR lpLocale // locale id
-)
+BOOL CALLBACK
+LocalesEnumProc(LPTSTR lpLocale)
 {
-       LCID lcid;
-       TCHAR lang[255];
-       int index;
+    LCID lcid;
+    TCHAR lang[255];
+    INT index;
 
-       //swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
-       lcid = wcstoul(lpLocale, NULL, 16);
+    //swscanf(lpLocale, L"%lx", &lcid); // maybe use wcstoul?
+    lcid = _tcstoul(lpLocale, NULL, 16);
 
-       GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
+    GetLocaleInfo(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang));
 
-    index = SendMessageW(hList,
+    index = SendMessage(hList,
                   CB_ADDSTRING,
                   0,
                   (LPARAM)lang);
 
-       SendMessageW(hList,
+    SendMessage(hList,
                   CB_SETITEMDATA,
                   index,
                   (LPARAM)lcid);
 
-       return TRUE;
+    return TRUE;
 }
 
 /* Update all locale samples */
-static
-VOID
+static VOID
 UpdateLocaleSample(HWND hwndDlg, LCID lcidLocale)
 {
-    WCHAR OutBuffer[MAX_FMT_SIZE];
+    TCHAR OutBuffer[MAX_FMT_SIZE];
 
     /* Get number format sample */
-    GetNumberFormatW(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
+    GetNumberFormat(lcidLocale, NO_FLAG, SAMPLE_NUMBER, NULL, OutBuffer,
         MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMSAMPLE_EDIT),
                  WM_SETTEXT, 0, (LPARAM)OutBuffer);
 
     /* Get monetary format sample */
-    GetCurrencyFormatW(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
+    GetCurrencyFormat(lcidLocale, LOCALE_USE_CP_ACP, SAMPLE_NUMBER, NULL,
         OutBuffer, MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
+    SendMessage(GetDlgItem(hwndDlg, IDC_MONEYSAMPLE_EDIT),
                  WM_SETTEXT, 0, (LPARAM)OutBuffer);
 
     /* Get time format sample */
-    GetTimeFormatW(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
+    GetTimeFormat(lcidLocale, NO_FLAG, NULL, NULL, OutBuffer, MAX_FMT_SIZE);
+    SendMessage(GetDlgItem(hwndDlg, IDC_TIMESAMPLE_EDIT),
         WM_SETTEXT,
         0,
         (LPARAM)OutBuffer);
 
     /* Get short date format sample */
-    GetDateFormatW(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
+    GetDateFormat(lcidLocale, DATE_SHORTDATE, NULL, NULL, OutBuffer,
         MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
+    SendMessage(GetDlgItem(hwndDlg, IDC_SHORTTIMESAMPLE_EDIT), WM_SETTEXT,
         0, (LPARAM)OutBuffer);
 
     /* Get long date sample */
-    GetDateFormatW(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
+    GetDateFormat(lcidLocale, DATE_LONGDATE, NULL, NULL, OutBuffer,
         MAX_FMT_SIZE);
-    SendMessageW(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
+    SendMessage(GetDlgItem(hwndDlg, IDC_FULLTIMESAMPLE_EDIT),
         WM_SETTEXT, 0, (LPARAM)OutBuffer);
 }
 
 static VOID
 CreateLanguagesList(HWND hwnd)
 {
-       TCHAR langSel[255];
+    TCHAR langSel[255];
+
+    hList = hwnd;
+    EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
 
-       hList = hwnd;
-       EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
+    // Select current locale
+    GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
 
-       // Select current locale
-       GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel, sizeof(langSel)); // or should it be System and not user?
-       
-       SendMessageW(hList,
+    SendMessage(hList,
                   CB_SELECTSTRING,
                   -1,
                   (LPARAM)langSel);
 }
 
 // Sets new locale
-void SetNewLocale(LCID lcid)
+VOID
+SetNewLocale(LCID lcid)
 {
        // HKCU\\Control Panel\\International\\Locale = 0409 (type=0)
        // HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" (type=0)
@@ -137,111 +135,113 @@ void SetNewLocale(LCID lcid)
        DWORD ret;
        TCHAR value[9];
        DWORD valuesize;
-       WCHAR ACPPage[9];
-       WCHAR OEMPage[9];
+       TCHAR ACPPage[9];
+       TCHAR OEMPage[9];
 
-       ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
+       ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
        if (ret == 0)
        {
-               MessageBoxW(NULL, L"Problem reading OEM code page", L"Big Problem", MB_OK);
+               MessageBox(NULL, _T("Problem reading OEM code page"), _T("Big Problem"), MB_OK);
                return;
        }
 
-       GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
+       GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
        if (ret == 0)
        {
-               MessageBoxW(NULL, L"Problem reading ANSI code page", L"Big Problem", MB_OK);
+               MessageBox(NULL, _T("Problem reading ANSI code page"), _T("Big Problem"), MB_OK);
                return;
        }
 
-       ret = RegOpenKeyW(HKEY_CURRENT_USER, L"Control Panel\\International", &localeKey);
-
+       ret = RegOpenKey(HKEY_CURRENT_USER, _T("Control Panel\\International"), &localeKey);
        if (ret != ERROR_SUCCESS)
        {
                // some serious error
-               MessageBoxW(NULL, L"Problem opening HKCU\\Control Panel\\International key", L"Big Problem", MB_OK);
+               MessageBox(NULL, _T("Problem opening HKCU\\Control Panel\\International key"),
+                          _T("Big Problem"), MB_OK);
                return;
        }
 
-       wsprintf(value, L"%04X", (DWORD)lcid);
-       valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
+       wsprintf(value, _T("%04X"), (DWORD)lcid);
+       valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
 
-       RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
+       RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (LPBYTE)value, valuesize);
        RegCloseKey(localeKey);
 
-       ret = RegOpenKeyW(HKEY_USERS, L".DEFAULT\\Control Panel\\International", &localeKey);
-
+       ret = RegOpenKey(HKEY_USERS, _T(".DEFAULT\\Control Panel\\International"), &localeKey);
        if (ret != ERROR_SUCCESS)
        {
                // some serious error
-               MessageBoxW(NULL, L"Problem opening HKU\\.DEFAULT\\Control Panel\\International key", L"Big Problem", MB_OK);
+               MessageBox(NULL, _T("Problem opening HKU\\.DEFAULT\\Control Panel\\International key"),
+                          _T("Big Problem"), MB_OK);
                return;
        }
 
        wsprintf(value, L"%04X", (DWORD)lcid);
-       valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
+       valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
 
-       RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value, valuesize);
+       RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (BYTE *)value, valuesize);
        RegCloseKey(localeKey);
 
        // Set language
-       ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
-
+       ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
        if (ret != ERROR_SUCCESS)
        {
-               MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key", L"Big Problem", MB_OK);
+               MessageBoxW(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language key"),
+                           _T("Big Problem"), MB_OK);
                return;
        }
 
-       RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize );
-       RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE *)value, valuesize );
+       RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize );
+       RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value, valuesize );
 
        RegCloseKey(langKey);
 
 
-       // Set language
-       ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
-
+       /* Set language */
+       ret = RegOpenKey(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
        if (ret != ERROR_SUCCESS)
        {
-               MessageBoxW(NULL, L"Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key", L"Big Problem", MB_OK);
+               MessageBox(NULL, _T("Problem opening HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key"),
+                          _T("Big Problem"), MB_OK);
                return;
        }
 
-       RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR) );
-       RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR) );
+       RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage, (_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
+       RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage, (_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
 
        RegCloseKey(langKey);
-
 }
 
 /* Location enumerate procedure */
+#if 0
 BOOL
 CALLBACK
 LocationsEnumProc(GEOID gId)
 {
     TCHAR loc[MAX_STR_SIZE];
-    int index;
+    INT index;
 
     GetGeoInfo(gId, GEO_FRIENDLYNAME, loc, MAX_FMT_SIZE, LANG_SYSTEM_DEFAULT);
-    index = (int) SendMessageW(hGeoList,
-                         CB_ADDSTRING,
-                         0,
-                         (LPARAM)loc);
+    index = (INT)SendMessage(hGeoList,
+                             CB_ADDSTRING,
+                             0,
+                             (LPARAM)loc);
 
-    SendMessageW(hGeoList,
-                 CB_SETITEMDATA,
-                 index,
-                 (LPARAM)gId);
+    SendMessage(hGeoList,
+                CB_SETITEMDATA,
+                index,
+                (LPARAM)gId);
 
     return TRUE;
 }
+#endif
 
 /* Enumerate all system locations identifiers */
 static
 VOID
 CreateLocationsList(HWND hWnd)
 {
+#if 0
     GEOID userGeoID;
     TCHAR loc[MAX_STR_SIZE];
 
@@ -257,16 +257,18 @@ CreateLocationsList(HWND hWnd)
                MAX_FMT_SIZE,
                LANG_SYSTEM_DEFAULT);
 
-    SendMessageW(hGeoList,
+    SendMessage(hGeoList,
                  CB_SELECTSTRING,
                  (WPARAM) -1,
                  (LPARAM)loc);
+#endif
 }
 
 DWORD
 VerifyUnattendLCID(HWND hwndDlg)
 {
-       LRESULT lCount, lIndex, lResult;
+    LRESULT lCount, lIndex, lResult;
+
        lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
        if (lCount == CB_ERR)
        {
@@ -340,22 +342,21 @@ GeneralPageProc(HWND hwndDlg,
                                int iCurSel;
 
                                // Acquire new value
-                               iCurSel = SendMessageW(hList,
+                               iCurSel = SendMessage(hList,
                                        CB_GETCURSEL,
                                        0,
                                        0);
                                if (iCurSel == CB_ERR)
                                        break;
 
-                               NewLcid = SendMessageW(hList,
+                               NewLcid = SendMessage(hList,
                                        CB_GETITEMDATA,
                                        iCurSel,
                                        0);
 
                                if (NewLcid == (LCID)CB_ERR)
                                        break;
-                
-                
+
                                // Actually set new locale
                                SetNewLocale(NewLcid);
                        }
index 3e20dac..03a9482 100644 (file)
 /* Property page dialog callback */
 INT_PTR CALLBACK
 InpLocalePageProc(HWND hwndDlg,
-               UINT uMsg,
-               WPARAM wParam,
-               LPARAM lParam)
+                  UINT uMsg,
+                  WPARAM wParam,
+                  LPARAM lParam)
 {
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
-      break;
-  }
-  return FALSE;
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            break;
+    }
+    return FALSE;
 }
 
 /* EOF */
index f7f6a9f..8bddcc1 100644 (file)
@@ -64,14 +64,14 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
 }
 
 BOOL
-OpenSetupInf()
+OpenSetupInf(VOID)
 {
   LPTSTR lpCmdLine;
   LPTSTR lpSwitch;
   size_t len;
 
   lpCmdLine = GetCommandLine();
-  
+
   lpSwitch = _tcsstr(lpCmdLine, _T("/f:\""));
 
   if(!lpSwitch)
@@ -101,7 +101,7 @@ OpenSetupInf()
 }
 
 VOID
-ParseSetupInf()
+ParseSetupInf(VOID)
 {
   INFCONTEXT InfContext;
   TCHAR szBuffer[30];
index 5949c4e..11de0c2 100644 (file)
@@ -82,11 +82,11 @@ TimePageProc(HWND hwndDlg,
 void SetNewLocale(LCID lcid);
 
 /* misc.c */
-WCHAR*
-InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr);
+LPTSTR
+InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr);
 
-WCHAR*
-ReplaceSubStr(const WCHAR *wszSourceStr, const WCHAR *wszStrToReplace, const WCHAR *wszTempl);
+LPTSTR
+ReplaceSubStr(LPCTSTR szSourceStr, LPCTSTR szStrToReplace, LPCTSTR szTempl);
 
 LONG
 APIENTRY
index 41d4ee6..e65b466 100644 (file)
@@ -1,12 +1,11 @@
-<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl">
+<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" unicode="yes">
        <importlibrary definition="intl.def" />
        <include base="intl">.</include>
-       <define name="UNICODE" />
-       <define name="_UNICODE" />
        <define name="__REACTOS__" />
        <define name="__USE_W32API" />
        <define name="_WIN32_IE">0x600</define>
-       <define name="_WIN32_WINNT">0x501</define>
+       <define name="_WIN32_WINNT">0x600</define>
+       <define name="WINVER">0x609</define>
        <library>kernel32</library>
        <library>user32</library>
        <library>comctl32</library>
index c8fbd24..17dba22 100644 (file)
@@ -1,6 +1,7 @@
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
@@ -8,41 +9,44 @@
 /* Property page dialog callback */
 INT_PTR CALLBACK
 LanguagesPageProc(HWND hwndDlg,
-            UINT uMsg,
-            WPARAM wParam,
-            LPARAM lParam)
+                  UINT uMsg,
+                  WPARAM wParam,
+                  LPARAM lParam)
 {
-  SHELLEXECUTEINFOW shInputDll;
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
-      break;
-    case WM_COMMAND:
-        switch (LOWORD(wParam))
-        {
-            /* If "detail" button pressed */
-            case IDC_DETAIL_BUTTON:
-                if(HIWORD(wParam)==BN_CLICKED)
-                {
-                    memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
-                    shInputDll.cbSize = sizeof(shInputDll);
-                    shInputDll.hwnd = hwndDlg;
-                    shInputDll.lpVerb = L"open";
-                    shInputDll.lpFile = L"RunDll32.exe";
-                    shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
-                    if(ShellExecuteExW(&shInputDll)==0)
-                    {
-                        MessageBox(NULL, L"Can't start input.dll", L"Error", MB_OK | MB_ICONERROR);
-                    }
-                }
+    SHELLEXECUTEINFO shInputDll;
 
-                break;
-        }
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            break;
 
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                /* If "detail" button pressed */
+                case IDC_DETAIL_BUTTON:
+                    if (HIWORD(wParam) == BN_CLICKED)
+                    {
+                        memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFO));
+                        shInputDll.cbSize = sizeof(shInputDll);
+                        shInputDll.hwnd = hwndDlg;
+                        shInputDll.lpVerb = _T("open");
+                        shInputDll.lpFile = _T("RunDll32.exe");
+                        shInputDll.lpParameters = _T("shell32.dll,Control_RunDLL input.dll");
+                        if (ShellExecuteEx(&shInputDll) == 0)
+                        {
+                            MessageBox(NULL,
+                                       _T("Can't start input.dll"),
+                                       _T("Error"),
+                                       MB_OK | MB_ICONERROR);
+                        }
+                    }
+                    break;
+            }
+            break;
+    }
 
-        break;
-  }
-  return FALSE;
+    return FALSE;
 }
 
 /* EOF */
index 5385424..f94aedb 100644 (file)
@@ -1,6 +1,7 @@
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
 #define NUM_SHEETS           4
 
 /* Insert the space  */
-WCHAR*
-InsSpacePos(const WCHAR *wszInsStr, const int nPos)
+LPTSTR
+InsSpacePos(LPCTSTR szInsStr, const int nPos)
 {
-       WCHAR* pwszDestStr;
-       pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
-    
-    int nDestStrCnt=0;
-    int nStrCnt;
-    int nStrSize;
-
-       wcscpy(pwszDestStr,wszInsStr);  
-    
-    nStrSize = wcslen(wszInsStr);
-
-    for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
+    LPTSTR pszDestStr;
+    INT nDestStrCnt = 0;
+    INT nStrCnt;
+    INT nStrSize;
+
+    pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
+
+    _tcscpy(pszDestStr, szInsStr);
+
+    nStrSize = _tcslen(szInsStr);
+
+    for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
     {
-        if(nStrCnt==nStrSize-nPos)
+        if (nStrCnt == nStrSize - nPos)
         {
-            pwszDestStr[nDestStrCnt]=' ';
+            pszDestStr[nDestStrCnt] = _T(' ');
             nDestStrCnt++;
         }
-        pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
+
+        pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
         nDestStrCnt++;
     }
-    pwszDestStr[nDestStrCnt]='\0';
-    
-    return pwszDestStr;
+
+    pszDestStr[nDestStrCnt] = _T('\0');
+
+    return pszDestStr;
 }
 
 /* Insert the spaces by format string separated by ';' */
-WCHAR*
-InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
+LPTSTR
+InsSpacesFmt(LPCTSTR szSourceStr, LPCTSTR szFmtStr)
 {
-       WCHAR* pwszDestStr;
-       pwszDestStr=(WCHAR*) malloc(255);
-
-       WCHAR* pwszTempStr;
-
-    WCHAR wszFmtVal[255];
-
-       int nFmtCount=0;
-       int nValCount=0;
-    int nLastVal=0;
-    int nSpaceOffset=0;
-    
+    LPTSTR pszDestStr;
+    LPTSTR pszTempStr;
+    TCHAR szFmtVal[255];
+    INT nFmtCount = 0;
+    INT nValCount = 0;
+    INT nLastVal = 0;
+    INT nSpaceOffset = 0;
     BOOL wasNul=FALSE;
 
-       wcscpy(pwszDestStr,wszSourceStr);
+    pszDestStr = (LPTSTR)malloc(255 * sizeof(TCHAR));
+
+    _tcscpy(pszDestStr, szSourceStr);
 
     /* if format is clean return source string */
-    if(!*wszFmtStr) return pwszDestStr;
+    if (!*szFmtStr)
+        return pszDestStr;
 
     /* Search for all format values */
-    for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
+    for (nFmtCount = 0; nFmtCount <= _tcslen(szFmtStr); nFmtCount++)
     {
-        if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
+        if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
         {
-            if(_wtoi(wszFmtVal)==0 && !wasNul)
+            if (_ttoi(szFmtVal) == 0 && !wasNul)
             {
                 wasNul=TRUE;
                 break;
             }
+
             /* If was 0, repeat spaces */
-            if(wasNul)
+            if (wasNul)
             {
-                nSpaceOffset+=nLastVal;
+                nSpaceOffset += nLastVal;
             }
             else
             {
-                nSpaceOffset+=_wtoi(wszFmtVal);
+                nSpaceOffset += _ttoi(szFmtVal);
             }
-            wszFmtVal[nValCount]='\0';
+
+            szFmtVal[nValCount] = _T('\0');
             nValCount=0;
+
             /* insert space to finded position plus all pos before */
-            pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
-            wcscpy(pwszDestStr,pwszTempStr);
-            free(pwszTempStr);
-            /* num of spaces total increment */
+            pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
+            _tcscpy(pszDestStr,pszTempStr);
+            free(pszTempStr);
 
-            if(!wasNul)
+            /* num of spaces total increment */
+            if (!wasNul)
             {
                 nSpaceOffset++;
-                nLastVal=_wtoi(wszFmtVal);
+                nLastVal = _ttoi(szFmtVal);
             }
-              
         }
         else
         {
-            wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
+            szFmtVal[nValCount++] = szFmtStr[nFmtCount];
         }
     }
 
     /* Create spaces for rest part of string */
-    if(wasNul && nLastVal!=0)
+    if (wasNul && nLastVal != 0)
     {
-        for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
+        for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
         {
-            pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
-            wcscpy(pwszDestStr,pwszTempStr);
-            free(pwszTempStr);
+            pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
+            _tcscpy(pszDestStr, pszTempStr);
+            free(pszTempStr);
         }
     }
 
-    return pwszDestStr;
+    return pszDestStr;
 }
 
 /* Replace given template in source string with string to replace and return recieved string */
-WCHAR*
-ReplaceSubStr(const WCHAR *wszSourceStr,
-              const WCHAR *wszStrToReplace,
-              const WCHAR *wszTempl)
+LPTSTR
+ReplaceSubStr(LPCTSTR szSourceStr,
+              LPCTSTR szStrToReplace,
+              LPCTSTR szTempl)
 {
-       int nCharCnt;
-       int nSubStrCnt;
-       int nDestStrCnt;
-    int nFirstCharCnt;
+    LPTSTR szDestStr;
+    INT nCharCnt;
+    INT nSubStrCnt;
+    INT nDestStrCnt;
+    INT nFirstCharCnt;
 
-       WCHAR* wszDestStr;
-       wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
+    szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
 
-       nDestStrCnt=0;
-    nFirstCharCnt=0;
+    nDestStrCnt = 0;
+    nFirstCharCnt = 0;
 
-    wcscpy(wszDestStr,L"");
+    _tcscpy(szDestStr, _T(""));
 
-    while(nFirstCharCnt<(int)wcslen(wszSourceStr))
-       {
-        if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
+    while (nFirstCharCnt < _tcslen(szSourceStr))
+    {
+        if (szSourceStr[nFirstCharCnt] == szTempl[0])
         {
-            nSubStrCnt=0;
-            for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
+            nSubStrCnt = 0;
+            for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + _tcslen(szTempl); nCharCnt++)
             {
-                if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
+                if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
                 {
                     nSubStrCnt++;
                 }
@@ -148,24 +151,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
                 {
                     break;
                 }
-                if((int)wcslen(wszTempl)==nSubStrCnt)
+
+                if (_tcslen(szTempl) == nSubStrCnt)
                 {
-                    wcscat(wszDestStr,wszStrToReplace);
-                    nDestStrCnt=(int)wcslen(wszDestStr);
-                    nFirstCharCnt+=(int)wcslen(wszTempl)-1;
+                    _tcscat(szDestStr, szStrToReplace);
+                    nDestStrCnt = _tcslen(szDestStr);
+                    nFirstCharCnt += _tcslen(szTempl) - 1;
                     break;
                 }
             }
         }
-        else 
+        else
         {
-            wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
-            wszDestStr[nDestStrCnt]='\0';
+            szDestStr[nDestStrCnt++] = szSourceStr[nFirstCharCnt];
+            szDestStr[nDestStrCnt] = _T('\0');
         }
+
         nFirstCharCnt++;
-       }
+    }
 
-       return wszDestStr;
+    return szDestStr;
 }
 
 /* Create applets */
index fa7f568..30d6242 100644 (file)
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
 
-#define SAMPLE_NUMBER               L"123456789"
-#define SAMPLE_NEG_NUMBER           L"-123456789"
+#define SAMPLE_NUMBER               _T("123456789")
+#define SAMPLE_NEG_NUMBER           _T("-123456789")
 #define MAX_NUM_SEP_SAMPLES         2
 #define MAX_FRAC_NUM_SAMPLES        9
 #define MAX_FIELD_SEP_SAMPLES       1
 #define MAX_LEAD_ZEROES_SAMPLES     2
 #define MAX_LIST_SEP_SAMPLES        1
 #define MAX_UNITS_SYS_SAMPLES       2
-#define EOLN_SIZE                   sizeof(WCHAR)
 
 /* Init num decimal separator control box */
-VOID
+static VOID
 InitNumDecimalSepCB(HWND hwndDlg)
 {
-    WCHAR wszNumSepSamples[MAX_NUM_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
-    {
-        L",",
-        L"."
-    };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
+    LPTSTR lpNumSepSamples[MAX_NUM_SEP_SAMPLES] = {_T(","), _T(".")};
+    TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current decimal separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SDECIMAL,
-                   wszNumSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SDECIMAL,
+                  szNumSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
-    /* Create standart list of decimal separators */
-    for(nCBIndex=0;nCBIndex<MAX_NUM_SEP_SAMPLES;nCBIndex++)
+    /* Create standard list of decimal separators */
+    for (nCBIndex = 0; nCBIndex < MAX_NUM_SEP_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszNumSepSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)lpNumSepSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszNumSep);
+                           (LPARAM)(LPCSTR)szNumSep);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
-                     CB_ADDSTRING,
-                     MAX_NUM_SEP_SAMPLES+1,
-                     (LPARAM)wszNumSep);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszNumSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+                    CB_ADDSTRING,
+                    MAX_NUM_SEP_SAMPLES,
+                    (LPARAM)szNumSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szNumSep);
     }
 }
 
 /* Init number of fractional symbols control box */
-VOID
+static VOID
 InitNumOfFracSymbCB(HWND hwndDlg)
 {
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszFracNum[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszFracCount[MAX_SAMPLES_STR_SIZE];
+    TCHAR szFracNum[MAX_SAMPLES_STR_SIZE];
+    TCHAR szFracCount[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current number of fractional symbols */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_IDIGITS,
-                   wszFracNum,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_IDIGITS,
+                  szFracNum,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
-    /* Create standart list of fractional symbols */
-    for(nCBIndex=0;nCBIndex<MAX_FRAC_NUM_SAMPLES;nCBIndex++)
+    /* Create standard list of fractional symbols */
+    for (nCBIndex = 0; nCBIndex < MAX_FRAC_NUM_SAMPLES; nCBIndex++)
     {
         /* convert to wide char */
-        _itow(nCBIndex,wszFracCount,DECIMAL_RADIX);
+        _itot(nCBIndex, szFracCount, DECIMAL_RADIX);
 
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszFracCount);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)szFracCount);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
                            CB_SETCURSEL,
-                           (WPARAM)_wtoi(wszFracNum),
+                           (WPARAM)_ttoi(szFracNum),
                            (LPARAM)0);
 }
 
 /* Init field separator control box */
-VOID
+static VOID
 InitNumFieldSepCB(HWND hwndDlg)
 {
-    WCHAR wszFieldSepSamples[MAX_FIELD_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
-    {
-        L" "
-    };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
+    LPTSTR lpFieldSepSamples[MAX_FIELD_SEP_SAMPLES] = {_T(" ")};
+    TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current field separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_STHOUSAND,
-                   wszFieldSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_STHOUSAND,
+                  szFieldSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of field separators */
-    for(nCBIndex=0;nCBIndex<MAX_FIELD_SEP_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_FIELD_SEP_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszFieldSepSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)lpFieldSepSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszFieldSep);
+                           (LPARAM)szFieldSep);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
-                     CB_ADDSTRING,
-                     MAX_FIELD_SEP_SAMPLES+1,
-                     (LPARAM)wszFieldSep);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszFieldSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+                    CB_ADDSTRING,
+                    MAX_FIELD_SEP_SAMPLES+1,
+                    (LPARAM)szFieldSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDIGITGRSYM),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szFieldSep);
     }
 }
 
 /* Init number of digidts in field control box */
-VOID
+static VOID
 InitFieldDigNumCB(HWND hwndDlg)
 {
-    WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
     {
-        L"0;0",
-        L"3;0",
-        L"3;2;0"
+        _T("0;0"),
+        _T("3;0"),
+        _T("3;2;0")
     };
 
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszFieldDigNum[MAX_SAMPLES_STR_SIZE];
-    WCHAR* pwszFieldDigNumSmpl;
+    TCHAR szFieldDigNum[MAX_SAMPLES_STR_SIZE];
+    LPTSTR pszFieldDigNumSmpl;
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current field digits num */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SGROUPING,
-                   wszFieldDigNum,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SGROUPING,
+                  szFieldDigNum,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of field digits num */
-    for(nCBIndex=0;nCBIndex<MAX_FIELD_DIG_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++)
     {
 
-        pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNumSamples[nCBIndex]);
+        pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]);
         SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
                      CB_ADDSTRING,
                      nCBIndex,
-                     (LPARAM)pwszFieldDigNumSmpl);
-        free(pwszFieldDigNumSmpl);
+                     (LPARAM)pszFieldDigNumSmpl);
+        free(pszFieldDigNumSmpl);
     }
 
-    pwszFieldDigNumSmpl=InsSpacesFmt(SAMPLE_NUMBER,wszFieldDigNum);
+    pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, szFieldDigNum);
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
+                           (LPARAM)pszFieldDigNumSmpl);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
-                     CB_ADDSTRING,
-                     MAX_FIELD_DIG_SAMPLES+1,
-                     (LPARAM)pwszFieldDigNumSmpl);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)pwszFieldDigNumSmpl);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+                    CB_ADDSTRING,
+                    MAX_FIELD_DIG_SAMPLES+1,
+                    (LPARAM)pszFieldDigNumSmpl);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)pszFieldDigNumSmpl);
     }
 
-    free(pwszFieldDigNumSmpl);
+    free(pszFieldDigNumSmpl);
 }
 
 /* Init negative sign control box */
-VOID
+static VOID
 InitNegSignCB(HWND hwndDlg)
 {
-    WCHAR wszNegSignSamples[MAX_NEG_SIGN_SAMPLES][MAX_SAMPLES_STR_SIZE]=
-    {
-        L"-"
-    };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
+    LPTSTR lpNegSignSamples[MAX_NEG_SIGN_SAMPLES] = {_T("-")};
+    TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current negative sign */
     GetLocaleInfoW(LOCALE_USER_DEFAULT,
                    LOCALE_SNEGATIVESIGN,
-                   wszNegSign,
-                   dwValueSize);
+                   szNegSign,
+                   MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of signs */
-    for(nCBIndex=0;nCBIndex<MAX_NEG_SIGN_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_NEG_SIGN_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszNegSignSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)lpNegSignSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszNegSign);
+                           (LPARAM)szNegSign);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                     CB_ADDSTRING,
-                     MAX_NUM_SEP_SAMPLES+1,
-                     (LPARAM)wszNegSign);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszNegSign);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                    CB_ADDSTRING,
+                    MAX_NUM_SEP_SAMPLES+1,
+                    (LPARAM)szNegSign);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szNegSign);
     }
 }
 
 /* Init negative numbers format control box */
-VOID
+static VOID
 InitNegNumFmtCB(HWND hwndDlg)
 {
-    WCHAR wszNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR lpNegNumFmtSamples[MAX_NEG_NUMBERS_SAMPLES] =
     {
-        L"(1,1)",
-        L"-1,1",
-        L"- 1,1",
-        L"1,1-",
-        L"1,1 -"
+        _T("(1,1)"),
+        _T("-1,1"),
+        _T("- 1,1"),
+        _T("1,1-"),
+        _T("1,1 -")
     };
 
-    int nCBIndex;
-    int nRetCode;
-
-    WCHAR wszNegNumFmt[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszNewSample[MAX_SAMPLES_STR_SIZE];
-    WCHAR* pwszResultStr;
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
+    TCHAR szNegNumFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNewSample[MAX_SAMPLES_STR_SIZE];
+    LPTSTR pszResultStr;
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current negative numbers format */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_INEGNUMBER,
-                   wszNegNumFmt,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_INEGNUMBER,
+                  szNegNumFmt,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Get current decimal separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SDECIMAL,
-                   wszNumSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SDECIMAL,
+                  szNumSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Get current negative sign */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SNEGATIVESIGN,
-                   wszNegSign,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SNEGATIVESIGN,
+                  szNegSign,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Create standart list of negative numbers formats */
-    for(nCBIndex=0;nCBIndex<MAX_NEG_NUMBERS_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
     {
         /* Replace standart separator to setted */
-        pwszResultStr = ReplaceSubStr(wszNegNumFmtSamples[nCBIndex],
-                                      wszNumSep,
-                                      L",");
-        wcscpy(wszNewSample,pwszResultStr);
-        free(pwszResultStr);
+        pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
+                                     szNumSep,
+                                     _T(","));
+        _tcscpy(szNewSample, pszResultStr);
+        free(pszResultStr);
         /* Replace standart negative sign to setted */
-        pwszResultStr = ReplaceSubStr(wszNewSample,
-                                      wszNegSign,
-                                      L"-");
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)pwszResultStr);
-        free(pwszResultStr);
+        pszResultStr = ReplaceSubStr(szNewSample,
+                                     szNegSign,
+                                     _T("-"));
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)pszResultStr);
+        free(pszResultStr);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
                            CB_SETCURSEL,
-                           (WPARAM)_wtoi(wszNegNumFmt),
+                           (WPARAM)_ttoi(szNegNumFmt),
                            (LPARAM)0);
 }
 
 /* Init leading zeroes control box */
-VOID
+static VOID
 InitLeadingZeroesCB(HWND hwndDlg)
 {
-    WCHAR wszLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES] =
     {
-        L",7",
-        L"0,7"
+        _T(",7"),
+        _T("0,7")
     };
 
-    int nCBIndex;
-    int nRetCode;
-
-    WCHAR wszLeadNumFmt[MAX_SAMPLES_STR_SIZE];
-    WCHAR wszNumSep[MAX_SAMPLES_STR_SIZE];
-    WCHAR* pwszResultStr;
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
+    TCHAR szLeadNumFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNumSep[MAX_SAMPLES_STR_SIZE];
+    LPTSTR pszResultStr;
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current leading zeroes format */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_ILZERO,
-                   wszLeadNumFmt,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_ILZERO,
+                  szLeadNumFmt,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Get current decimal separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SDECIMAL,
-                   wszNumSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SDECIMAL,
+                  szNumSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Create list of standart leading zeroes formats */
-    for(nCBIndex=0;nCBIndex<MAX_LEAD_ZEROES_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_LEAD_ZEROES_SAMPLES; nCBIndex++)
     {
-        pwszResultStr = ReplaceSubStr(wszLeadNumFmtSamples[nCBIndex],
-                                      wszNumSep,
-                                      L",");
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)pwszResultStr);
-        free(pwszResultStr);
+        pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex],
+                                     szNumSep,
+                                     _T(","));
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)pszResultStr);
+        free(pszResultStr);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
                            CB_SETCURSEL,
-                           (WPARAM)_wtoi(wszLeadNumFmt),
+                           (WPARAM)_ttoi(szLeadNumFmt),
                            (LPARAM)0);
 }
 
-VOID
+static VOID
 InitListSepCB(HWND hwndDlg)
 {
-    WCHAR wszListSepSamples[MAX_LIST_SEP_SAMPLES][MAX_SAMPLES_STR_SIZE]=
-    {
-        L";"
-    };
-
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
+    LPTSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] = {_T(";")};
+    TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current list separator */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_SLIST,
-                   wszListSep,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_SLIST,
+                  szListSep,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create standart list of signs */
-    for(nCBIndex=0;nCBIndex<MAX_LIST_SEP_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_LIST_SEP_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszListSepSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)lpListSepSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
                            CB_SELECTSTRING,
                            -1,
-                           (LPARAM)(LPCSTR)wszListSep);
+                           (LPARAM)szListSep);
 
     /* if is not success, add new value to list and select them */
-    if(nRetCode == CB_ERR)
+    if (nRetCode == CB_ERR)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
-                     CB_ADDSTRING,
-                     MAX_LIST_SEP_SAMPLES+1,
-                     (LPARAM)wszListSep);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
-                     CB_SELECTSTRING,
-                     -1,
-                     (LPARAM)(LPCSTR)wszListSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+                    CB_ADDSTRING,
+                    MAX_LIST_SEP_SAMPLES+1,
+                    (LPARAM)szListSep);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+                    CB_SELECTSTRING,
+                    -1,
+                    (LPARAM)szListSep);
     }
 }
 
@@ -509,262 +476,259 @@ InitListSepCB(HWND hwndDlg)
 VOID
 InitUnitsSysCB(HWND hwndDlg)
 {
-    WCHAR wszUnitsSysSamples[MAX_UNITS_SYS_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR lpUnitsSysSamples[MAX_UNITS_SYS_SAMPLES] =
     {
-        L"Metrics",
-        L"Americans"
+        _T("Metrics"),
+        _T("Americans")
     };
 
-    int nCBIndex;
-    int nRetCode;
-
-    DWORD dwValueSize=MAX_SAMPLES_STR_SIZE*sizeof(WCHAR)+EOLN_SIZE;
-    WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
+    TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
+    INT nCBIndex;
+    INT nRetCode;
 
     /* Get current system of units */
-    GetLocaleInfoW(LOCALE_USER_DEFAULT,
-                   LOCALE_IMEASURE,
-                   wszUnitsSys,
-                   dwValueSize);
+    GetLocaleInfo(LOCALE_USER_DEFAULT,
+                  LOCALE_IMEASURE,
+                  szUnitsSys,
+                  MAX_SAMPLES_STR_SIZE);
 
     /* Clear all box content */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
-                 CB_RESETCONTENT,
-                 (WPARAM)0,
-                 (LPARAM)0);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
+                CB_RESETCONTENT,
+                (WPARAM)0,
+                (LPARAM)0);
 
     /* Create list of standart system of units */
-    for(nCBIndex=0;nCBIndex<MAX_UNITS_SYS_SAMPLES;nCBIndex++)
+    for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++)
     {
-        SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
-                     CB_ADDSTRING,
-                     nCBIndex,
-                     (LPARAM)wszUnitsSysSamples[nCBIndex]);
+        SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
+                    CB_ADDSTRING,
+                    nCBIndex,
+                    (LPARAM)lpUnitsSysSamples[nCBIndex]);
     }
 
     /* Set current item to value from registry */
-    nRetCode = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
+    nRetCode = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
                            CB_SETCURSEL,
-                           (WPARAM)_wtoi(wszUnitsSys),
+                           (WPARAM)_ttoi(szUnitsSys),
                            (LPARAM)0);
 }
 
 /* Update all numbers locale samples */
-static
-VOID
+static VOID
 UpdateNumSamples(HWND hwndDlg,
-                        LCID lcidLocale)
+                 LCID lcidLocale)
 {
-    WCHAR OutBuffer[MAX_FMT_SIZE];
+    TCHAR OutBuffer[MAX_FMT_SIZE];
 
     /* Get positive number format sample */
-    GetNumberFormatW(lcidLocale,
-                     0,
-                     SAMPLE_NUMBER,
-                     NULL,
-                     OutBuffer,
-                     MAX_FMT_SIZE);
-
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
-                 WM_SETTEXT,
-                 0,
-                 (LPARAM)OutBuffer);
+    GetNumberFormat(lcidLocale,
+                    0,
+                    SAMPLE_NUMBER,
+                    NULL,
+                    OutBuffer,
+                    MAX_FMT_SIZE);
+
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSPOSSAMPLE),
+                WM_SETTEXT,
+                0,
+                (LPARAM)OutBuffer);
 
     /* Get positive number format sample */
-    GetNumberFormatW(lcidLocale,
-                     0,
-                     SAMPLE_NEG_NUMBER,
-                     NULL,
-                     OutBuffer,
-                     MAX_FMT_SIZE);
-
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
-                 WM_SETTEXT,
-                 0,
-                 (LPARAM)OutBuffer);
+    GetNumberFormat(lcidLocale,
+                    0,
+                    SAMPLE_NEG_NUMBER,
+                    NULL,
+                    OutBuffer,
+                    MAX_FMT_SIZE);
+
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNEGSAMPLE),
+                WM_SETTEXT,
+                0,
+                (LPARAM)OutBuffer);
 }
 
 /* Set num decimal separator */
-BOOL
+static BOOL
 SetNumDecimalSep(HWND hwndDlg)
 {
-    WCHAR wszDecimalSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szDecimalSep[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted decimal separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszDecimalSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERDSYMBOL),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szDecimalSep);
 
     /* Save decimal separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szDecimalSep);
 
     return TRUE;
 }
 
 /* Set number of fractional symbols */
-BOOL
+static BOOL
 SetFracSymNum(HWND hwndDlg)
 {
-    WCHAR wszFracSymNum[MAX_SAMPLES_STR_SIZE];
+    TCHAR szFracSymNum[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted number of fractional symbols */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNDIGDEC),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszFracSymNum,DECIMAL_RADIX);
+    _itot(nCurrSel, szFracSymNum, DECIMAL_RADIX);
 
     /* Save number of fractional symbols */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IDIGITS, wszFracSymNum);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDIGITS, szFracSymNum);
 
     return TRUE;
 }
 
 /* Set field separator */
-BOOL
+static BOOL
 SetNumFieldSep(HWND hwndDlg)
 {
-    WCHAR wszFieldSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szFieldSep[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted field separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszFieldSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSDGROUPING),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szFieldSep);
 
     /* Save field separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wszFieldSep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szFieldSep);
 
     return TRUE;
 }
 
 /* Set number of digidts in field  */
-BOOL
+static BOOL
 SetFieldDigNum(HWND hwndDlg)
 {
-    WCHAR wszFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES][MAX_SAMPLES_STR_SIZE]=
+    LPTSTR lpFieldDigNumSamples[MAX_FIELD_DIG_SAMPLES] =
     {
-        L"0;0",
-        L"3;0",
-        L"3;2;0"
+        _T("0;0"),
+        _T("3;0"),
+        _T("3;2;0")
     };
 
-    int nCurrSel;
+    INT nCurrSel;
 
     /* Get setted number of digidts in field */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel=SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                         CB_GETCURSEL,
+                         (WPARAM)0,
+                         (LPARAM)0);
 
     /* Save number of digidts in field */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, wszFieldDigNumSamples[nCurrSel]);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, lpFieldDigNumSamples[nCurrSel]);
 
     return TRUE;
 }
 
 /* Set negative sign */
-BOOL
+static BOOL
 SetNumNegSign(HWND hwndDlg)
 {
-    WCHAR wszNegSign[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNegSign[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted negative sign */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszNegSign);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNSIGNSYM),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szNegSign);
 
     /* Save negative sign */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, wszNegSign);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNEGATIVESIGN, szNegSign);
 
     return TRUE;
 }
 
 /* Set negative sum format */
-BOOL
+static BOOL
 SetNegSumFmt(HWND hwndDlg)
 {
-    WCHAR wszNegSumFmt[MAX_SAMPLES_STR_SIZE];
+    TCHAR szNegSumFmt[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted negative sum format */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSNNUMFORMAT),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszNegSumFmt,DECIMAL_RADIX);
+    _itot(nCurrSel, szNegSumFmt,DECIMAL_RADIX);
 
     /* Save negative sum format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, wszNegSumFmt);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_INEGNUMBER, szNegSumFmt);
 
     return TRUE;
 }
 
 /* Set leading zero */
-BOOL
+static BOOL
 SetNumLeadZero(HWND hwndDlg)
 {
-    WCHAR wszLeadZero[MAX_SAMPLES_STR_SIZE];
+    TCHAR szLeadZero[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted leading zero format */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSDISPLEADZER),
+                            CB_GETCURSEL,
+                            (WPARAM)0,
+                            (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszLeadZero,DECIMAL_RADIX);
+    _itot(nCurrSel, szLeadZero, DECIMAL_RADIX);
 
     /* Save leading zero format */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_ILZERO, wszLeadZero);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, szLeadZero);
 
     return TRUE;
 }
 
 /* Set elements list separator */
-BOOL
+static BOOL
 SetNumListSep(HWND hwndDlg)
 {
-    WCHAR wszListSep[MAX_SAMPLES_STR_SIZE];
+    TCHAR szListSep[MAX_SAMPLES_STR_SIZE];
 
     /* Get setted list separator */
-    SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
-                 WM_GETTEXT,
-                 (WPARAM)MAX_SAMPLES_STR_SIZE,
-                 (LPARAM)(LPCSTR)wszListSep);
+    SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSLSEP),
+                WM_GETTEXT,
+                (WPARAM)MAX_SAMPLES_STR_SIZE,
+                (LPARAM)szListSep);
 
     /* Save list separator */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SLIST, wszListSep);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, szListSep);
 
     return TRUE;
 }
 
 /* Set units system */
-BOOL
+static BOOL
 SetNumUnitsSys(HWND hwndDlg)
 {
-    WCHAR wszUnitsSys[MAX_SAMPLES_STR_SIZE];
+    TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE];
     INT nCurrSel;
 
     /* Get setted units system */
-    nCurrSel=SendMessageW(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
-                          CB_GETCURSEL,
-                          (WPARAM)0,
-                          (LPARAM)0);
+    nCurrSel = SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS),
+                           CB_GETCURSEL,
+                           (WPARAM)0,
+                           (LPARAM)0);
 
     /* convert to wide char */
-    _itow(nCurrSel,wszUnitsSys,DECIMAL_RADIX);
+    _itot(nCurrSel, szUnitsSys, DECIMAL_RADIX);
 
     /* Save units system */
-    SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, wszUnitsSys);
+    SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE, szUnitsSys);
 
     return TRUE;
 }
@@ -776,7 +740,7 @@ NumbersPageProc(HWND hwndDlg,
                WPARAM wParam,
                LPARAM lParam)
 {
-  switch(uMsg)
+  switch (uMsg)
   {
     case WM_INITDIALOG:
        {
@@ -820,14 +784,14 @@ NumbersPageProc(HWND hwndDlg,
                if (lpnm->code == (UINT)PSN_APPLY)
                {
                        if(!SetNumDecimalSep(hwndDlg)) break;
-            if(!SetFracSymNum(hwndDlg))    break;
-            if(!SetNumFieldSep(hwndDlg))   break;
-            if(!SetFieldDigNum(hwndDlg))   break;
-            if(!SetNumNegSign(hwndDlg))    break;
-            if(!SetNegSumFmt(hwndDlg))     break;
-            if(!SetNumLeadZero(hwndDlg))   break;
-            if(!SetNumListSep(hwndDlg))    break;
-            if(!SetNumUnitsSys(hwndDlg))   break;
+            if (!SetFracSymNum(hwndDlg))    break;
+            if (!SetNumFieldSep(hwndDlg))   break;
+            if (!SetFieldDigNum(hwndDlg))   break;
+            if (!SetNumNegSign(hwndDlg))    break;
+            if (!SetNegSumFmt(hwndDlg))     break;
+            if (!SetNumLeadZero(hwndDlg))   break;
+            if (!SetNumListSep(hwndDlg))    break;
+            if (!SetNumUnitsSys(hwndDlg))   break;
                        
                        UpdateNumSamples(hwndDlg, LOCALE_USER_DEFAULT);
                }
index 4ec564f..ae85e94 100644 (file)
@@ -5,12 +5,13 @@
  * PURPOSE:         ReactOS International Control Panel
  * PROGRAMMERS:     Alexey Zavyalov (gen_x@mail.ru)
 */
+
 /* INCLUDES *****************************************************************/
 
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
 /* FUNCTIONS ****************************************************************/
 
 /* Insert the space  */
-WCHAR*
-InsSpacePos(const WCHAR *wszInsStr, const int nPos)
+TCHAR*
+InsSpacePos(const TCHAR *szInsStr, const int nPos)
 {
-       WCHAR* pwszDestStr;
-       pwszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE);
-    
+    LPTSTR pszDestStr;
     int nDestStrCnt=0;
     int nStrCnt;
     int nStrSize;
 
-       wcscpy(pwszDestStr,wszInsStr);  
-    
-    nStrSize = wcslen(wszInsStr);
+    pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
+
+    _tcscpy(pszDestStr, szInsStr);
+
+    nStrSize = _tcslen(szInsStr);
 
-    for(nStrCnt=0; nStrCnt<nStrSize; nStrCnt++)
+    for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++)
     {
-        if(nStrCnt==nStrSize-nPos)
+        if (nStrCnt == nStrSize - nPos)
         {
-            pwszDestStr[nDestStrCnt]=' ';
+            pszDestStr[nDestStrCnt] = _T(' ');
             nDestStrCnt++;
         }
-        pwszDestStr[nDestStrCnt]=wszInsStr[nStrCnt];
+
+        pszDestStr[nDestStrCnt] = szInsStr[nStrCnt];
         nDestStrCnt++;
     }
-    pwszDestStr[nDestStrCnt]='\0';
-    
-    return pwszDestStr;
+
+    pszDestStr[nDestStrCnt] = _T('\0');
+
+    return pszDestStr;
 }
 
 /* Insert the spaces by format string separated by ';' */
-WCHAR*
-InsSpacesFmt(const WCHAR *wszSourceStr, const WCHAR *wszFmtStr)
+LPTSTR
+InsSpacesFmt(const TCHAR *szSourceStr, const TCHAR *szFmtStr)
 {
-       WCHAR* pwszDestStr;
-       pwszDestStr=(WCHAR*) malloc(255);
-
-       WCHAR* pwszTempStr;
-
-    WCHAR wszFmtVal[255];
-
-       int nFmtCount=0;
-       int nValCount=0;
+    LPTSTR pszDestStr;
+    LPTSTR pszTempStr;
+    TCHAR szFmtVal[255];
+    int nFmtCount=0;
+    int nValCount=0;
     int nLastVal=0;
     int nSpaceOffset=0;
-    
     BOOL wasNul=FALSE;
 
-       wcscpy(pwszDestStr,wszSourceStr);
+    pszDestStr = (LPTSTR) malloc(255 * sizeof(TCHAR));
+
+    _tcscpy(pszDestStr, szSourceStr);
 
     /* if format is clean return source string */
-    if(!*wszFmtStr) return pwszDestStr;
+    if (!*szFmtStr)
+        return pszDestStr;
 
     /* Search for all format values */
-    for(nFmtCount=0;nFmtCount<=(int)wcslen(wszFmtStr);nFmtCount++)
+    for (nFmtCount = 0; nFmtCount <= (int)_tcslen(szFmtStr); nFmtCount++)
     {
-        if(wszFmtStr[nFmtCount]==';' || wszFmtStr[nFmtCount]=='\0')
+        if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0'))
         {
-            if(_wtoi(wszFmtVal)==0 && !wasNul)
+            if (_ttoi(szFmtVal) == 0 && !wasNul)
             {
-                wasNul=TRUE;
+                wasNul = TRUE;
                 break;
             }
+
             /* If was 0, repeat spaces */
-            if(wasNul)
+            if (wasNul)
             {
-                nSpaceOffset+=nLastVal;
+                nSpaceOffset += nLastVal;
             }
             else
             {
-                nSpaceOffset+=_wtoi(wszFmtVal);
+                nSpaceOffset += _ttoi(szFmtVal);
             }
-            wszFmtVal[nValCount]='\0';
+
+            szFmtVal[nValCount] = _T('\0');
             nValCount=0;
+
             /* insert space to finded position plus all pos before */
-            pwszTempStr=InsSpacePos(pwszDestStr,nSpaceOffset);
-            wcscpy(pwszDestStr,pwszTempStr);
-            free(pwszTempStr);
-            /* num of spaces total increment */
+            pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset);
+            _tcscpy(pszDestStr, pszTempStr);
+            free(pszTempStr);
 
-            if(!wasNul)
+            /* num of spaces total increment */
+            if (!wasNul)
             {
                 nSpaceOffset++;
-                nLastVal=_wtoi(wszFmtVal);
+                nLastVal = _ttoi(szFmtVal);
             }
-              
         }
         else
         {
-            wszFmtVal[nValCount++]=wszFmtStr[nFmtCount];
+            szFmtVal[nValCount++] = szFmtStr[nFmtCount];
         }
     }
 
     /* Create spaces for rest part of string */
-    if(wasNul && nLastVal!=0)
+    if (wasNul && nLastVal!=0)
     {
-        for(nFmtCount=nSpaceOffset+nLastVal;nFmtCount<wcslen(pwszDestStr);nFmtCount+=nLastVal+1)
+        for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1)
         {
-            pwszTempStr=InsSpacePos(pwszDestStr,nFmtCount);
-            wcscpy(pwszDestStr,pwszTempStr);
-            free(pwszTempStr);
+            pszTempStr = InsSpacePos(pszDestStr, nFmtCount);
+            _tcscpy(pszDestStr,pszTempStr);
+            free(pszTempStr);
         }
     }
 
-    return pwszDestStr;
+    return pszDestStr;
 }
 
 /* Replace given template in source string with string to replace and return recieved string */
-WCHAR*
-ReplaceSubStr(const WCHAR *wszSourceStr,
-              const WCHAR *wszStrToReplace,
-              const WCHAR *wszTempl)
+TCHAR*
+ReplaceSubStr(const TCHAR *szSourceStr,
+              const TCHAR *szStrToReplace,
+              const TCHAR *szTempl)
 {
-       int nCharCnt;
-       int nSubStrCnt;
-       int nDestStrCnt;
+    int nCharCnt;
+    int nSubStrCnt;
+    int nDestStrCnt;
     int nFirstCharCnt;
+    LPTSTR szDestStr;
 
-       WCHAR* wszDestStr;
-       wszDestStr=(WCHAR*) malloc(MAX_SAMPLES_STR_SIZE*sizeof(WCHAR));
-
-       nDestStrCnt=0;
-    nFirstCharCnt=0;
+    szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
+    nDestStrCnt = 0;
+    nFirstCharCnt = 0;
 
-    wcscpy(wszDestStr,L"");
+    _tcscpy(szDestStr, _T(L""));
 
-    while(nFirstCharCnt<(int)wcslen(wszSourceStr))
-       {
-        if(wszSourceStr[nFirstCharCnt]==wszTempl[0])
+    while (nFirstCharCnt < (int)_tcslen(szSourceStr))
+    {
+        if (szSourceStr[nFirstCharCnt] == szTempl[0])
         {
             nSubStrCnt=0;
-            for(nCharCnt=nFirstCharCnt;nCharCnt<nFirstCharCnt+(int)wcslen(wszTempl);nCharCnt++)
+            for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + (int)_tcslen(szTempl); nCharCnt++)
             {
-                if(wszSourceStr[nCharCnt]==wszTempl[nSubStrCnt])
+                if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt])
                 {
                     nSubStrCnt++;
                 }
@@ -162,24 +164,26 @@ ReplaceSubStr(const WCHAR *wszSourceStr,
                 {
                     break;
                 }
-                if((int)wcslen(wszTempl)==nSubStrCnt)
+
+                if ((int)_tcslen(szTempl) == nSubStrCnt)
                 {
-                    wcscat(wszDestStr,wszStrToReplace);
-                    nDestStrCnt=(int)wcslen(wszDestStr);
-                    nFirstCharCnt+=(int)wcslen(wszTempl)-1;
+                    _tcscat(szDestStr, szStrToReplace);
+                    nDestStrCnt = (int)_tcslen(szDestStr);
+                    nFirstCharCnt += (int)_tcslen(szTempl) - 1;
                     break;
                 }
             }
         }
-        else 
+        else
         {
-            wszDestStr[nDestStrCnt++]=wszSourceStr[nFirstCharCnt];
-            wszDestStr[nDestStrCnt]='\0';
+            szDestStr[nDestStrCnt++] = wszSourceStr[nFirstCharCnt];
+            szDestStr[nDestStrCnt] = _T('\0');
         }
+
         nFirstCharCnt++;
-       }
+    }
 
-       return wszDestStr;
+    return szDestStr;
 }
 
 static
index 4b1d2be..b1d29a4 100644 (file)
 #include <windows.h>
 #include <commctrl.h>
 #include <cpl.h>
+#include <tchar.h>
 
 #include "intl.h"
 #include "resource.h"
 
 /*
  * TODO:
- *    - Enumerate available time formats (use EnumTimeformatsW)
+ *    - Enumerate available time formats (use EnumTimeFormats)
  */
 
 static VOID
 UpdateTimeSample(HWND hWnd)
 {
-  WCHAR InBuffer[80];
-  WCHAR OutBuffer[80];
+    TCHAR InBuffer[80];
+    TCHAR OutBuffer[80];
 
-  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
+    GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, InBuffer, 80);
 
-  GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
+    GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, InBuffer, OutBuffer, 80);
 
-  SendMessageW(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
+    SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)OutBuffer);
 }
 
 
@@ -56,81 +57,81 @@ TimePageProc(HWND hwndDlg,
              WPARAM wParam,
              LPARAM lParam)
 {
-  switch(uMsg)
+  switch (uMsg)
   {
     case WM_INITDIALOG:
       {
-        WCHAR Buffer[80];
+        TCHAR Buffer[80];
         int nLen;
 
         /* Update the time format sample */
         UpdateTimeSample(GetDlgItem(hwndDlg, IDC_TIMESAMPLE));
 
         /* Get the time format (max. 80 characters) */
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
                     CB_LIMITTEXT, 80, 0);
 
         /* FIXME: add available time formats to the list */
 
-        GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
-                     CB_ADDSTRING,
-                     0,
-                     (LPARAM)Buffer);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
+        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer, 80);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
+                    CB_ADDSTRING,
+                    0,
+                    (LPARAM)Buffer);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
                     CB_SETCURSEL,
                     0, /* index */
                     0);
 
         /* Get the time separator (max. 4 characters) */
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
                     CB_LIMITTEXT, 4, 0);
-        GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
-                     CB_ADDSTRING,
-                     0,
-                     (LPARAM)Buffer);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
+        GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer, 80);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
+                    CB_ADDSTRING,
+                    0,
+                    (LPARAM)Buffer);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
                     CB_SETCURSEL,
                     0, /* index */
                     0);
 
         /* Get the AM symbol (max. 9 characters) */
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
                     CB_LIMITTEXT, 9, 0);
-        nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
-                     CB_ADDSTRING,
-                     0,
-                     (LPARAM)Buffer);
+        nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer, 80);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+                    CB_ADDSTRING,
+                    0,
+                    (LPARAM)Buffer);
         if (nLen != 0)
         {
-          SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
-                       CB_ADDSTRING,
-                       0,
-                       (LPARAM)L"");
+          SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+                      CB_ADDSTRING,
+                      0,
+                      (LPARAM)_T(""));
         }
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
                     CB_SETCURSEL,
                     0, /* index */
                     0);
 
         /* Get the PM symbol (max. 9 characters) */
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
                     CB_LIMITTEXT, 9, 0);
-        nLen = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
-                     CB_ADDSTRING,
-                     0,
-                     (LPARAM)Buffer);
+        nLen = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer, 80);
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+                    CB_ADDSTRING,
+                    0,
+                    (LPARAM)Buffer);
         if (nLen != 0)
         {
-          SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
-                       CB_ADDSTRING,
-                       0,
-                       (LPARAM)L"");
+          SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+                      CB_ADDSTRING,
+                      0,
+                      (LPARAM)_T(""));
         }
-        SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+        SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
                     CB_SETCURSEL,
                     0, /* index */
                     0);
@@ -159,49 +160,49 @@ TimePageProc(HWND hwndDlg,
 
         if (lpnm->code == (UINT)PSN_APPLY)
         {
-          WCHAR Buffer[80];
+          TCHAR Buffer[80];
           int nIndex;
 
           /* Set time format */
-          nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
+          nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
                                CB_GETCURSEL, 0, 0);
-          SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
+          SendMessage(GetDlgItem(hwndDlg, IDC_TIMEFORMAT),
                       CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
-          SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
+          SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIMEFORMAT, Buffer);
 
           /* Set time separator */
-          nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
+          nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
                                CB_GETCURSEL, 0, 0);
-          SendMessageW(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
+          SendMessage(GetDlgItem(hwndDlg, IDC_TIMESEPARATOR),
                       CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
-          SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
+          SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, Buffer);
 
           /* Set the AM symbol */
-          nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+          nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
                                CB_GETCURSEL, 0, 0);
           if (nIndex != CB_ERR)
           {
-            SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
+            SendMessage(GetDlgItem(hwndDlg, IDC_TIMEAMSYMBOL),
                         CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
-            SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
+            SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, Buffer);
           }
           else
           {
-            SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S1159, L"");
+            SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S1159, _T(""));
           }
 
           /* Set the PM symbol */
-          nIndex = SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+          nIndex = SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
                                CB_GETCURSEL, 0, 0);
           if (nIndex != CB_ERR)
           {
-            SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
+            SendMessage(GetDlgItem(hwndDlg, IDC_TIMEPMSYMBOL),
                         CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)Buffer);
-            SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
+            SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, Buffer);
           }
           else
           {
-            SetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_S2359, L"");
+            SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_S2359, _T(""));
           }
 
           /* Update the time format sample */