Author: hbelusca
Date: Sat Jun  4 14:09:20 2016
New Revision: 71512

URL: http://svn.reactos.org/svn/reactos?rev=71512&view=rev
Log:
[EXPLORER]
- Start to convert the code to pure Unicode.
- Use _countof where needed.
- Use UINT for loop counters where the counter value is always positive.
- Some whitespace fixes.

Modified:
    trunk/reactos/base/shell/explorer/desktop.cpp
    trunk/reactos/base/shell/explorer/explorer.cpp
    trunk/reactos/base/shell/explorer/notifyiconscust.cpp
    trunk/reactos/base/shell/explorer/precomp.h
    trunk/reactos/base/shell/explorer/rshell.cpp
    trunk/reactos/base/shell/explorer/settings.cpp
    trunk/reactos/base/shell/explorer/shellservice.cpp
    trunk/reactos/base/shell/explorer/startctxmnu.cpp
    trunk/reactos/base/shell/explorer/startmnu.cpp
    trunk/reactos/base/shell/explorer/startmnucust.cpp
    trunk/reactos/base/shell/explorer/startmnusite.cpp
    trunk/reactos/base/shell/explorer/startup.cpp
    trunk/reactos/base/shell/explorer/taskswnd.cpp
    trunk/reactos/base/shell/explorer/tbsite.cpp
    trunk/reactos/base/shell/explorer/trayntfy.cpp
    trunk/reactos/base/shell/explorer/trayprop.cpp
    trunk/reactos/base/shell/explorer/traywnd.cpp
    trunk/reactos/base/shell/explorer/util.cpp

Modified: trunk/reactos/base/shell/explorer/desktop.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/desktop.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/desktop.cpp       [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/desktop.cpp       [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -75,7 +75,7 @@
 
         m_Tray = pTray;
 
-        m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+        m_hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
         if (!m_hEvent)
             return E_FAIL;
 
@@ -120,7 +120,7 @@
     CDesktopThread* pDesktopThread = new CDesktopThread();
 
     HRESULT hres = pDesktopThread->Initialize(Tray);
-    if(FAILED_UNEXPECTEDLY(hres))
+    if (FAILED_UNEXPECTEDLY(hres))
     {
         delete pDesktopThread;
         return NULL;

Modified: trunk/reactos/base/shell/explorer/explorer.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explorer.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/explorer.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/explorer.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -55,11 +55,11 @@
 
 #if !WIN7_DEBUG_MODE
 static BOOL
-SetShellReadyEvent(IN LPCTSTR lpEventName)
+SetShellReadyEvent(IN LPCWSTR lpEventName)
 {
     HANDLE hEvent;
 
-    hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, lpEventName);
+    hEvent = OpenEventW(EVENT_MODIFY_STATE, FALSE, lpEventName);
     if (hEvent != NULL)
     {
         SetEvent(hEvent);
@@ -77,17 +77,17 @@
     MINIMIZEDMETRICS mm;
 
     mm.cbSize = sizeof(mm);
-    if (!SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
-    {
-        ERR("SystemParametersInfo failed with %lu\n", GetLastError());
+    if (!SystemParametersInfoW(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
+    {
+        ERR("SystemParametersInfoW failed with %lu\n", GetLastError());
         return;
     }
     if (bHide)
         mm.iArrange |= ARW_HIDE;
     else
         mm.iArrange &= ~ARW_HIDE;
-    if (!SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
-        ERR("SystemParametersInfo failed with %lu\n", GetLastError());
+    if (!SystemParametersInfoW(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
+        ERR("SystemParametersInfoW failed with %lu\n", GetLastError());
 }
 #endif
 
@@ -119,12 +119,12 @@
 {
     InitializeAtlModule(hInstance, TRUE);
 
-    if (RegOpenKey(HKEY_CURRENT_USER,
+    if (RegOpenKeyW(HKEY_CURRENT_USER,
         L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
         &hkExplorer) != ERROR_SUCCESS)
     {
         WCHAR Message[256];
-        LoadString(hInstance, IDS_STARTUP_ERROR, Message, 256);
+        LoadStringW(hInstance, IDS_STARTUP_ERROR, Message, _countof(Message));
         MessageBox(NULL, Message, NULL, MB_ICONERROR);
         return 1;
     }
@@ -166,8 +166,8 @@
         hShellDesktop = DesktopCreateWindow(Tray);
 
     /* WinXP: Notify msgina to hide the welcome screen */
-    if (!SetShellReadyEvent(TEXT("msgina: ShellReadyEvent")))
-        SetShellReadyEvent(TEXT("Global\\msgina: ShellReadyEvent"));
+    if (!SetShellReadyEvent(L"msgina: ShellReadyEvent"))
+        SetShellReadyEvent(L"Global\\msgina: ShellReadyEvent");
 #endif
 
     if (Tray != NULL)

Modified: trunk/reactos/base/shell/explorer/notifyiconscust.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/notifyiconscust.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/notifyiconscust.cpp       [iso-8859-1] 
(original)
+++ trunk/reactos/base/shell/explorer/notifyiconscust.cpp       [iso-8859-1] 
Sat Jun  4 14:09:20 2016
@@ -46,5 +46,5 @@
 
 VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer)
 {
-    DialogBox(hInst, MAKEINTRESOURCE(IDD_NOTIFICATIONS_CUSTOMIZE), hExplorer, 
CustomizeNotifyIconsProc);
+    DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_NOTIFICATIONS_CUSTOMIZE), 
hExplorer, CustomizeNotifyIconsProc);
 }

Modified: trunk/reactos/base/shell/explorer/precomp.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp.h?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -65,8 +65,8 @@
 static inline 
 LONG
 SetWindowStyle(IN HWND hWnd,
-IN LONG dwStyleMask,
-IN LONG dwStyle)
+               IN LONG dwStyleMask,
+               IN LONG dwStyle)
 {
     return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
 }
@@ -74,35 +74,35 @@
 static inline
 LONG
 SetWindowExStyle(IN HWND hWnd,
-IN LONG dwStyleMask,
-IN LONG dwStyle)
+                 IN LONG dwStyleMask,
+                 IN LONG dwStyle)
 {
     return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
 }
 
 HMENU
 LoadPopupMenu(IN HINSTANCE hInstance,
-IN LPCTSTR lpMenuName);
+              IN LPCWSTR lpMenuName);
 
 HMENU
 FindSubMenu(IN HMENU hMenu,
-IN UINT uItem,
-IN BOOL fByPosition);
-
-BOOL
-GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer,
-IN DWORD dwBufferSize);
+            IN UINT uItem,
+            IN BOOL fByPosition);
+
+BOOL
+GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer,
+                           IN DWORD dwBufferSize);
 
 BOOL
 FormatMenuString(IN HMENU hMenu,
-IN UINT uPosition,
-IN UINT uFlags,
-...);
+                 IN UINT uPosition,
+                 IN UINT uFlags,
+                 ...);
 
 BOOL
 GetExplorerRegValueSet(IN HKEY hKey,
-IN LPCTSTR lpSubKey,
-IN LPCTSTR lpValue);
+                       IN LPCWSTR lpSubKey,
+                       IN LPCWSTR lpValue);
 
 /*
  *  rshell.c
@@ -190,9 +190,9 @@
 LoadAdvancedSettings(VOID);
 
 BOOL
-SaveSettingDword(IN PCTSTR pszKeyName,
-IN PCTSTR pszValueName,
-IN DWORD dwValue);
+SaveSettingDword(IN LPCWSTR pszKeyName,
+                 IN LPCWSTR pszValueName,
+                 IN DWORD dwValue);
 
 /*
  * shellservice.cpp
@@ -311,9 +311,9 @@
 
 IMenuPopup*
 CreateStartMenu(IN ITrayWindow *Tray,
-OUT IMenuBand **ppMenuBand,
-IN HBITMAP hbmBanner  OPTIONAL,
-IN BOOL bSmallIcons);
+                OUT IMenuBand **ppMenuBand,
+                IN HBITMAP hbmBanner OPTIONAL,
+                IN BOOL bSmallIcons);
 
 /*
  * startmnucust.cpp

Modified: trunk/reactos/base/shell/explorer/rshell.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/rshell.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/rshell.cpp        [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/rshell.cpp        [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -34,7 +34,7 @@
     if (hRShell)
     {
         PSTARTMENU_CONSTRUCTOR func = 
(PSTARTMENU_CONSTRUCTOR)GetProcAddress(hRShell, "CStartMenu_Constructor");
-        if(func)
+        if (func)
         {
             return func(riid, ppv);
         }

Modified: trunk/reactos/base/shell/explorer/settings.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/settings.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/settings.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/settings.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -21,7 +21,7 @@
 #include "precomp.h"
 
 ADVANCED_SETTINGS AdvancedSettings;
-const WCHAR szAdvancedSettingsKey[] = 
TEXT("Software\\ReactOS\\Features\\Explorer");
+const WCHAR szAdvancedSettingsKey[] = L"Software\\ReactOS\\Features\\Explorer";
 
 VOID
 LoadAdvancedSettings(VOID)
@@ -32,12 +32,12 @@
     AdvancedSettings.bShowSeconds = FALSE;
 
     /* Check registry */
-    if (RegOpenKey(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == 
ERROR_SUCCESS)
+    if (RegOpenKeyW(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == 
ERROR_SUCCESS)
     {
         DWORD dwValue, dwValueLength, dwType;
 
         dwValueLength = sizeof(dwValue);
-        if (RegQueryValueEx(hKey, TEXT("ShowSeconds"), NULL, &dwType, 
(PBYTE)&dwValue, &dwValueLength) == ERROR_SUCCESS && dwType == REG_DWORD)
+        if (RegQueryValueExW(hKey, L"ShowSeconds", NULL, &dwType, 
(PBYTE)&dwValue, &dwValueLength) == ERROR_SUCCESS && dwType == REG_DWORD)
             AdvancedSettings.bShowSeconds = dwValue != 0;
 
         RegCloseKey(hKey);
@@ -45,16 +45,16 @@
 }
 
 BOOL
-SaveSettingDword(IN PCTSTR pszKeyName,
-                 IN PCTSTR pszValueName,
+SaveSettingDword(IN LPCWSTR pszKeyName,
+                 IN LPCWSTR pszValueName,
                  IN DWORD dwValue)
 {
     BOOL ret = FALSE;
     HKEY hKey;
 
-    if (RegCreateKey(HKEY_CURRENT_USER, pszKeyName, &hKey) == ERROR_SUCCESS)
+    if (RegCreateKeyW(HKEY_CURRENT_USER, pszKeyName, &hKey) == ERROR_SUCCESS)
     {
-        ret = RegSetValueEx(hKey, pszValueName, 0, REG_DWORD, (PBYTE)&dwValue, 
sizeof(dwValue)) == ERROR_SUCCESS;
+        ret = RegSetValueExW(hKey, pszValueName, 0, REG_DWORD, 
(PBYTE)&dwValue, sizeof(dwValue)) == ERROR_SUCCESS;
 
         RegCloseKey(hKey);
     }

Modified: trunk/reactos/base/shell/explorer/shellservice.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/shellservice.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/shellservice.cpp  [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/shellservice.cpp  [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -62,11 +62,11 @@
 
     TRACE("Enumerating Shell Service Ojbect GUIDs...\n");
 
-    if (RegOpenKey(HKEY_LOCAL_MACHINE,
+    if (RegOpenKeyW(HKEY_LOCAL_MACHINE,
         
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad",
         &hkey))
     {
-        ERR("RegOpenKey failed.\n");
+        ERR("RegOpenKeyW failed.\n");
         return HRESULT_FROM_WIN32(GetLastError());
     }
 

Modified: trunk/reactos/base/shell/explorer/startctxmnu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startctxmnu.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/startctxmnu.cpp   [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/startctxmnu.cpp   [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -70,10 +70,10 @@
         HRESULT hRet;
 
         /* Add the "Open All Users" menu item */
-        if (LoadString(hExplorerInstance,
-            IDS_PROPERTIES,
-            szBuf,
-            sizeof(szBuf) / sizeof(szBuf[0])))
+        if (LoadStringW(hExplorerInstance,
+                        IDS_PROPERTIES,
+                        szBuf,
+                        _countof(szBuf)))
         {
             AppendMenu(hPopup,
                        MF_STRING,
@@ -103,10 +103,10 @@
                                NULL);
 
                     /* Add the "Open All Users" menu item */
-                    if (LoadString(hExplorerInstance,
-                        IDS_OPEN_ALL_USERS,
-                        szBuf,
-                        sizeof(szBuf) / sizeof(szBuf[0])))
+                    if (LoadStringW(hExplorerInstance,
+                                    IDS_OPEN_ALL_USERS,
+                                    szBuf,
+                                    _countof(szBuf)))
                     {
                         AppendMenu(hPopup,
                                    MF_STRING,
@@ -115,10 +115,10 @@
                     }
 
                     /* Add the "Explore All Users" menu item */
-                    if (LoadString(hExplorerInstance,
-                        IDS_EXPLORE_ALL_USERS,
-                        szBuf,
-                        sizeof(szBuf) / sizeof(szBuf[0])))
+                    if (LoadStringW(hExplorerInstance,
+                                    IDS_EXPLORE_ALL_USERS,
+                                    szBuf,
+                                    _countof(szBuf)))
                     {
                         AppendMenu(hPopup,
                                    MF_STRING,
@@ -236,6 +236,7 @@
         COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
     END_COM_MAP()
 };
+
 HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * m_TrayWnd, IN HWND m_Owner, 
IContextMenu ** ppCtxMenu)
 {
     CStartMenuBtnCtxMenu * mnu = new CComObject<CStartMenuBtnCtxMenu>();

Modified: trunk/reactos/base/shell/explorer/startmnu.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startmnu.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/startmnu.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/startmnu.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -40,10 +40,10 @@
     return hRet;
 }
 
-IMenuPopup *
+IMenuPopup*
 CreateStartMenu(IN ITrayWindow *Tray,
                 OUT IMenuBand **ppMenuBand,
-                IN HBITMAP hbmBanner  OPTIONAL,
+                IN HBITMAP hbmBanner OPTIONAL,
                 IN BOOL bSmallIcons)
 {
     HRESULT hr;

Modified: trunk/reactos/base/shell/explorer/startmnucust.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startmnucust.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/startmnucust.cpp  [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/startmnucust.cpp  [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -21,14 +21,14 @@
 
 #include "precomp.h"
 
-VOID OnAddStartmenuItems(HWND hDlg)
+VOID OnAddStartMenuItems(HWND hDlg)
 {
     WCHAR szPath[MAX_PATH];
 
-    if(SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, szPath)))
+    if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, szPath)))
     {
         WCHAR szCommand[MAX_PATH] = L"appwiz.cpl,NewLinkHere ";
-        if(SUCCEEDED(StringCchCatW(szCommand, MAX_PATH, szPath)))
+        if (SUCCEEDED(StringCchCatW(szCommand, MAX_PATH, szPath)))
             ShellExecuteW(hDlg, L"open", L"rundll32.exe", szCommand, NULL, 
SW_SHOWNORMAL);
     }
 }
@@ -37,7 +37,7 @@
 {
     WCHAR szPath[MAX_PATH];
 
-    if(SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, szPath)))
+    if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_STARTMENU, NULL, 0, szPath)))
     {
         ShellExecuteW(NULL, L"explore", szPath, NULL, NULL, SW_SHOWNORMAL);
     }
@@ -46,19 +46,19 @@
 VOID OnClearRecentItems()
 {
    WCHAR szPath[MAX_PATH], szFile[MAX_PATH];
-   WIN32_FIND_DATA info;
+   WIN32_FIND_DATAW info;
    HANDLE hPath;
 
-    if(SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_RECENT, NULL, 0, szPath)))
+    if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_RECENT, NULL, 0, szPath)))
     {
-        StringCchPrintf(szFile,MAX_PATH, L"%s\\*.*", szPath);
+        StringCchPrintfW(szFile,MAX_PATH, L"%s\\*.*", szPath);
         hPath = FindFirstFileW(szFile, &info);
         do
         {
-            StringCchPrintf(szFile,MAX_PATH, L"%s\\%s", szPath, 
info.cFileName);
+            StringCchPrintfW(szFile,MAX_PATH, L"%s\\%s", szPath, 
info.cFileName);
             DeleteFileW(szFile);
-
-        }while(FindNextFileW(hPath, &info));
+        }
+        while (FindNextFileW(hPath, &info));
         FindClose(hPath);
         /* FIXME: Disable the button*/
     }
@@ -75,7 +75,7 @@
             switch(LOWORD(wParam))
             {
                 case IDC_CLASSICSTART_ADD:
-                    OnAddStartmenuItems(hwnd);
+                    OnAddStartMenuItems(hwnd);
                 break;
                 case IDC_CLASSICSTART_ADVANCED:
                     OnAdvancedStartMenuItems();
@@ -99,5 +99,5 @@
 
 VOID ShowCustomizeClassic(HINSTANCE hInst, HWND hExplorer)
 {
-     DialogBox(hInst, MAKEINTRESOURCE(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, 
CustomizeClassicProc);
+    DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, 
CustomizeClassicProc);
 }

Modified: trunk/reactos/base/shell/explorer/startmnusite.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startmnusite.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/startmnusite.cpp  [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/startmnusite.cpp  [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -123,8 +123,7 @@
 
         TRACE("ITrayPriv::AppendMenu\n");
 
-        hMenu = LoadPopupMenu(hExplorerInstance,
-                              MAKEINTRESOURCE(IDM_STARTMENU));
+        hMenu = LoadPopupMenu(hExplorerInstance, 
MAKEINTRESOURCEW(IDM_STARTMENU));
         *phMenu = hMenu;
         if (hMenu == NULL)
             return E_FAIL;
@@ -135,13 +134,13 @@
         bWantLogoff = (dwLogoff == 2 ||
                        SHRestricted(REST_FORCESTARTMENULOGOFF) ||
                        GetExplorerRegValueSet(HKEY_CURRENT_USER,
-                       TEXT("Advanced"),
-                       TEXT("StartMenuLogoff")));
+                                              L"Advanced",
+                                              L"StartMenuLogoff"));
 
         /* Favorites */
         if (!GetExplorerRegValueSet(HKEY_CURRENT_USER,
-            TEXT("Advanced"),
-            TEXT("StartMenuFavorites")))
+                                    L"Advanced",
+                                    L"StartMenuFavorites"))
         {
             DeleteMenu(hMenu,
                        IDM_FAVORITES,
@@ -243,8 +242,7 @@
                       or hide it, it might be hidden in too many cases!!! */
 
             /* Update Log Off menu item */
-            if (!GetCurrentLoggedOnUserName(szUser,
-                sizeof(szUser) / sizeof(szUser[0])))
+            if (!GetCurrentLoggedOnUserName(szUser, _countof(szUser)))
             {
                 szUser[0] = _T('\0');
             }

Modified: trunk/reactos/base/shell/explorer/startup.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startup.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/startup.cpp       [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/startup.cpp       [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -60,7 +60,7 @@
     DWORD exit_code = 0;
     WCHAR szCmdLineExp[MAX_PATH+1] = L"\0";
 
-    ExpandEnvironmentStringsW(cmdline, szCmdLineExp, sizeof(szCmdLineExp) / 
sizeof(WCHAR));
+    ExpandEnvironmentStringsW(cmdline, szCmdLineExp, _countof(szCmdLineExp));
 
     memset(&si, 0, sizeof(si));
     si.cb = sizeof(si);
@@ -123,7 +123,7 @@
                         &hkWin);
     if (res != ERROR_SUCCESS)
     {
-        TRACE("RegOpenKey failed on 
Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n", res);
+        TRACE("RegOpenKeyW failed on 
Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n", res);
 
         goto end;
     }
@@ -142,7 +142,7 @@
             res = ERROR_SUCCESS;
         }
         else
-            TRACE("RegOpenKeyEx failed on run key (%ld)\n", res);
+            TRACE("RegOpenKeyExW failed on run key (%ld)\n", res);
 
         goto end;
     }
@@ -271,7 +271,7 @@
     HKEY hSessionKey, hKey;
     HRESULT hr;
 
-    res = GetWindowsDirectoryW(gen_path, sizeof(gen_path) / 
sizeof(gen_path[0]));
+    res = GetWindowsDirectoryW(gen_path, _countof(gen_path));
     if (res == 0)
     {
         TRACE("Couldn't get the windows directory - error %lu\n", 
GetLastError());

Modified: trunk/reactos/base/shell/explorer/taskswnd.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskswnd.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/taskswnd.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskswnd.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -32,8 +32,8 @@
 #define MAX_TASKS_COUNT (0x7FFF)
 #define TASK_ITEM_ARRAY_ALLOC   64
 
-const WCHAR szTaskSwitchWndClass [] = TEXT("MSTaskSwWClass");
-const WCHAR szRunningApps [] = TEXT("Running Applications");
+const WCHAR szTaskSwitchWndClass[] = L"MSTaskSwWClass";
+const WCHAR szRunningApps[] = L"Running Applications";
 
 #if DEBUG_SHELL_HOOK
 const struct {
@@ -420,7 +420,7 @@
 
         icon = GetWndIcon(TaskItem->hWnd);
         if (!icon)
-            icon = static_cast<HICON>(LoadImage(NULL, 
MAKEINTRESOURCE(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
+            icon = static_cast<HICON>(LoadImageW(NULL, 
MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
         TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, 
TaskItem->IconIndex, icon);
         tbbi.iImage = TaskItem->IconIndex;
 
@@ -565,7 +565,7 @@
 
         icon = GetWndIcon(TaskItem->hWnd);
         if (!icon)
-            icon = static_cast<HICON>(LoadImage(NULL, 
MAKEINTRESOURCE(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
+            icon = static_cast<HICON>(LoadImageW(NULL, 
MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
         TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, -1, icon);
 
         tbBtn.iBitmap = TaskItem->IconIndex;
@@ -977,8 +977,7 @@
             TaskItem = AllocTaskItem();
             if (TaskItem != NULL)
             {
-                ZeroMemory(TaskItem,
-                    sizeof(*TaskItem));
+                ZeroMemory(TaskItem, sizeof(*TaskItem));
                 TaskItem->hWnd = hWnd;
                 TaskItem->Index = -1;
                 TaskItem->Group = AddToTaskGroup(hWnd);
@@ -1304,7 +1303,7 @@
         m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != 
NULL);
 
         /* Register the shell hook */
-        m_ShellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK"));
+        m_ShellHookMsg = RegisterWindowMessageW(L"SHELLHOOK");
 
         TRACE("ShellHookMsg got assigned number %d\n", m_ShellHookMsg);
 
@@ -1420,7 +1419,7 @@
         {
 #if DEBUG_SHELL_HOOK
             int i, found;
-            for (i = 0, found = 0; i != sizeof(hshell_msg) / 
sizeof(hshell_msg[0]); i++)
+            for (i = 0, found = 0; i != _countof(hshell_msg); i++)
             {
                 if (hshell_msg[i].msg == (INT) wParam)
                 {

Modified: trunk/reactos/base/shell/explorer/tbsite.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/tbsite.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/tbsite.cpp        [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/tbsite.cpp        [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -137,8 +137,7 @@
 
         /* Read the current position of the stream, we'll have to reset it 
everytime
            we read a CLSID that's not the task band... */
-        ZeroMemory(&liPosZero,
-            sizeof(liPosZero));
+        ZeroMemory(&liPosZero, sizeof(liPosZero));
         hRet = pStm->Seek(liPosZero, STREAM_SEEK_CUR, &liCurrent);
 
         if (SUCCEEDED(hRet))
@@ -564,14 +563,14 @@
         HKEY hkStreams;
         IStream *Stream = NULL;
 
-        if (RegCreateKey(hkExplorer,
-            TEXT("Streams"),
-            &hkStreams) == ERROR_SUCCESS)
-        {
-            Stream = SHOpenRegStream(hkStreams,
-                TEXT("Desktop"),
-                TEXT("TaskbarWinXP"),
-                grfMode);
+        if (RegCreateKeyW(hkExplorer,
+                          L"Streams",
+                          &hkStreams) == ERROR_SUCCESS)
+        {
+            Stream = SHOpenRegStreamW(hkStreams,
+                                      L"Desktop",
+                                      L"TaskbarWinXP",
+                                      grfMode);
 
             RegCloseKey(hkStreams);
         }
@@ -584,14 +583,14 @@
         HKEY hkStreams;
         IStream *Stream = NULL;
 
-        if (RegCreateKey(HKEY_LOCAL_MACHINE,
-            
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams"),
+        if (RegCreateKeyW(HKEY_LOCAL_MACHINE,
+            L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams",
             &hkStreams) == ERROR_SUCCESS)
         {
-            Stream = SHOpenRegStream(hkStreams,
-                TEXT("Desktop"),
-                TEXT("Default Taskbar"),
-                grfMode);
+            Stream = SHOpenRegStreamW(hkStreams,
+                                      L"Desktop",
+                                      L"Default Taskbar",
+                                      grfMode);
 
             RegCloseKey(hkStreams);
         }
@@ -752,10 +751,10 @@
         };
 /*******************************************************************/
 
-ITrayBandSite *
+ITrayBandSite*
 CreateTrayBandSite(IN OUT ITrayWindow *Tray,
-OUT HWND *phWndRebar,
-OUT HWND *phWndTaskSwitch)
+                   OUT HWND *phWndRebar,
+                   OUT HWND *phWndTaskSwitch)
 {
     HRESULT hr;
 

Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayntfy.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/trayntfy.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/trayntfy.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -26,7 +26,7 @@
 /*
  * SysPagerWnd
  */
-static const WCHAR szSysPagerWndClass [] = TEXT("SysPager");
+static const WCHAR szSysPagerWndClass [] = L"SysPager";
 
 // Data comes from shell32/systray.cpp -> TrayNotifyCDS_Dummy
 typedef struct _SYS_PAGER_COPY_DATA
@@ -86,7 +86,7 @@
     {
         TBBUTTON tbBtn;
         NOTIFYICONDATA * notifyItem;
-        WCHAR text [] = TEXT("");
+        WCHAR text[] = L"";
 
         int index = FindItemByIconData(iconData, &notifyItem);
         if (index >= 0)
@@ -450,10 +450,9 @@
         Toolbar.Initialize(m_hWnd);
 
         // Explicitly request running applications to re-register their 
systray icons
-        ::SendNotifyMessage(HWND_BROADCAST,
-                            RegisterWindowMessage(TEXT("TaskbarCreated")),
-                            0,
-                            0);
+        ::SendNotifyMessageW(HWND_BROADCAST,
+                             RegisterWindowMessageW(L"TaskbarCreated"),
+                             0, 0);
 
         return TRUE;
     }
@@ -626,7 +625,7 @@
  * TrayClockWnd
  */
 
-static const WCHAR szTrayClockWndClass [] = TEXT("TrayClockWClass");
+static const WCHAR szTrayClockWndClass[] = L"TrayClockWClass";
 
 #define ID_TRAYCLOCK_TIMER  0
 #define ID_TRAYCLOCK_TIMER_INIT 1
@@ -635,14 +634,14 @@
 {
     BOOL IsTime;
     DWORD dwFormatFlags;
-    LPCTSTR lpFormat;
+    LPCWSTR lpFormat;
 } ClockWndFormats [] = {
-        { TRUE, 0, NULL },
-        { FALSE, 0, TEXT("dddd") },
-        { FALSE, DATE_SHORTDATE, NULL }
+    { TRUE, 0, NULL },
+    { FALSE, 0, L"dddd" },
+    { FALSE, DATE_SHORTDATE, NULL }
 };
 
-#define CLOCKWND_FORMAT_COUNT (sizeof(ClockWndFormats) / 
sizeof(ClockWndFormats[0]))
+#define CLOCKWND_FORMAT_COUNT (_ARRAYSIZE(ClockWndFormats))
 
 #define TRAY_CLOCK_WND_SPACING_X    0
 #define TRAY_CLOCK_WND_SPACING_Y    0
@@ -687,7 +686,7 @@
         ZeroMemory(&LocalTime, sizeof(LocalTime));
         ZeroMemory(&CurrentSize, sizeof(CurrentSize));
         ZeroMemory(LineSizes, sizeof(LineSizes));
-        ZeroMemory(szLines, sizeof(LineSizes));
+        ZeroMemory(szLines, sizeof(szLines));
     }
     virtual ~CTrayClockWnd() { }
 
@@ -720,7 +719,7 @@
         {
             NONCLIENTMETRICS ncm = { 0 };
             ncm.cbSize = sizeof(ncm);
-            SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 
FALSE);
+            SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 
FALSE);
 
             hFont = CreateFontIndirectW(&ncm.lfMessageFont);
 
@@ -743,7 +742,7 @@
     {
         HDC hDC;
         HFONT hPrevFont;
-        INT c, i;
+        UINT c, i;
         BOOL bRet = TRUE;
 
         hDC = GetDC();
@@ -752,11 +751,11 @@
             if (hFont)
                 hPrevFont = (HFONT) SelectObject(hDC, hFont);
 
-            for (i = 0; i != CLOCKWND_FORMAT_COUNT && bRet; i++)
-            {
-                if (szLines[i][0] != TEXT('\0') &&
-                    !GetTextExtentPoint(hDC, szLines[i], _tcslen(szLines[i]),
-                    &LineSizes[i]))
+            for (i = 0; i < CLOCKWND_FORMAT_COUNT && bRet; i++)
+            {
+                if (szLines[i][0] != L'\0' &&
+                    !GetTextExtentPointW(hDC, szLines[i], wcslen(szLines[i]),
+                                         &LineSizes[i]))
                 {
                     bRet = FALSE;
                     break;
@@ -773,7 +772,7 @@
                 LineSpacing = 0;
 
                 /* calculate the line spacing */
-                for (i = 0, c = 0; i != CLOCKWND_FORMAT_COUNT; i++)
+                for (i = 0, c = 0; i < CLOCKWND_FORMAT_COUNT; i++)
                 {
                     if (LineSizes[i].cx > 0)
                     {
@@ -798,7 +797,7 @@
     WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
     {
         WORD iLinesVisible = 0;
-        INT i;
+        UINT i;
         SIZE szMax = { 0, 0 };
 
         if (!LinesMeasured)
@@ -807,9 +806,7 @@
         if (!LinesMeasured)
             return 0;
 
-        for (i = 0;
-            i != CLOCKWND_FORMAT_COUNT;
-            i++)
+        for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
         {
             if (LineSizes[i].cx != 0)
             {
@@ -851,23 +848,21 @@
     }
 
 
-    VOID        UpdateWnd()
+    VOID UpdateWnd()
     {
         SIZE szPrevCurrent;
-        INT BufSize, iRet, i;
+        UINT BufSize, i;
+        INT iRet;
         RECT rcClient;
 
-        ZeroMemory(LineSizes,
-            sizeof(LineSizes));
+        ZeroMemory(LineSizes, sizeof(LineSizes));
 
         szPrevCurrent = CurrentSize;
 
-        for (i = 0;
-            i != CLOCKWND_FORMAT_COUNT;
-            i++)
-        {
-            szLines[i][0] = TEXT('\0');
-            BufSize = sizeof(szLines[0]) / sizeof(szLines[0][0]);
+        for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
+        {
+            szLines[i][0] = L'\0';
+            BufSize = _countof(szLines[0]);
 
             if (ClockWndFormats[i].IsTime)
             {
@@ -931,13 +926,13 @@
         }
     }
 
-    VOID        Update()
+    VOID Update()
     {
         GetLocalTime(&LocalTime);
         UpdateWnd();
     }
 
-    UINT        CalculateDueTime()
+    UINT CalculateDueTime()
     {
         UINT uiDueTime;
 
@@ -961,7 +956,7 @@
         return uiDueTime;
     }
 
-    BOOL        ResetTime()
+    BOOL ResetTime()
     {
         UINT uiDueTime;
         BOOL Ret;
@@ -990,7 +985,7 @@
         return Ret;
     }
 
-    VOID        CalibrateTimer()
+    VOID CalibrateTimer()
     {
         UINT uiDueTime;
         BOOL Ret;
@@ -1052,7 +1047,8 @@
     {
         RECT rcClient;
         HFONT hPrevFont;
-        int iPrevBkMode, i, line;
+        INT iPrevBkMode;
+        UINT i, line;
 
         PAINTSTRUCT ps;
         HDC hDC = (HDC) wParam;
@@ -1080,8 +1076,8 @@
             rcClient.bottom = rcClient.top + CurrentSize.cy;
 
             for (i = 0, line = 0;
-                i != CLOCKWND_FORMAT_COUNT && line < VisibleLines;
-                i++)
+                 i < CLOCKWND_FORMAT_COUNT && line < VisibleLines;
+                 i++)
             {
                 if (LineSizes[i].cx != 0)
                 {
@@ -1090,7 +1086,7 @@
                         TRAY_CLOCK_WND_SPACING_X,
                         rcClient.top + TRAY_CLOCK_WND_SPACING_Y,
                         szLines[i],
-                        _tcslen(szLines[i]));
+                        wcslen(szLines[i]));
 
                     rcClient.top += LineSizes[i].cy + LineSpacing;
                     line++;

Modified: trunk/reactos/base/shell/explorer/trayprop.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayprop.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/trayprop.cpp      [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/trayprop.cpp      [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -64,23 +64,23 @@
         bHideInactive = (SendMessage(hwndHideInactive, BM_GETCHECK, 0, 0) == 
BST_CHECKED);
 
         if (bHide)
-            lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE);
+            lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_AUTOHIDE);
         else if (bLock  && bGroup  && bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_QL);
         else if (bLock  && !bGroup && !bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL);
         else if (bLock  && bGroup  && !bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_NOQL);
         else if (bLock  && !bGroup && bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_QL);
         else if (!bLock && !bGroup && !bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL);
         else if (!bLock && bGroup  && !bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL);
         else if (!bLock && !bGroup && bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL);
         else if (!bLock && bGroup  && bShowQL)
-            lpTaskBarImageName = 
MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL);
+            lpTaskBarImageName = 
MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_QL);
 
         
         if (lpTaskBarImageName)
@@ -90,7 +90,7 @@
                 DeleteObject(pPropInfo->hTaskbarBitmap);
             }
 
-            pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImage(hExplorerInstance,
+            pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
                                                   lpTaskBarImageName,
                                                   IMAGE_BITMAP,
                                                   0,
@@ -113,48 +113,48 @@
         if (bHideInactive)
         {
             EnableWindow(hwndAdvancedButton, TRUE);
-            if(bShowClock)
+            if (bShowClock)
             {
                 EnableWindow(hwndSeconds, TRUE);
-                if(bShowSeconds)
-                    lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_SECONDS);
+                if (bShowSeconds)
+                    lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_SECONDS);
                 else
-                    lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_CLOCK);
+                    lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_CLOCK);
             }
             else
             {
                 SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
                 EnableWindow(hwndSeconds, FALSE);
-                lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_NOCLOCK);
+                lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_NOCLOCK);
             }
         }
         else
         {
             EnableWindow(hwndAdvancedButton, FALSE);
-            if(bShowClock)
+            if (bShowClock)
             {
                 EnableWindow(hwndSeconds, TRUE);
-                if(bShowSeconds)
-                    lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_SECONDS);
+                if (bShowSeconds)
+                    lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_SECONDS);
                 else
-                    lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_CLOCK);
+                    lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_CLOCK);
             }
             else
             {
                 SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
                 EnableWindow(hwndSeconds, FALSE);
-                lpTrayImageName = 
MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_NOCLOCK);
+                lpTrayImageName = 
MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_NOCLOCK);
             }
         }
         
-        if(lpTrayImageName)
+        if (lpTrayImageName)
         {
             if (pPropInfo->hTrayBitmap)
             {
                 DeleteObject(pPropInfo->hTrayBitmap);
             }
 
-            pPropInfo->hTrayBitmap = (HBITMAP)LoadImage(hExplorerInstance,
+            pPropInfo->hTrayBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
                                                   lpTrayImageName,
                                                   IMAGE_BITMAP,
                                                   0,
@@ -328,11 +328,11 @@
                   DLGPROC DlgProc,
                   LPARAM lParam)
 {
-    ZeroMemory(psp, sizeof(PROPSHEETPAGE));
-    psp->dwSize = sizeof(PROPSHEETPAGE);
+    ZeroMemory(psp, sizeof(*psp));
+    psp->dwSize = sizeof(*psp);
     psp->dwFlags = PSP_DEFAULT;
     psp->hInstance = hExplorerInstance;
-    psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+    psp->pszTemplate = MAKEINTRESOURCEW(idDlg);
     psp->lParam = lParam;
     psp->pfnDlgProc = DlgProc;
 }
@@ -346,22 +346,22 @@
     PROPSHEETPAGE psp[2];
     WCHAR szCaption[256];
 
-    if (!LoadString(hExplorerInstance,
-                    IDS_TASKBAR_STARTMENU_PROP_CAPTION,
-                    szCaption,
-                    sizeof(szCaption) / sizeof(szCaption[0])))
+    if (!LoadStringW(hExplorerInstance,
+                     IDS_TASKBAR_STARTMENU_PROP_CAPTION,
+                     szCaption,
+                     _countof(szCaption)))
     {
         return;
     }
 
-    ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
-    psh.dwSize = sizeof(PROPSHEETHEADER);
+    ZeroMemory(&psh, sizeof(psh));
+    psh.dwSize = sizeof(psh);
     psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE;
     psh.hwndParent = hwndOwner;
     psh.hInstance = hExplorerInstance;
     psh.hIcon = NULL;
     psh.pszCaption = szCaption;
-    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+    psh.nPages = _countof(psp);
     psh.nStartPage = 0;
     psh.ppsp = psp;
 

Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/traywnd.cpp       [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/traywnd.cpp       [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -55,7 +55,7 @@
 
 static LONG TrayWndCount = 0;
 
-static const WCHAR szTrayWndClass [] = TEXT("Shell_TrayWnd");
+static const WCHAR szTrayWndClass[] = L"Shell_TrayWnd";
 
 /*
  * ITrayWindow
@@ -153,8 +153,8 @@
         IconSize.cy = GetSystemMetrics(SM_CYSMICON);
 
         /* Load the start button icon and create a image list for it */
-        hIconStart = (HICON) LoadImage(hExplorerInstance,
-                                       MAKEINTRESOURCE(IDI_START),
+        hIconStart = (HICON) LoadImageW(hExplorerInstance,
+                                       MAKEINTRESOURCEW(IDI_START),
                                        IMAGE_ICON,
                                        IconSize.cx,
                                        IconSize.cy,
@@ -200,10 +200,10 @@
         /* NOTE: this is the backwards compatibility code that is used if the
         Common Controls Version 6.0 are not available! */
 
-        if (!LoadString(hExplorerInstance,
-            IDS_START,
-            szStartCaption,
-            sizeof(szStartCaption) / sizeof(szStartCaption[0])))
+        if (!LoadStringW(hExplorerInstance,
+                         IDS_START,
+                         szStartCaption,
+                         _countof(szStartCaption)))
         {
             return NULL;
         }
@@ -211,8 +211,8 @@
         /* Load the start button icon */
         SmallIcon.cx = GetSystemMetrics(SM_CXSMICON);
         SmallIcon.cy = GetSystemMetrics(SM_CYSMICON);
-        hIconStart = (HICON) LoadImage(hExplorerInstance,
-                                       MAKEINTRESOURCE(IDI_START),
+        hIconStart = (HICON) LoadImageW(hExplorerInstance,
+                                       MAKEINTRESOURCEW(IDI_START),
                                        IMAGE_ICON,
                                        SmallIcon.cx,
                                        SmallIcon.cy,
@@ -230,7 +230,7 @@
 
         Ret = GetTextExtentPoint32(hDC,
                                    szStartCaption,
-                                   _tcslen(szStartCaption),
+                                   wcslen(szStartCaption),
                                    &Size);
 
         SelectObject(hDC, hFontOld);
@@ -304,7 +304,7 @@
         {
             /* Get the system fonts, we use the caption font, always bold, 
though. */
             ncm.cbSize = sizeof(ncm);
-            if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), 
&ncm, FALSE))
+            if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), 
&ncm, FALSE))
             {
                 ncm.lfCaptionFont.lfWeight = FW_BOLD;
                 m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
@@ -481,7 +481,7 @@
     {
         NONCLIENTMETRICS ncm;
         ncm.cbSize = sizeof(ncm);
-        if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 
0))
+        if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 
0))
         {
             if (m_Font != NULL)
                 DeleteObject(m_Font);
@@ -509,8 +509,7 @@
         HMONITOR hMon;
 
         mi.cbSize = sizeof(mi);
-        hMon = MonitorFromRect(pRect,
-                               dwFlags);
+        hMon = MonitorFromRect(pRect, dwFlags);
         if (hMon != NULL &&
             GetMonitorInfo(hMon,
             &mi))
@@ -568,8 +567,7 @@
             MONITORINFO mi;
 
             mi.cbSize = sizeof(mi);
-            if (!GetMonitorInfo(hMonitor,
-                &mi))
+            if (!GetMonitorInfo(hMonitor, &mi))
             {
                 /* Hm, the monitor is gone? Try to find a monitor where it
                    could be located now */
@@ -726,8 +724,7 @@
             MONITORINFO mi;
 
             mi.cbSize = sizeof(mi);
-            if (!GetMonitorInfo(hMon,
-                &mi))
+            if (!GetMonitorInfo(hMon, &mi))
             {
                 hMon = NULL;
                 goto GetPrimaryScreenRect;
@@ -993,7 +990,7 @@
         if (m_PreviousMonitor != m_Monitor)
         {
             GetScreenRect(m_PreviousMonitor, &rcWorkArea);
-            SystemParametersInfo(SPI_SETWORKAREA,
+            SystemParametersInfoW(SPI_SETWORKAREA,
                                  1,
                                  &rcWorkArea,
                                  SPIF_SENDCHANGE);
@@ -1025,7 +1022,7 @@
             }
         }
 
-        SystemParametersInfo(SPI_SETWORKAREA,
+        SystemParametersInfoW(SPI_SETWORKAREA,
                              1,
                              &rcWorkArea,
                              SPIF_SENDCHANGE);
@@ -1168,9 +1165,7 @@
         /* Calculate all docking rectangles. We need to do this here so they're
            initialized and dragging the tray window to another position gives
            usable results */
-        for (Pos = ABE_LEFT;
-             Pos <= ABE_BOTTOM;
-             Pos++)
+        for (Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++)
         {
             GetTrayRectFromScreenRect(
                 Pos,
@@ -1477,12 +1472,12 @@
 
         InterlockedIncrement(&TrayWndCount);
 
-        if (!LoadString(hExplorerInstance,
-            IDS_START,
-            szStartCaption,
-            sizeof(szStartCaption) / sizeof(szStartCaption[0])))
-        {
-            szStartCaption[0] = TEXT('\0');
+        if (!LoadStringW(hExplorerInstance,
+                         IDS_START,
+                         szStartCaption,
+                         _countof(szStartCaption)))
+        {
+            szStartCaption[0] = L'\0';
         }
 
         if (m_CaptionFont == NULL)
@@ -1492,7 +1487,7 @@
             /* Get the system fonts, we use the caption font,
                always bold, though. */
             ncm.cbSize = sizeof(ncm);
-            if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), 
&ncm, FALSE))
+            if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), 
&ncm, FALSE))
             {
                 if (m_CaptionFont == NULL)
                 {
@@ -1527,7 +1522,7 @@
         RegLoadSettings();
 
         /* Create and initialize the start menu */
-        HBITMAP hbmBanner = LoadBitmap(hExplorerInstance, 
MAKEINTRESOURCE(IDB_STARTMENU));
+        HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, 
MAKEINTRESOURCEW(IDB_STARTMENU));
         m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 
0);
 
         /* Load the tray band site */
@@ -2408,8 +2403,7 @@
                 SC_MINIMIZE,
             };
             HMENU hSysMenu;
-            INT i;
-            UINT uId;
+            UINT i, uId;
 
             /* temporarily enable the system menu */
             SetWindowStyle(m_hWnd, WS_SYSMENU, WS_SYSMENU);
@@ -2418,7 +2412,7 @@
             if (hSysMenu != NULL)
             {
                 /* Disable all items that are not relevant */
-                for (i = 0; i != sizeof(uidDisableItem) / 
sizeof(uidDisableItem[0]); i++)
+                for (i = 0; i < _countof(uidDisableItem); i++)
                 {
                     EnableMenuItem(hSysMenu,
                                    uidDisableItem[i],
@@ -2646,10 +2640,10 @@
         WCHAR szCommand[256];
         WCHAR *pszParameters;
 
-        if (!LoadString(hExplorerInstance,
-                        id,
-                        szCommand,
-                        sizeof(szCommand) / sizeof(szCommand[0])))
+        if (!LoadStringW(hExplorerInstance,
+                         id,
+                         szCommand,
+                         _countof(szCommand)))
         {
             return E_FAIL;
         }
@@ -3012,7 +3006,7 @@
                          UINT idCmdLast,
                          UINT uFlags)
     {
-        HMENU menubase = LoadPopupMenu(hExplorerInstance, 
MAKEINTRESOURCE(IDM_TRAYWND));
+        HMENU menubase = LoadPopupMenu(hExplorerInstance, 
MAKEINTRESOURCEW(IDM_TRAYWND));
 
         if (!menubase)
             return HRESULT_FROM_WIN32(GetLastError());
@@ -3084,7 +3078,7 @@
                     /* Setup and invoke the shell command */
                     cmici.cbSize = sizeof(cmici);
                     cmici.hwnd = hWndOwner;
-                    cmici.lpVerb = (LPCSTR) MAKEINTRESOURCE(uiCmdId - 
ID_SHELL_CMD_FIRST);
+                    cmici.lpVerb = (LPCSTR) MAKEINTRESOURCEW(uiCmdId - 
ID_SHELL_CMD_FIRST);
                     cmici.nShow = SW_NORMAL;
 
                     pcm->InvokeCommand(&cmici);

Modified: trunk/reactos/base/shell/explorer/util.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/util.cpp?rev=71512&r1=71511&r2=71512&view=diff
==============================================================================
--- trunk/reactos/base/shell/explorer/util.cpp  [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/util.cpp  [iso-8859-1] Sat Jun  4 
14:09:20 2016
@@ -13,7 +13,6 @@
     HRESULT hRet;
 
     hRet = punk1->QueryInterface(IID_PPV_ARG(IUnknown, &punk1));
-
     if (!SUCCEEDED(hRet))
         return hRet;
 
@@ -32,21 +31,16 @@
 
 HMENU
 LoadPopupMenu(IN HINSTANCE hInstance,
-              IN LPCTSTR lpMenuName)
+              IN LPCWSTR lpMenuName)
 {
     HMENU hMenu, hSubMenu = NULL;
 
-    hMenu = LoadMenu(hInstance,
-                     lpMenuName);
-
+    hMenu = LoadMenuW(hInstance, lpMenuName);
     if (hMenu != NULL)
     {
-        hSubMenu = GetSubMenu(hMenu,
-                              0);
-        if (hSubMenu != NULL &&
-            !RemoveMenu(hMenu,
-            0,
-            MF_BYPOSITION))
+        hSubMenu = GetSubMenu(hMenu, 0);
+        if ((hSubMenu != NULL) &&
+            !RemoveMenu(hMenu, 0, MF_BYPOSITION))
         {
             hSubMenu = NULL;
         }
@@ -62,15 +56,12 @@
             IN UINT uItem,
             IN BOOL fByPosition)
 {
-    MENUITEMINFO mii;
+    MENUITEMINFOW mii;
 
     mii.cbSize = sizeof(mii);
     mii.fMask = MIIM_SUBMENU;
 
-    if (GetMenuItemInfo(hMenu,
-        uItem,
-        fByPosition,
-        &mii))
+    if (GetMenuItemInfoW(hMenu, uItem, fByPosition, &mii))
     {
         return mii.hSubMenu;
     }
@@ -79,7 +70,7 @@
 }
 
 BOOL
-GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer,
+GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer,
                            IN DWORD dwBufferSize)
 {
     DWORD dwType;
@@ -87,25 +78,24 @@
 
     /* Query the user name from the registry */
     dwSize = (dwBufferSize * sizeof(WCHAR)) - 1;
-    if (RegQueryValueEx(hkExplorer,
-        TEXT("Logon User Name"),
-        0,
-        &dwType,
-        (LPBYTE) szBuffer,
-        &dwSize) == ERROR_SUCCESS &&
+    if (RegQueryValueExW(hkExplorer,
+                         L"Logon User Name",
+                         0,
+                         &dwType,
+                         (LPBYTE)szBuffer,
+                         &dwSize) == ERROR_SUCCESS &&
         (dwSize / sizeof(WCHAR)) > 1 &&
-        szBuffer[0] != _T('\0'))
-    {
-        szBuffer[dwSize / sizeof(WCHAR)] = _T('\0');
+        szBuffer[0] != L'\0')
+    {
+        szBuffer[dwSize / sizeof(WCHAR)] = L'\0';
         return TRUE;
     }
 
     /* Fall back to GetUserName() */
     dwSize = dwBufferSize;
-    if (!GetUserName(szBuffer,
-        &dwSize))
-    {
-        szBuffer[0] = _T('\0');
+    if (!GetUserNameW(szBuffer, &dwSize))
+    {
+        szBuffer[0] = L'\0';
         return FALSE;
     }
 
@@ -116,38 +106,32 @@
 FormatMenuString(IN HMENU hMenu,
                  IN UINT uPosition,
                  IN UINT uFlags,
-...)
+                 ...)
 {
     va_list vl;
-    MENUITEMINFO mii;
+    MENUITEMINFOW mii;
     WCHAR szBuf[128];
     WCHAR szBufFmt[128];
 
     /* Find the menu item and read the formatting string */
     mii.cbSize = sizeof(mii);
     mii.fMask = MIIM_STRING;
-    mii.dwTypeData = (LPTSTR) szBufFmt;
-    mii.cch = sizeof(szBufFmt) / sizeof(szBufFmt[0]);
-    if (GetMenuItemInfo(hMenu,
-        uPosition,
-        uFlags,
-        &mii))
+    mii.dwTypeData = szBufFmt;
+    mii.cch = _countof(szBufFmt);
+    if (GetMenuItemInfoW(hMenu, uPosition, uFlags, &mii))
     {
         /* Format the string */
         va_start(vl, uFlags);
         _vsntprintf(szBuf,
-                    (sizeof(szBuf) / sizeof(szBuf[0])) - 1,
+                    _countof(szBuf) - 1,
                     szBufFmt,
                     vl);
         va_end(vl);
-        szBuf[(sizeof(szBuf) / sizeof(szBuf[0])) - 1] = _T('\0');
+        szBuf[_countof(szBuf) - 1] = L'\0';
 
         /* Update the menu item */
-        mii.dwTypeData = (LPTSTR) szBuf;
-        if (SetMenuItemInfo(hMenu,
-            uPosition,
-            uFlags,
-            &mii))
+        mii.dwTypeData = szBuf;
+        if (SetMenuItemInfo(hMenu, uPosition, uFlags, &mii))
         {
             return TRUE;
         }
@@ -158,44 +142,41 @@
 
 BOOL
 GetExplorerRegValueSet(IN HKEY hKey,
-                       IN LPCTSTR lpSubKey,
-                       IN LPCTSTR lpValue)
+                       IN LPCWSTR lpSubKey,
+                       IN LPCWSTR lpValue)
 {
     WCHAR szBuffer[MAX_PATH];
     HKEY hkSubKey;
     DWORD dwType, dwSize;
     BOOL Ret = FALSE;
 
-    StringCbCopy(szBuffer, sizeof(szBuffer),
-                 
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"));
-    if (FAILED_UNEXPECTEDLY(StringCbCat(szBuffer, sizeof(szBuffer),
-        _T("\\"))))
+    StringCbCopyW(szBuffer, sizeof(szBuffer),
+                  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer");
+    if (FAILED_UNEXPECTEDLY(StringCbCatW(szBuffer, sizeof(szBuffer), L"\\")))
         return FALSE;
-    if (FAILED_UNEXPECTEDLY(StringCbCat(szBuffer, sizeof(szBuffer),
-        lpSubKey)))
+    if (FAILED_UNEXPECTEDLY(StringCbCatW(szBuffer, sizeof(szBuffer), 
lpSubKey)))
         return FALSE;
 
     dwSize = sizeof(szBuffer);
-    if (RegOpenKeyEx(hKey,
-        szBuffer,
-        0,
-        KEY_QUERY_VALUE,
-        &hkSubKey) == ERROR_SUCCESS)
-    {
-        ZeroMemory(szBuffer,
-                   sizeof(szBuffer));
-
-        if (RegQueryValueEx(hkSubKey,
-            lpValue,
-            0,
-            &dwType,
-            (LPBYTE) szBuffer,
-            &dwSize) == ERROR_SUCCESS)
-        {
-            if (dwType == REG_DWORD && dwSize == sizeof(DWORD))
-                Ret = *((PDWORD) szBuffer) != 0;
+    if (RegOpenKeyExW(hKey,
+                      szBuffer,
+                      0,
+                      KEY_QUERY_VALUE,
+                      &hkSubKey) == ERROR_SUCCESS)
+    {
+        ZeroMemory(szBuffer, sizeof(szBuffer));
+
+        if (RegQueryValueExW(hkSubKey,
+                             lpValue,
+                             0,
+                             &dwType,
+                             (LPBYTE)szBuffer,
+                             &dwSize) == ERROR_SUCCESS)
+        {
+            if ((dwType == REG_DWORD) && (dwSize == sizeof(DWORD)))
+                Ret = *((PDWORD)szBuffer) != 0;
             else if (dwSize > 0)
-                Ret = *((PCHAR) szBuffer) != 0;
+                Ret = *((PWCHAR)szBuffer) != 0;
         }
 
         RegCloseKey(hkSubKey);
@@ -204,10 +185,10 @@
 }
 
 BOOL
-GetVersionInfoString(IN WCHAR *szFileName,
-IN WCHAR *szVersionInfo,
-OUT WCHAR *szBuffer,
-IN UINT cbBufLen)
+GetVersionInfoString(IN LPCWSTR szFileName,
+                     IN LPCWSTR szVersionInfo,
+                     OUT LPWSTR szBuffer,
+                     IN UINT cbBufLen)
 {
     LPVOID lpData = NULL;
     WCHAR szSubBlock[128];
@@ -219,9 +200,9 @@
     UINT cbTranslate;
     UINT cbLen;
     BOOL bRet = FALSE;
-    unsigned int i;
-
-    dwLen = GetFileVersionInfoSize(szFileName, &dwHandle);
+    UINT i;
+
+    dwLen = GetFileVersionInfoSizeW(szFileName, &dwHandle);
 
     if (dwLen > 0)
     {
@@ -229,17 +210,17 @@
 
         if (lpData != NULL)
         {
-            if (GetFileVersionInfo(szFileName,
-                0,
-                dwLen,
-                lpData) != 0)
+            if (GetFileVersionInfoW(szFileName,
+                                    0,
+                                    dwLen,
+                                    lpData) != 0)
             {
                 UserLangId = GetUserDefaultLangID();
 
-                VerQueryValue(lpData,
-                              TEXT("\\VarFileInfo\\Translation"),
-                              (LPVOID *) &lpTranslate,
-                              &cbTranslate);
+                VerQueryValueW(lpData,
+                               L"\\VarFileInfo\\Translation",
+                               (LPVOID*)&lpTranslate,
+                               &cbTranslate);
 
                 for (i = 0; i < cbTranslate / sizeof(LANGCODEPAGE); i++)
                 {
@@ -247,22 +228,21 @@
                     match, use this version information (since this
                     means that the version information and the users
                     default language are the same). */
-                    if ((lpTranslate[i].wLanguage & 0xFF) ==
-                        (UserLangId & 0xFF))
+                    if (LOBYTE(lpTranslate[i].wLanguage) == LOBYTE(UserLangId))
                     {
                         wnsprintf(szSubBlock,
-                                  sizeof(szSubBlock) / sizeof(szSubBlock[0]),
-                                  TEXT("\\StringFileInfo\\%04X%04X\\%s"),
+                                  _countof(szSubBlock),
+                                  L"\\StringFileInfo\\%04X%04X\\%s",
                                   lpTranslate[i].wLanguage,
                                   lpTranslate[i].wCodePage,
                                   szVersionInfo);
 
-                        if (VerQueryValue(lpData,
-                            szSubBlock,
-                            (LPVOID *) &lpszLocalBuf,
-                            &cbLen) != 0)
+                        if (VerQueryValueW(lpData,
+                                           szSubBlock,
+                                           (LPVOID*)&lpszLocalBuf,
+                                           &cbLen) != 0)
                         {
-                            _tcsncpy(szBuffer, lpszLocalBuf, cbBufLen / 
sizeof(*szBuffer));
+                            wcsncpy(szBuffer, lpszLocalBuf, cbBufLen / 
sizeof(*szBuffer));
 
                             bRet = TRUE;
                             break;
@@ -270,6 +250,7 @@
                     }
                 }
             }
+
             HeapFree(hProcessHeap, 0, lpData);
             lpData = NULL;
         }


Reply via email to