diff --git a/reactos/base/shell/explorer/desktop.cpp b/reactos/base/shell/explorer/desktop.cpp index 06628b83fd0..94a30ea4cd7 100644 --- a/reactos/base/shell/explorer/desktop.cpp +++ b/reactos/base/shell/explorer/desktop.cpp @@ -75,7 +75,7 @@ public: 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 @@ DesktopCreateWindow(IN OUT ITrayWindow *Tray) CDesktopThread* pDesktopThread = new CDesktopThread(); HRESULT hres = pDesktopThread->Initialize(Tray); - if(FAILED_UNEXPECTEDLY(hres)) + if (FAILED_UNEXPECTEDLY(hres)) { delete pDesktopThread; return NULL; diff --git a/reactos/base/shell/explorer/explorer.cpp b/reactos/base/shell/explorer/explorer.cpp index af1468aea0d..5e654d199f3 100644 --- a/reactos/base/shell/explorer/explorer.cpp +++ b/reactos/base/shell/explorer/explorer.cpp @@ -55,11 +55,11 @@ static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize) #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 @@ HideMinimizedWindows(IN BOOL bHide) MINIMIZEDMETRICS mm; mm.cbSize = sizeof(mm); - if (!SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0)) + if (!SystemParametersInfoW(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0)) { - ERR("SystemParametersInfo failed with %lu\n", GetLastError()); + 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 @@ StartWithDesktop(IN HINSTANCE hInstance) { 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 @@ StartWithDesktop(IN HINSTANCE hInstance) 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) diff --git a/reactos/base/shell/explorer/notifyiconscust.cpp b/reactos/base/shell/explorer/notifyiconscust.cpp index d57703a2ef3..b7adccb35ab 100644 --- a/reactos/base/shell/explorer/notifyiconscust.cpp +++ b/reactos/base/shell/explorer/notifyiconscust.cpp @@ -46,5 +46,5 @@ INT_PTR CALLBACK CustomizeNotifyIconsProc(HWND hwnd, UINT Message, WPARAM wParam VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer) { - DialogBox(hInst, MAKEINTRESOURCE(IDD_NOTIFICATIONS_CUSTOMIZE), hExplorer, CustomizeNotifyIconsProc); + DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_NOTIFICATIONS_CUSTOMIZE), hExplorer, CustomizeNotifyIconsProc); } \ No newline at end of file diff --git a/reactos/base/shell/explorer/precomp.h b/reactos/base/shell/explorer/precomp.h index 2e1fbadd77c..2b0d8bdfc90 100644 --- a/reactos/base/shell/explorer/precomp.h +++ b/reactos/base/shell/explorer/precomp.h @@ -65,8 +65,8 @@ extern HKEY hkExplorer; 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 @@ IN LONG dwStyle) 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); + IN UINT uItem, + IN BOOL fByPosition); BOOL -GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer, -IN DWORD dwBufferSize); +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 @@ VOID 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 @@ HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, ICo 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 diff --git a/reactos/base/shell/explorer/rshell.cpp b/reactos/base/shell/explorer/rshell.cpp index 9e35490cb3c..3690bbfcbc6 100644 --- a/reactos/base/shell/explorer/rshell.cpp +++ b/reactos/base/shell/explorer/rshell.cpp @@ -34,7 +34,7 @@ HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv) if (hRShell) { PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(hRShell, "CStartMenu_Constructor"); - if(func) + if (func) { return func(riid, ppv); } diff --git a/reactos/base/shell/explorer/settings.cpp b/reactos/base/shell/explorer/settings.cpp index 149645717ae..b5cafb106ca 100644 --- a/reactos/base/shell/explorer/settings.cpp +++ b/reactos/base/shell/explorer/settings.cpp @@ -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 @@ LoadAdvancedSettings(VOID) 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 @@ LoadAdvancedSettings(VOID) } 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); } diff --git a/reactos/base/shell/explorer/shellservice.cpp b/reactos/base/shell/explorer/shellservice.cpp index de1e30fe639..cda6ed7629d 100644 --- a/reactos/base/shell/explorer/shellservice.cpp +++ b/reactos/base/shell/explorer/shellservice.cpp @@ -62,11 +62,11 @@ HRESULT InitShellServices(HDPA * phdpa) 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()); } diff --git a/reactos/base/shell/explorer/startctxmnu.cpp b/reactos/base/shell/explorer/startctxmnu.cpp index 071fc541d9f..8e7e454a085 100644 --- a/reactos/base/shell/explorer/startctxmnu.cpp +++ b/reactos/base/shell/explorer/startctxmnu.cpp @@ -70,10 +70,10 @@ class CStartMenuBtnCtxMenu : 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 @@ class CStartMenuBtnCtxMenu : 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 @@ class CStartMenuBtnCtxMenu : } /* 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 @@ public: 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(); diff --git a/reactos/base/shell/explorer/startmnu.cpp b/reactos/base/shell/explorer/startmnu.cpp index ca6c6b86c05..25969e7681c 100644 --- a/reactos/base/shell/explorer/startmnu.cpp +++ b/reactos/base/shell/explorer/startmnu.cpp @@ -40,10 +40,10 @@ UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, return hRet; } -IMenuPopup * +IMenuPopup* CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, - IN HBITMAP hbmBanner OPTIONAL, + IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons) { HRESULT hr; diff --git a/reactos/base/shell/explorer/startmnucust.cpp b/reactos/base/shell/explorer/startmnucust.cpp index bbb458c07fb..7343b5c143f 100644 --- a/reactos/base/shell/explorer/startmnucust.cpp +++ b/reactos/base/shell/explorer/startmnucust.cpp @@ -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 @@ VOID OnAdvancedStartMenuItems() { 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 OnAdvancedStartMenuItems() 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 @@ INT_PTR CALLBACK CustomizeClassicProc(HWND hwnd, UINT Message, WPARAM wParam, LP switch(LOWORD(wParam)) { case IDC_CLASSICSTART_ADD: - OnAddStartmenuItems(hwnd); + OnAddStartMenuItems(hwnd); break; case IDC_CLASSICSTART_ADVANCED: OnAdvancedStartMenuItems(); @@ -99,5 +99,5 @@ INT_PTR CALLBACK CustomizeClassicProc(HWND hwnd, UINT Message, WPARAM wParam, LP VOID ShowCustomizeClassic(HINSTANCE hInst, HWND hExplorer) { - DialogBox(hInst, MAKEINTRESOURCE(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, CustomizeClassicProc); + DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, CustomizeClassicProc); } diff --git a/reactos/base/shell/explorer/startmnusite.cpp b/reactos/base/shell/explorer/startmnusite.cpp index 52c47d7aa35..1e36125517c 100644 --- a/reactos/base/shell/explorer/startmnusite.cpp +++ b/reactos/base/shell/explorer/startmnusite.cpp @@ -123,8 +123,7 @@ public: 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 @@ public: 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 @@ public: 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'); } diff --git a/reactos/base/shell/explorer/startup.cpp b/reactos/base/shell/explorer/startup.cpp index 0448ef2d9cc..ab7a478a327 100644 --- a/reactos/base/shell/explorer/startup.cpp +++ b/reactos/base/shell/explorer/startup.cpp @@ -60,7 +60,7 @@ static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized) 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 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete, &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 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete, 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 @@ ProcessStartupItems(VOID) 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()); diff --git a/reactos/base/shell/explorer/taskswnd.cpp b/reactos/base/shell/explorer/taskswnd.cpp index 073fcb255a9..118b76d0286 100644 --- a/reactos/base/shell/explorer/taskswnd.cpp +++ b/reactos/base/shell/explorer/taskswnd.cpp @@ -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 @@ public: icon = GetWndIcon(TaskItem->hWnd); if (!icon) - icon = static_cast(LoadImage(NULL, MAKEINTRESOURCE(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); + icon = static_cast(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 @@ public: icon = GetWndIcon(TaskItem->hWnd); if (!icon) - icon = static_cast(LoadImage(NULL, MAKEINTRESOURCE(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); + icon = static_cast(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 @@ public: 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 @@ public: 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 @@ public: { #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) { diff --git a/reactos/base/shell/explorer/tbsite.cpp b/reactos/base/shell/explorer/tbsite.cpp index 93e38a7085a..2e7be35f0c9 100644 --- a/reactos/base/shell/explorer/tbsite.cpp +++ b/reactos/base/shell/explorer/tbsite.cpp @@ -137,8 +137,7 @@ public: /* 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 @@ public: HKEY hkStreams; IStream *Stream = NULL; - if (RegCreateKey(hkExplorer, - TEXT("Streams"), - &hkStreams) == ERROR_SUCCESS) + if (RegCreateKeyW(hkExplorer, + L"Streams", + &hkStreams) == ERROR_SUCCESS) { - Stream = SHOpenRegStream(hkStreams, - TEXT("Desktop"), - TEXT("TaskbarWinXP"), - grfMode); + Stream = SHOpenRegStreamW(hkStreams, + L"Desktop", + L"TaskbarWinXP", + grfMode); RegCloseKey(hkStreams); } @@ -584,14 +583,14 @@ public: 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 @@ public: }; /*******************************************************************/ -ITrayBandSite * +ITrayBandSite* CreateTrayBandSite(IN OUT ITrayWindow *Tray, -OUT HWND *phWndRebar, -OUT HWND *phWndTaskSwitch) + OUT HWND *phWndRebar, + OUT HWND *phWndTaskSwitch) { HRESULT hr; diff --git a/reactos/base/shell/explorer/trayntfy.cpp b/reactos/base/shell/explorer/trayntfy.cpp index 8e6453f4348..14038fb83f1 100644 --- a/reactos/base/shell/explorer/trayntfy.cpp +++ b/reactos/base/shell/explorer/trayntfy.cpp @@ -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 @@ public: { TBBUTTON tbBtn; NOTIFYICONDATA * notifyItem; - WCHAR text [] = TEXT(""); + WCHAR text[] = L""; int index = FindItemByIconData(iconData, ¬ifyItem); if (index >= 0) @@ -450,10 +450,9 @@ public: 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 @@ public: * 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 @@ static const struct { 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 @@ public: 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 @@ public: { 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 @@ public: { HDC hDC; HFONT hPrevFont; - INT c, i; + UINT c, i; BOOL bRet = TRUE; hDC = GetDC(); @@ -752,11 +751,11 @@ public: if (hFont) hPrevFont = (HFONT) SelectObject(hDC, hFont); - for (i = 0; i != CLOCKWND_FORMAT_COUNT && bRet; i++) + for (i = 0; i < CLOCKWND_FORMAT_COUNT && bRet; i++) { - if (szLines[i][0] != TEXT('\0') && - !GetTextExtentPoint(hDC, szLines[i], _tcslen(szLines[i]), - &LineSizes[i])) + if (szLines[i][0] != L'\0' && + !GetTextExtentPointW(hDC, szLines[i], wcslen(szLines[i]), + &LineSizes[i])) { bRet = FALSE; break; @@ -773,7 +772,7 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: } - 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++) + for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++) { - szLines[i][0] = TEXT('\0'); - BufSize = sizeof(szLines[0]) / sizeof(szLines[0][0]); + szLines[i][0] = L'\0'; + BufSize = _countof(szLines[0]); if (ClockWndFormats[i].IsTime) { @@ -931,13 +926,13 @@ public: } } - VOID Update() + VOID Update() { GetLocalTime(&LocalTime); UpdateWnd(); } - UINT CalculateDueTime() + UINT CalculateDueTime() { UINT uiDueTime; @@ -961,7 +956,7 @@ public: return uiDueTime; } - BOOL ResetTime() + BOOL ResetTime() { UINT uiDueTime; BOOL Ret; @@ -990,7 +985,7 @@ public: return Ret; } - VOID CalibrateTimer() + VOID CalibrateTimer() { UINT uiDueTime; BOOL Ret; @@ -1052,7 +1047,8 @@ public: { RECT rcClient; HFONT hPrevFont; - int iPrevBkMode, i, line; + INT iPrevBkMode; + UINT i, line; PAINTSTRUCT ps; HDC hDC = (HDC) wParam; @@ -1080,8 +1076,8 @@ public: 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 @@ public: 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++; diff --git a/reactos/base/shell/explorer/trayprop.cpp b/reactos/base/shell/explorer/trayprop.cpp index 9a842bd217c..125896f2aeb 100644 --- a/reactos/base/shell/explorer/trayprop.cpp +++ b/reactos/base/shell/explorer/trayprop.cpp @@ -64,23 +64,23 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) 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 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) DeleteObject(pPropInfo->hTaskbarBitmap); } - pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImage(hExplorerInstance, + pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImageW(hExplorerInstance, lpTaskBarImageName, IMAGE_BITMAP, 0, @@ -113,48 +113,48 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) 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 @@ InitPropSheetPage(PROPSHEETPAGE *psp, 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 @@ DisplayTrayProperties(IN HWND hwndOwner) 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; diff --git a/reactos/base/shell/explorer/traywnd.cpp b/reactos/base/shell/explorer/traywnd.cpp index ac953e48138..84d3d52d7c7 100644 --- a/reactos/base/shell/explorer/traywnd.cpp +++ b/reactos/base/shell/explorer/traywnd.cpp @@ -55,7 +55,7 @@ HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, ICont static LONG TrayWndCount = 0; -static const WCHAR szTrayWndClass [] = TEXT("Shell_TrayWnd"); +static const WCHAR szTrayWndClass[] = L"Shell_TrayWnd"; /* * ITrayWindow @@ -153,8 +153,8 @@ DefSize: 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 @@ DefSize: /* 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 @@ DefSize: /* 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 @@ DefSize: Ret = GetTextExtentPoint32(hDC, szStartCaption, - _tcslen(szStartCaption), + wcslen(szStartCaption), &Size); SelectObject(hDC, hFontOld); @@ -304,7 +304,7 @@ Cleanup: { /* 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 @@ public: { 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 @@ public: HMONITOR hMon; mi.cbSize = sizeof(mi); - hMon = MonitorFromRect(pRect, - dwFlags); + hMon = MonitorFromRect(pRect, dwFlags); if (hMon != NULL && GetMonitorInfo(hMon, &mi)) @@ -568,8 +567,7 @@ public: 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 @@ GetPrimaryRect: MONITORINFO mi; mi.cbSize = sizeof(mi); - if (!GetMonitorInfo(hMon, - &mi)) + if (!GetMonitorInfo(hMon, &mi)) { hMon = NULL; goto GetPrimaryScreenRect; @@ -993,7 +990,7 @@ ChangePos: if (m_PreviousMonitor != m_Monitor) { GetScreenRect(m_PreviousMonitor, &rcWorkArea); - SystemParametersInfo(SPI_SETWORKAREA, + SystemParametersInfoW(SPI_SETWORKAREA, 1, &rcWorkArea, SPIF_SENDCHANGE); @@ -1025,7 +1022,7 @@ ChangePos: } } - SystemParametersInfo(SPI_SETWORKAREA, + SystemParametersInfoW(SPI_SETWORKAREA, 1, &rcWorkArea, SPIF_SENDCHANGE); @@ -1168,9 +1165,7 @@ ChangePos: /* 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 @@ ChangePos: InterlockedIncrement(&TrayWndCount); - if (!LoadString(hExplorerInstance, - IDS_START, - szStartCaption, - sizeof(szStartCaption) / sizeof(szStartCaption[0]))) + if (!LoadStringW(hExplorerInstance, + IDS_START, + szStartCaption, + _countof(szStartCaption))) { - szStartCaption[0] = TEXT('\0'); + szStartCaption[0] = L'\0'; } if (m_CaptionFont == NULL) @@ -1492,7 +1487,7 @@ ChangePos: /* 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 @@ ChangePos: 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 @@ ChangePos: 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 @@ ChangePos: 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 @@ HandleTrayContextMenu: 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 @@ public: 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 @@ public: /* 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); diff --git a/reactos/base/shell/explorer/util.cpp b/reactos/base/shell/explorer/util.cpp index 543df9f678f..01b234baefe 100644 --- a/reactos/base/shell/explorer/util.cpp +++ b/reactos/base/shell/explorer/util.cpp @@ -13,7 +13,6 @@ IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2) HRESULT hRet; hRet = punk1->QueryInterface(IID_PPV_ARG(IUnknown, &punk1)); - if (!SUCCEEDED(hRet)) return hRet; @@ -32,21 +31,16 @@ IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2) 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 @@ FindSubMenu(IN HMENU hMenu, 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 @@ FindSubMenu(IN HMENU hMenu, } BOOL -GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer, +GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer, IN DWORD dwBufferSize) { DWORD dwType; @@ -87,25 +78,24 @@ GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer, /* 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[0] != L'\0') { - szBuffer[dwSize / sizeof(WCHAR)] = _T('\0'); + szBuffer[dwSize / sizeof(WCHAR)] = L'\0'; return TRUE; } /* Fall back to GetUserName() */ dwSize = dwBufferSize; - if (!GetUserName(szBuffer, - &dwSize)) + if (!GetUserNameW(szBuffer, &dwSize)) { - szBuffer[0] = _T('\0'); + szBuffer[0] = L'\0'; return FALSE; } @@ -116,38 +106,32 @@ BOOL 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 @@ FormatMenuString(IN HMENU hMenu, 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) + if (RegOpenKeyExW(hKey, + szBuffer, + 0, + KEY_QUERY_VALUE, + &hkSubKey) == ERROR_SUCCESS) { - ZeroMemory(szBuffer, - sizeof(szBuffer)); + ZeroMemory(szBuffer, sizeof(szBuffer)); - if (RegQueryValueEx(hkSubKey, - lpValue, - 0, - &dwType, - (LPBYTE) szBuffer, - &dwSize) == ERROR_SUCCESS) + if (RegQueryValueExW(hkSubKey, + lpValue, + 0, + &dwType, + (LPBYTE)szBuffer, + &dwSize) == ERROR_SUCCESS) { - if (dwType == REG_DWORD && dwSize == sizeof(DWORD)) - Ret = *((PDWORD) szBuffer) != 0; + 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 @@ GetExplorerRegValueSet(IN HKEY hKey, } 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 @@ IN UINT cbBufLen) UINT cbTranslate; UINT cbLen; BOOL bRet = FALSE; - unsigned int i; + UINT i; - dwLen = GetFileVersionInfoSize(szFileName, &dwHandle); + dwLen = GetFileVersionInfoSizeW(szFileName, &dwHandle); if (dwLen > 0) { @@ -229,17 +210,17 @@ IN UINT cbBufLen) 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 @@ IN UINT cbBufLen) 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 @@ IN UINT cbBufLen) } } } + HeapFree(hProcessHeap, 0, lpData); lpData = NULL; }