[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.

svn path=/trunk/; revision=71512
This commit is contained in:
Hermès Bélusca-Maïto 2016-06-04 14:09:20 +00:00
parent 441ced48c3
commit 3f87882d7d
18 changed files with 277 additions and 309 deletions

View file

@ -75,7 +75,7 @@ public:
m_Tray = pTray; m_Tray = pTray;
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); m_hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!m_hEvent) if (!m_hEvent)
return E_FAIL; return E_FAIL;
@ -120,7 +120,7 @@ DesktopCreateWindow(IN OUT ITrayWindow *Tray)
CDesktopThread* pDesktopThread = new CDesktopThread(); CDesktopThread* pDesktopThread = new CDesktopThread();
HRESULT hres = pDesktopThread->Initialize(Tray); HRESULT hres = pDesktopThread->Initialize(Tray);
if(FAILED_UNEXPECTEDLY(hres)) if (FAILED_UNEXPECTEDLY(hres))
{ {
delete pDesktopThread; delete pDesktopThread;
return NULL; return NULL;

View file

@ -55,11 +55,11 @@ static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
#if !WIN7_DEBUG_MODE #if !WIN7_DEBUG_MODE
static BOOL static BOOL
SetShellReadyEvent(IN LPCTSTR lpEventName) SetShellReadyEvent(IN LPCWSTR lpEventName)
{ {
HANDLE hEvent; HANDLE hEvent;
hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, lpEventName); hEvent = OpenEventW(EVENT_MODIFY_STATE, FALSE, lpEventName);
if (hEvent != NULL) if (hEvent != NULL)
{ {
SetEvent(hEvent); SetEvent(hEvent);
@ -77,17 +77,17 @@ HideMinimizedWindows(IN BOOL bHide)
MINIMIZEDMETRICS mm; MINIMIZEDMETRICS mm;
mm.cbSize = sizeof(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; return;
} }
if (bHide) if (bHide)
mm.iArrange |= ARW_HIDE; mm.iArrange |= ARW_HIDE;
else else
mm.iArrange &= ~ARW_HIDE; mm.iArrange &= ~ARW_HIDE;
if (!SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0)) if (!SystemParametersInfoW(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
ERR("SystemParametersInfo failed with %lu\n", GetLastError()); ERR("SystemParametersInfoW failed with %lu\n", GetLastError());
} }
#endif #endif
@ -119,12 +119,12 @@ StartWithDesktop(IN HINSTANCE hInstance)
{ {
InitializeAtlModule(hInstance, TRUE); InitializeAtlModule(hInstance, TRUE);
if (RegOpenKey(HKEY_CURRENT_USER, if (RegOpenKeyW(HKEY_CURRENT_USER,
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
&hkExplorer) != ERROR_SUCCESS) &hkExplorer) != ERROR_SUCCESS)
{ {
WCHAR Message[256]; WCHAR Message[256];
LoadString(hInstance, IDS_STARTUP_ERROR, Message, 256); LoadStringW(hInstance, IDS_STARTUP_ERROR, Message, _countof(Message));
MessageBox(NULL, Message, NULL, MB_ICONERROR); MessageBox(NULL, Message, NULL, MB_ICONERROR);
return 1; return 1;
} }
@ -166,8 +166,8 @@ StartWithDesktop(IN HINSTANCE hInstance)
hShellDesktop = DesktopCreateWindow(Tray); hShellDesktop = DesktopCreateWindow(Tray);
/* WinXP: Notify msgina to hide the welcome screen */ /* WinXP: Notify msgina to hide the welcome screen */
if (!SetShellReadyEvent(TEXT("msgina: ShellReadyEvent"))) if (!SetShellReadyEvent(L"msgina: ShellReadyEvent"))
SetShellReadyEvent(TEXT("Global\\msgina: ShellReadyEvent")); SetShellReadyEvent(L"Global\\msgina: ShellReadyEvent");
#endif #endif
if (Tray != NULL) if (Tray != NULL)

View file

@ -46,5 +46,5 @@ INT_PTR CALLBACK CustomizeNotifyIconsProc(HWND hwnd, UINT Message, WPARAM wParam
VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer) VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer)
{ {
DialogBox(hInst, MAKEINTRESOURCE(IDD_NOTIFICATIONS_CUSTOMIZE), hExplorer, CustomizeNotifyIconsProc); DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_NOTIFICATIONS_CUSTOMIZE), hExplorer, CustomizeNotifyIconsProc);
} }

View file

@ -65,8 +65,8 @@ extern HKEY hkExplorer;
static inline static inline
LONG LONG
SetWindowStyle(IN HWND hWnd, SetWindowStyle(IN HWND hWnd,
IN LONG dwStyleMask, IN LONG dwStyleMask,
IN LONG dwStyle) IN LONG dwStyle)
{ {
return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle); return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
} }
@ -74,35 +74,35 @@ IN LONG dwStyle)
static inline static inline
LONG LONG
SetWindowExStyle(IN HWND hWnd, SetWindowExStyle(IN HWND hWnd,
IN LONG dwStyleMask, IN LONG dwStyleMask,
IN LONG dwStyle) IN LONG dwStyle)
{ {
return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle); return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
} }
HMENU HMENU
LoadPopupMenu(IN HINSTANCE hInstance, LoadPopupMenu(IN HINSTANCE hInstance,
IN LPCTSTR lpMenuName); IN LPCWSTR lpMenuName);
HMENU HMENU
FindSubMenu(IN HMENU hMenu, FindSubMenu(IN HMENU hMenu,
IN UINT uItem, IN UINT uItem,
IN BOOL fByPosition); IN BOOL fByPosition);
BOOL BOOL
GetCurrentLoggedOnUserName(OUT LPTSTR szBuffer, GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer,
IN DWORD dwBufferSize); IN DWORD dwBufferSize);
BOOL BOOL
FormatMenuString(IN HMENU hMenu, FormatMenuString(IN HMENU hMenu,
IN UINT uPosition, IN UINT uPosition,
IN UINT uFlags, IN UINT uFlags,
...); ...);
BOOL BOOL
GetExplorerRegValueSet(IN HKEY hKey, GetExplorerRegValueSet(IN HKEY hKey,
IN LPCTSTR lpSubKey, IN LPCWSTR lpSubKey,
IN LPCTSTR lpValue); IN LPCWSTR lpValue);
/* /*
* rshell.c * rshell.c
@ -190,9 +190,9 @@ VOID
LoadAdvancedSettings(VOID); LoadAdvancedSettings(VOID);
BOOL BOOL
SaveSettingDword(IN PCTSTR pszKeyName, SaveSettingDword(IN LPCWSTR pszKeyName,
IN PCTSTR pszValueName, IN LPCWSTR pszValueName,
IN DWORD dwValue); IN DWORD dwValue);
/* /*
* shellservice.cpp * shellservice.cpp
@ -311,9 +311,9 @@ HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, ICo
IMenuPopup* IMenuPopup*
CreateStartMenu(IN ITrayWindow *Tray, CreateStartMenu(IN ITrayWindow *Tray,
OUT IMenuBand **ppMenuBand, OUT IMenuBand **ppMenuBand,
IN HBITMAP hbmBanner OPTIONAL, IN HBITMAP hbmBanner OPTIONAL,
IN BOOL bSmallIcons); IN BOOL bSmallIcons);
/* /*
* startmnucust.cpp * startmnucust.cpp

View file

@ -34,7 +34,7 @@ HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv)
if (hRShell) if (hRShell)
{ {
PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(hRShell, "CStartMenu_Constructor"); PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(hRShell, "CStartMenu_Constructor");
if(func) if (func)
{ {
return func(riid, ppv); return func(riid, ppv);
} }

View file

@ -21,7 +21,7 @@
#include "precomp.h" #include "precomp.h"
ADVANCED_SETTINGS AdvancedSettings; ADVANCED_SETTINGS AdvancedSettings;
const WCHAR szAdvancedSettingsKey[] = TEXT("Software\\ReactOS\\Features\\Explorer"); const WCHAR szAdvancedSettingsKey[] = L"Software\\ReactOS\\Features\\Explorer";
VOID VOID
LoadAdvancedSettings(VOID) LoadAdvancedSettings(VOID)
@ -32,12 +32,12 @@ LoadAdvancedSettings(VOID)
AdvancedSettings.bShowSeconds = FALSE; AdvancedSettings.bShowSeconds = FALSE;
/* Check registry */ /* Check registry */
if (RegOpenKey(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == ERROR_SUCCESS) if (RegOpenKeyW(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == ERROR_SUCCESS)
{ {
DWORD dwValue, dwValueLength, dwType; DWORD dwValue, dwValueLength, dwType;
dwValueLength = sizeof(dwValue); 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; AdvancedSettings.bShowSeconds = dwValue != 0;
RegCloseKey(hKey); RegCloseKey(hKey);
@ -45,16 +45,16 @@ LoadAdvancedSettings(VOID)
} }
BOOL BOOL
SaveSettingDword(IN PCTSTR pszKeyName, SaveSettingDword(IN LPCWSTR pszKeyName,
IN PCTSTR pszValueName, IN LPCWSTR pszValueName,
IN DWORD dwValue) IN DWORD dwValue)
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
HKEY hKey; 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); RegCloseKey(hKey);
} }

View file

@ -62,11 +62,11 @@ HRESULT InitShellServices(HDPA * phdpa)
TRACE("Enumerating Shell Service Ojbect GUIDs...\n"); TRACE("Enumerating Shell Service Ojbect GUIDs...\n");
if (RegOpenKey(HKEY_LOCAL_MACHINE, if (RegOpenKeyW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad", L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad",
&hkey)) &hkey))
{ {
ERR("RegOpenKey failed.\n"); ERR("RegOpenKeyW failed.\n");
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
} }

View file

@ -70,10 +70,10 @@ class CStartMenuBtnCtxMenu :
HRESULT hRet; HRESULT hRet;
/* Add the "Open All Users" menu item */ /* Add the "Open All Users" menu item */
if (LoadString(hExplorerInstance, if (LoadStringW(hExplorerInstance,
IDS_PROPERTIES, IDS_PROPERTIES,
szBuf, szBuf,
sizeof(szBuf) / sizeof(szBuf[0]))) _countof(szBuf)))
{ {
AppendMenu(hPopup, AppendMenu(hPopup,
MF_STRING, MF_STRING,
@ -103,10 +103,10 @@ class CStartMenuBtnCtxMenu :
NULL); NULL);
/* Add the "Open All Users" menu item */ /* Add the "Open All Users" menu item */
if (LoadString(hExplorerInstance, if (LoadStringW(hExplorerInstance,
IDS_OPEN_ALL_USERS, IDS_OPEN_ALL_USERS,
szBuf, szBuf,
sizeof(szBuf) / sizeof(szBuf[0]))) _countof(szBuf)))
{ {
AppendMenu(hPopup, AppendMenu(hPopup,
MF_STRING, MF_STRING,
@ -115,10 +115,10 @@ class CStartMenuBtnCtxMenu :
} }
/* Add the "Explore All Users" menu item */ /* Add the "Explore All Users" menu item */
if (LoadString(hExplorerInstance, if (LoadStringW(hExplorerInstance,
IDS_EXPLORE_ALL_USERS, IDS_EXPLORE_ALL_USERS,
szBuf, szBuf,
sizeof(szBuf) / sizeof(szBuf[0]))) _countof(szBuf)))
{ {
AppendMenu(hPopup, AppendMenu(hPopup,
MF_STRING, MF_STRING,
@ -236,6 +236,7 @@ public:
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
END_COM_MAP() END_COM_MAP()
}; };
HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * m_TrayWnd, IN HWND m_Owner, IContextMenu ** ppCtxMenu) HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * m_TrayWnd, IN HWND m_Owner, IContextMenu ** ppCtxMenu)
{ {
CStartMenuBtnCtxMenu * mnu = new CComObject<CStartMenuBtnCtxMenu>(); CStartMenuBtnCtxMenu * mnu = new CComObject<CStartMenuBtnCtxMenu>();

View file

@ -40,7 +40,7 @@ UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup,
return hRet; return hRet;
} }
IMenuPopup * IMenuPopup*
CreateStartMenu(IN ITrayWindow *Tray, CreateStartMenu(IN ITrayWindow *Tray,
OUT IMenuBand **ppMenuBand, OUT IMenuBand **ppMenuBand,
IN HBITMAP hbmBanner OPTIONAL, IN HBITMAP hbmBanner OPTIONAL,

View file

@ -21,14 +21,14 @@
#include "precomp.h" #include "precomp.h"
VOID OnAddStartmenuItems(HWND hDlg) VOID OnAddStartMenuItems(HWND hDlg)
{ {
WCHAR szPath[MAX_PATH]; 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 "; 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); ShellExecuteW(hDlg, L"open", L"rundll32.exe", szCommand, NULL, SW_SHOWNORMAL);
} }
} }
@ -37,7 +37,7 @@ VOID OnAdvancedStartMenuItems()
{ {
WCHAR szPath[MAX_PATH]; 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); ShellExecuteW(NULL, L"explore", szPath, NULL, NULL, SW_SHOWNORMAL);
} }
@ -46,19 +46,19 @@ VOID OnAdvancedStartMenuItems()
VOID OnClearRecentItems() VOID OnClearRecentItems()
{ {
WCHAR szPath[MAX_PATH], szFile[MAX_PATH]; WCHAR szPath[MAX_PATH], szFile[MAX_PATH];
WIN32_FIND_DATA info; WIN32_FIND_DATAW info;
HANDLE hPath; 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); hPath = FindFirstFileW(szFile, &info);
do do
{ {
StringCchPrintf(szFile,MAX_PATH, L"%s\\%s", szPath, info.cFileName); StringCchPrintfW(szFile,MAX_PATH, L"%s\\%s", szPath, info.cFileName);
DeleteFileW(szFile); DeleteFileW(szFile);
}
}while(FindNextFileW(hPath, &info)); while (FindNextFileW(hPath, &info));
FindClose(hPath); FindClose(hPath);
/* FIXME: Disable the button*/ /* FIXME: Disable the button*/
} }
@ -75,7 +75,7 @@ INT_PTR CALLBACK CustomizeClassicProc(HWND hwnd, UINT Message, WPARAM wParam, LP
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case IDC_CLASSICSTART_ADD: case IDC_CLASSICSTART_ADD:
OnAddStartmenuItems(hwnd); OnAddStartMenuItems(hwnd);
break; break;
case IDC_CLASSICSTART_ADVANCED: case IDC_CLASSICSTART_ADVANCED:
OnAdvancedStartMenuItems(); OnAdvancedStartMenuItems();
@ -99,5 +99,5 @@ INT_PTR CALLBACK CustomizeClassicProc(HWND hwnd, UINT Message, WPARAM wParam, LP
VOID ShowCustomizeClassic(HINSTANCE hInst, HWND hExplorer) VOID ShowCustomizeClassic(HINSTANCE hInst, HWND hExplorer)
{ {
DialogBox(hInst, MAKEINTRESOURCE(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, CustomizeClassicProc); DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_CLASSICSTART_CUSTOMIZE), hExplorer, CustomizeClassicProc);
} }

View file

@ -123,8 +123,7 @@ public:
TRACE("ITrayPriv::AppendMenu\n"); TRACE("ITrayPriv::AppendMenu\n");
hMenu = LoadPopupMenu(hExplorerInstance, hMenu = LoadPopupMenu(hExplorerInstance, MAKEINTRESOURCEW(IDM_STARTMENU));
MAKEINTRESOURCE(IDM_STARTMENU));
*phMenu = hMenu; *phMenu = hMenu;
if (hMenu == NULL) if (hMenu == NULL)
return E_FAIL; return E_FAIL;
@ -135,13 +134,13 @@ public:
bWantLogoff = (dwLogoff == 2 || bWantLogoff = (dwLogoff == 2 ||
SHRestricted(REST_FORCESTARTMENULOGOFF) || SHRestricted(REST_FORCESTARTMENULOGOFF) ||
GetExplorerRegValueSet(HKEY_CURRENT_USER, GetExplorerRegValueSet(HKEY_CURRENT_USER,
TEXT("Advanced"), L"Advanced",
TEXT("StartMenuLogoff"))); L"StartMenuLogoff"));
/* Favorites */ /* Favorites */
if (!GetExplorerRegValueSet(HKEY_CURRENT_USER, if (!GetExplorerRegValueSet(HKEY_CURRENT_USER,
TEXT("Advanced"), L"Advanced",
TEXT("StartMenuFavorites"))) L"StartMenuFavorites"))
{ {
DeleteMenu(hMenu, DeleteMenu(hMenu,
IDM_FAVORITES, IDM_FAVORITES,
@ -243,8 +242,7 @@ public:
or hide it, it might be hidden in too many cases!!! */ or hide it, it might be hidden in too many cases!!! */
/* Update Log Off menu item */ /* Update Log Off menu item */
if (!GetCurrentLoggedOnUserName(szUser, if (!GetCurrentLoggedOnUserName(szUser, _countof(szUser)))
sizeof(szUser) / sizeof(szUser[0])))
{ {
szUser[0] = _T('\0'); szUser[0] = _T('\0');
} }

View file

@ -60,7 +60,7 @@ static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL minimized)
DWORD exit_code = 0; DWORD exit_code = 0;
WCHAR szCmdLineExp[MAX_PATH+1] = L"\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)); memset(&si, 0, sizeof(si));
si.cb = sizeof(si); si.cb = sizeof(si);
@ -123,7 +123,7 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
&hkWin); &hkWin);
if (res != ERROR_SUCCESS) 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; goto end;
} }
@ -142,7 +142,7 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
res = ERROR_SUCCESS; res = ERROR_SUCCESS;
} }
else else
TRACE("RegOpenKeyEx failed on run key (%ld)\n", res); TRACE("RegOpenKeyExW failed on run key (%ld)\n", res);
goto end; goto end;
} }
@ -271,7 +271,7 @@ ProcessStartupItems(VOID)
HKEY hSessionKey, hKey; HKEY hSessionKey, hKey;
HRESULT hr; HRESULT hr;
res = GetWindowsDirectoryW(gen_path, sizeof(gen_path) / sizeof(gen_path[0])); res = GetWindowsDirectoryW(gen_path, _countof(gen_path));
if (res == 0) if (res == 0)
{ {
TRACE("Couldn't get the windows directory - error %lu\n", GetLastError()); TRACE("Couldn't get the windows directory - error %lu\n", GetLastError());

View file

@ -32,8 +32,8 @@
#define MAX_TASKS_COUNT (0x7FFF) #define MAX_TASKS_COUNT (0x7FFF)
#define TASK_ITEM_ARRAY_ALLOC 64 #define TASK_ITEM_ARRAY_ALLOC 64
const WCHAR szTaskSwitchWndClass [] = TEXT("MSTaskSwWClass"); const WCHAR szTaskSwitchWndClass[] = L"MSTaskSwWClass";
const WCHAR szRunningApps [] = TEXT("Running Applications"); const WCHAR szRunningApps[] = L"Running Applications";
#if DEBUG_SHELL_HOOK #if DEBUG_SHELL_HOOK
const struct { const struct {
@ -420,7 +420,7 @@ public:
icon = GetWndIcon(TaskItem->hWnd); icon = GetWndIcon(TaskItem->hWnd);
if (!icon) 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); TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, TaskItem->IconIndex, icon);
tbbi.iImage = TaskItem->IconIndex; tbbi.iImage = TaskItem->IconIndex;
@ -565,7 +565,7 @@ public:
icon = GetWndIcon(TaskItem->hWnd); icon = GetWndIcon(TaskItem->hWnd);
if (!icon) 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); TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, -1, icon);
tbBtn.iBitmap = TaskItem->IconIndex; tbBtn.iBitmap = TaskItem->IconIndex;
@ -977,8 +977,7 @@ public:
TaskItem = AllocTaskItem(); TaskItem = AllocTaskItem();
if (TaskItem != NULL) if (TaskItem != NULL)
{ {
ZeroMemory(TaskItem, ZeroMemory(TaskItem, sizeof(*TaskItem));
sizeof(*TaskItem));
TaskItem->hWnd = hWnd; TaskItem->hWnd = hWnd;
TaskItem->Index = -1; TaskItem->Index = -1;
TaskItem->Group = AddToTaskGroup(hWnd); TaskItem->Group = AddToTaskGroup(hWnd);
@ -1304,7 +1303,7 @@ public:
m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL); m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
/* Register the shell hook */ /* Register the shell hook */
m_ShellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK")); m_ShellHookMsg = RegisterWindowMessageW(L"SHELLHOOK");
TRACE("ShellHookMsg got assigned number %d\n", m_ShellHookMsg); TRACE("ShellHookMsg got assigned number %d\n", m_ShellHookMsg);
@ -1420,7 +1419,7 @@ public:
{ {
#if DEBUG_SHELL_HOOK #if DEBUG_SHELL_HOOK
int i, found; 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) if (hshell_msg[i].msg == (INT) wParam)
{ {

View file

@ -137,8 +137,7 @@ public:
/* Read the current position of the stream, we'll have to reset it everytime /* Read the current position of the stream, we'll have to reset it everytime
we read a CLSID that's not the task band... */ we read a CLSID that's not the task band... */
ZeroMemory(&liPosZero, ZeroMemory(&liPosZero, sizeof(liPosZero));
sizeof(liPosZero));
hRet = pStm->Seek(liPosZero, STREAM_SEEK_CUR, &liCurrent); hRet = pStm->Seek(liPosZero, STREAM_SEEK_CUR, &liCurrent);
if (SUCCEEDED(hRet)) if (SUCCEEDED(hRet))
@ -564,13 +563,13 @@ public:
HKEY hkStreams; HKEY hkStreams;
IStream *Stream = NULL; IStream *Stream = NULL;
if (RegCreateKey(hkExplorer, if (RegCreateKeyW(hkExplorer,
TEXT("Streams"), L"Streams",
&hkStreams) == ERROR_SUCCESS) &hkStreams) == ERROR_SUCCESS)
{ {
Stream = SHOpenRegStream(hkStreams, Stream = SHOpenRegStreamW(hkStreams,
TEXT("Desktop"), L"Desktop",
TEXT("TaskbarWinXP"), L"TaskbarWinXP",
grfMode); grfMode);
RegCloseKey(hkStreams); RegCloseKey(hkStreams);
@ -584,13 +583,13 @@ public:
HKEY hkStreams; HKEY hkStreams;
IStream *Stream = NULL; IStream *Stream = NULL;
if (RegCreateKey(HKEY_LOCAL_MACHINE, if (RegCreateKeyW(HKEY_LOCAL_MACHINE,
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams"), L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Streams",
&hkStreams) == ERROR_SUCCESS) &hkStreams) == ERROR_SUCCESS)
{ {
Stream = SHOpenRegStream(hkStreams, Stream = SHOpenRegStreamW(hkStreams,
TEXT("Desktop"), L"Desktop",
TEXT("Default Taskbar"), L"Default Taskbar",
grfMode); grfMode);
RegCloseKey(hkStreams); RegCloseKey(hkStreams);
@ -752,10 +751,10 @@ public:
}; };
/*******************************************************************/ /*******************************************************************/
ITrayBandSite * ITrayBandSite*
CreateTrayBandSite(IN OUT ITrayWindow *Tray, CreateTrayBandSite(IN OUT ITrayWindow *Tray,
OUT HWND *phWndRebar, OUT HWND *phWndRebar,
OUT HWND *phWndTaskSwitch) OUT HWND *phWndTaskSwitch)
{ {
HRESULT hr; HRESULT hr;

View file

@ -26,7 +26,7 @@
/* /*
* SysPagerWnd * SysPagerWnd
*/ */
static const WCHAR szSysPagerWndClass [] = TEXT("SysPager"); static const WCHAR szSysPagerWndClass [] = L"SysPager";
// Data comes from shell32/systray.cpp -> TrayNotifyCDS_Dummy // Data comes from shell32/systray.cpp -> TrayNotifyCDS_Dummy
typedef struct _SYS_PAGER_COPY_DATA typedef struct _SYS_PAGER_COPY_DATA
@ -86,7 +86,7 @@ public:
{ {
TBBUTTON tbBtn; TBBUTTON tbBtn;
NOTIFYICONDATA * notifyItem; NOTIFYICONDATA * notifyItem;
WCHAR text [] = TEXT(""); WCHAR text[] = L"";
int index = FindItemByIconData(iconData, &notifyItem); int index = FindItemByIconData(iconData, &notifyItem);
if (index >= 0) if (index >= 0)
@ -450,10 +450,9 @@ public:
Toolbar.Initialize(m_hWnd); Toolbar.Initialize(m_hWnd);
// Explicitly request running applications to re-register their systray icons // Explicitly request running applications to re-register their systray icons
::SendNotifyMessage(HWND_BROADCAST, ::SendNotifyMessageW(HWND_BROADCAST,
RegisterWindowMessage(TEXT("TaskbarCreated")), RegisterWindowMessageW(L"TaskbarCreated"),
0, 0, 0);
0);
return TRUE; return TRUE;
} }
@ -626,7 +625,7 @@ public:
* TrayClockWnd * TrayClockWnd
*/ */
static const WCHAR szTrayClockWndClass [] = TEXT("TrayClockWClass"); static const WCHAR szTrayClockWndClass[] = L"TrayClockWClass";
#define ID_TRAYCLOCK_TIMER 0 #define ID_TRAYCLOCK_TIMER 0
#define ID_TRAYCLOCK_TIMER_INIT 1 #define ID_TRAYCLOCK_TIMER_INIT 1
@ -635,14 +634,14 @@ static const struct
{ {
BOOL IsTime; BOOL IsTime;
DWORD dwFormatFlags; DWORD dwFormatFlags;
LPCTSTR lpFormat; LPCWSTR lpFormat;
} ClockWndFormats [] = { } ClockWndFormats [] = {
{ TRUE, 0, NULL }, { TRUE, 0, NULL },
{ FALSE, 0, TEXT("dddd") }, { FALSE, 0, L"dddd" },
{ FALSE, DATE_SHORTDATE, NULL } { 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_X 0
#define TRAY_CLOCK_WND_SPACING_Y 0 #define TRAY_CLOCK_WND_SPACING_Y 0
@ -687,7 +686,7 @@ public:
ZeroMemory(&LocalTime, sizeof(LocalTime)); ZeroMemory(&LocalTime, sizeof(LocalTime));
ZeroMemory(&CurrentSize, sizeof(CurrentSize)); ZeroMemory(&CurrentSize, sizeof(CurrentSize));
ZeroMemory(LineSizes, sizeof(LineSizes)); ZeroMemory(LineSizes, sizeof(LineSizes));
ZeroMemory(szLines, sizeof(LineSizes)); ZeroMemory(szLines, sizeof(szLines));
} }
virtual ~CTrayClockWnd() { } virtual ~CTrayClockWnd() { }
@ -720,7 +719,7 @@ public:
{ {
NONCLIENTMETRICS ncm = { 0 }; NONCLIENTMETRICS ncm = { 0 };
ncm.cbSize = sizeof(ncm); ncm.cbSize = sizeof(ncm);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE);
hFont = CreateFontIndirectW(&ncm.lfMessageFont); hFont = CreateFontIndirectW(&ncm.lfMessageFont);
@ -743,7 +742,7 @@ public:
{ {
HDC hDC; HDC hDC;
HFONT hPrevFont; HFONT hPrevFont;
INT c, i; UINT c, i;
BOOL bRet = TRUE; BOOL bRet = TRUE;
hDC = GetDC(); hDC = GetDC();
@ -752,10 +751,10 @@ public:
if (hFont) if (hFont)
hPrevFont = (HFONT) SelectObject(hDC, 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') && if (szLines[i][0] != L'\0' &&
!GetTextExtentPoint(hDC, szLines[i], _tcslen(szLines[i]), !GetTextExtentPointW(hDC, szLines[i], wcslen(szLines[i]),
&LineSizes[i])) &LineSizes[i]))
{ {
bRet = FALSE; bRet = FALSE;
@ -773,7 +772,7 @@ public:
LineSpacing = 0; LineSpacing = 0;
/* calculate the line spacing */ /* 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) if (LineSizes[i].cx > 0)
{ {
@ -798,7 +797,7 @@ public:
WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize) WORD GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
{ {
WORD iLinesVisible = 0; WORD iLinesVisible = 0;
INT i; UINT i;
SIZE szMax = { 0, 0 }; SIZE szMax = { 0, 0 };
if (!LinesMeasured) if (!LinesMeasured)
@ -807,9 +806,7 @@ public:
if (!LinesMeasured) if (!LinesMeasured)
return 0; return 0;
for (i = 0; for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
i != CLOCKWND_FORMAT_COUNT;
i++)
{ {
if (LineSizes[i].cx != 0) if (LineSizes[i].cx != 0)
{ {
@ -854,20 +851,18 @@ public:
VOID UpdateWnd() VOID UpdateWnd()
{ {
SIZE szPrevCurrent; SIZE szPrevCurrent;
INT BufSize, iRet, i; UINT BufSize, i;
INT iRet;
RECT rcClient; RECT rcClient;
ZeroMemory(LineSizes, ZeroMemory(LineSizes, sizeof(LineSizes));
sizeof(LineSizes));
szPrevCurrent = CurrentSize; szPrevCurrent = CurrentSize;
for (i = 0; for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
i != CLOCKWND_FORMAT_COUNT;
i++)
{ {
szLines[i][0] = TEXT('\0'); szLines[i][0] = L'\0';
BufSize = sizeof(szLines[0]) / sizeof(szLines[0][0]); BufSize = _countof(szLines[0]);
if (ClockWndFormats[i].IsTime) if (ClockWndFormats[i].IsTime)
{ {
@ -1052,7 +1047,8 @@ public:
{ {
RECT rcClient; RECT rcClient;
HFONT hPrevFont; HFONT hPrevFont;
int iPrevBkMode, i, line; INT iPrevBkMode;
UINT i, line;
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDC = (HDC) wParam; HDC hDC = (HDC) wParam;
@ -1080,7 +1076,7 @@ public:
rcClient.bottom = rcClient.top + CurrentSize.cy; rcClient.bottom = rcClient.top + CurrentSize.cy;
for (i = 0, line = 0; for (i = 0, line = 0;
i != CLOCKWND_FORMAT_COUNT && line < VisibleLines; i < CLOCKWND_FORMAT_COUNT && line < VisibleLines;
i++) i++)
{ {
if (LineSizes[i].cx != 0) if (LineSizes[i].cx != 0)
@ -1090,7 +1086,7 @@ public:
TRAY_CLOCK_WND_SPACING_X, TRAY_CLOCK_WND_SPACING_X,
rcClient.top + TRAY_CLOCK_WND_SPACING_Y, rcClient.top + TRAY_CLOCK_WND_SPACING_Y,
szLines[i], szLines[i],
_tcslen(szLines[i])); wcslen(szLines[i]));
rcClient.top += LineSizes[i].cy + LineSpacing; rcClient.top += LineSizes[i].cy + LineSpacing;
line++; line++;

View file

@ -64,23 +64,23 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo)
bHideInactive = (SendMessage(hwndHideInactive, BM_GETCHECK, 0, 0) == BST_CHECKED); bHideInactive = (SendMessage(hwndHideInactive, BM_GETCHECK, 0, 0) == BST_CHECKED);
if (bHide) if (bHide)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_AUTOHIDE);
else if (bLock && bGroup && bShowQL) else if (bLock && bGroup && bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_QL);
else if (bLock && !bGroup && !bShowQL) else if (bLock && !bGroup && !bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL);
else if (bLock && bGroup && !bShowQL) else if (bLock && bGroup && !bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_NOQL);
else if (bLock && !bGroup && bShowQL) else if (bLock && !bGroup && bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_QL);
else if (!bLock && !bGroup && !bShowQL) else if (!bLock && !bGroup && !bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL);
else if (!bLock && bGroup && !bShowQL) else if (!bLock && bGroup && !bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL);
else if (!bLock && !bGroup && bShowQL) else if (!bLock && !bGroup && bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL);
else if (!bLock && bGroup && bShowQL) else if (!bLock && bGroup && bShowQL)
lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL); lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_QL);
if (lpTaskBarImageName) if (lpTaskBarImageName)
@ -90,7 +90,7 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo)
DeleteObject(pPropInfo->hTaskbarBitmap); DeleteObject(pPropInfo->hTaskbarBitmap);
} }
pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImage(hExplorerInstance, pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
lpTaskBarImageName, lpTaskBarImageName,
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0,
@ -113,48 +113,48 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo)
if (bHideInactive) if (bHideInactive)
{ {
EnableWindow(hwndAdvancedButton, TRUE); EnableWindow(hwndAdvancedButton, TRUE);
if(bShowClock) if (bShowClock)
{ {
EnableWindow(hwndSeconds, TRUE); EnableWindow(hwndSeconds, TRUE);
if(bShowSeconds) if (bShowSeconds)
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_SECONDS); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_SECONDS);
else else
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_CLOCK); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_CLOCK);
} }
else else
{ {
SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0); SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
EnableWindow(hwndSeconds, FALSE); EnableWindow(hwndSeconds, FALSE);
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_NOCLOCK); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_NOCLOCK);
} }
} }
else else
{ {
EnableWindow(hwndAdvancedButton, FALSE); EnableWindow(hwndAdvancedButton, FALSE);
if(bShowClock) if (bShowClock)
{ {
EnableWindow(hwndSeconds, TRUE); EnableWindow(hwndSeconds, TRUE);
if(bShowSeconds) if (bShowSeconds)
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_SECONDS); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_SECONDS);
else else
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_CLOCK); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_CLOCK);
} }
else else
{ {
SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0); SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
EnableWindow(hwndSeconds, FALSE); EnableWindow(hwndSeconds, FALSE);
lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_NOCLOCK); lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_NOCLOCK);
} }
} }
if(lpTrayImageName) if (lpTrayImageName)
{ {
if (pPropInfo->hTrayBitmap) if (pPropInfo->hTrayBitmap)
{ {
DeleteObject(pPropInfo->hTrayBitmap); DeleteObject(pPropInfo->hTrayBitmap);
} }
pPropInfo->hTrayBitmap = (HBITMAP)LoadImage(hExplorerInstance, pPropInfo->hTrayBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
lpTrayImageName, lpTrayImageName,
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0,
@ -328,11 +328,11 @@ InitPropSheetPage(PROPSHEETPAGE *psp,
DLGPROC DlgProc, DLGPROC DlgProc,
LPARAM lParam) LPARAM lParam)
{ {
ZeroMemory(psp, sizeof(PROPSHEETPAGE)); ZeroMemory(psp, sizeof(*psp));
psp->dwSize = sizeof(PROPSHEETPAGE); psp->dwSize = sizeof(*psp);
psp->dwFlags = PSP_DEFAULT; psp->dwFlags = PSP_DEFAULT;
psp->hInstance = hExplorerInstance; psp->hInstance = hExplorerInstance;
psp->pszTemplate = MAKEINTRESOURCE(idDlg); psp->pszTemplate = MAKEINTRESOURCEW(idDlg);
psp->lParam = lParam; psp->lParam = lParam;
psp->pfnDlgProc = DlgProc; psp->pfnDlgProc = DlgProc;
} }
@ -346,22 +346,22 @@ DisplayTrayProperties(IN HWND hwndOwner)
PROPSHEETPAGE psp[2]; PROPSHEETPAGE psp[2];
WCHAR szCaption[256]; WCHAR szCaption[256];
if (!LoadString(hExplorerInstance, if (!LoadStringW(hExplorerInstance,
IDS_TASKBAR_STARTMENU_PROP_CAPTION, IDS_TASKBAR_STARTMENU_PROP_CAPTION,
szCaption, szCaption,
sizeof(szCaption) / sizeof(szCaption[0]))) _countof(szCaption)))
{ {
return; return;
} }
ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); ZeroMemory(&psh, sizeof(psh));
psh.dwSize = sizeof(PROPSHEETHEADER); psh.dwSize = sizeof(psh);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
psh.hwndParent = hwndOwner; psh.hwndParent = hwndOwner;
psh.hInstance = hExplorerInstance; psh.hInstance = hExplorerInstance;
psh.hIcon = NULL; psh.hIcon = NULL;
psh.pszCaption = szCaption; psh.pszCaption = szCaption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); psh.nPages = _countof(psp);
psh.nStartPage = 0; psh.nStartPage = 0;
psh.ppsp = psp; psh.ppsp = psp;

View file

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

View file

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