Commit 53d671d7 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

oleview: Fixed LoadString buffer sizes.

parent 395c4163
......@@ -301,14 +301,14 @@ void RefreshDetails(HTREEITEM item)
memset(&tci, 0, sizeof(TCITEM));
tci.mask = TCIF_TEXT;
tci.pszText = wszBuf;
tci.cchTextMax = sizeof(WCHAR[MAX_LOAD_STRING]);
tci.cchTextMax = sizeof(wszBuf)/sizeof(wszBuf[0]);
LoadString(globals.hMainInst, IDS_TAB_IMPL,
wszBuf, sizeof(WCHAR[MAX_LOAD_STRING]));
wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
SendMessage(details.hTab, TCM_INSERTITEM, 1, (LPARAM)&tci);
LoadString(globals.hMainInst, IDS_TAB_ACTIV,
wszBuf, sizeof(WCHAR[MAX_LOAD_STRING]));
wszBuf, sizeof(wszBuf)/sizeof(wszBuf[0]));
SendMessage(details.hTab, TCM_INSERTITEM, 2, (LPARAM)&tci);
}
}
......@@ -336,13 +336,13 @@ static void CreateTabCtrl(HWND hWnd)
memset(&tci, 0, sizeof(TCITEM));
tci.mask = TCIF_TEXT;
tci.pszText = buffer;
tci.cchTextMax = sizeof(WCHAR[MAX_LOAD_STRING]);
tci.cchTextMax = sizeof(buffer)/sizeof(buffer[0]);
details.hTab = CreateWindow(WC_TABCONTROL, NULL, WS_CHILD|WS_VISIBLE,
0, 0, 0, 0, hWnd, (HMENU)TAB_WINDOW, globals.hMainInst, NULL);
ShowWindow(details.hTab, SW_HIDE);
LoadString(globals.hMainInst, IDS_TAB_REG, buffer, sizeof(WCHAR[MAX_LOAD_STRING]));
LoadString(globals.hMainInst, IDS_TAB_REG, buffer, sizeof(buffer)/sizeof(buffer[0]));
SendMessage(details.hTab, TCM_INSERTITEM, 0, (LPARAM)&tci);
details.hReg = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, NULL,
......
......@@ -284,9 +284,9 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
{
case IDM_ABOUT:
LoadString(globals.hMainInst, IDS_ABOUT, wszAbout,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszAbout)/sizeof(wszAbout[0]));
LoadString(globals.hMainInst, IDS_ABOUTVER, wszAboutVer,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszAboutVer)/sizeof(wszAboutVer[0]));
ShellAbout(hWnd, wszAbout, wszAboutVer, NULL);
break;
case IDM_COPYCLSID:
......@@ -403,8 +403,8 @@ static int MenuCommand(WPARAM wParam, HWND hWnd)
static WCHAR wszName[MAX_LOAD_STRING];
static WCHAR wszFilter[MAX_LOAD_STRING];
LoadString(globals.hMainInst, IDS_OPEN, wszTitle, sizeof(wszTitle));
LoadString(globals.hMainInst, IDS_OPEN_TYPELIB_FILTER, wszFilter, sizeof(wszFilter));
LoadString(globals.hMainInst, IDS_OPEN, wszTitle, sizeof(wszTitle)/sizeof(wszTitle[0]));
LoadString(globals.hMainInst, IDS_OPEN_TYPELIB_FILTER, wszFilter, sizeof(wszFilter)/sizeof(wszFilter[0]));
InitOpenFileName(hWnd, &ofn, wszFilter, wszTitle, wszName);
if(GetOpenFileName(&ofn)) CreateTypeLibWindow(globals.hMainInst, wszName);
break;
......@@ -425,8 +425,8 @@ static void UpdateStatusBar(int itemID)
{
WCHAR info[MAX_LOAD_STRING];
if(!LoadString(globals.hMainInst, itemID, info, sizeof(WCHAR[MAX_LOAD_STRING])))
LoadString(globals.hMainInst, IDS_READY, info, sizeof(WCHAR[MAX_LOAD_STRING]));
if(!LoadString(globals.hMainInst, itemID, info, sizeof(info)/sizeof(info[0])))
LoadString(globals.hMainInst, IDS_READY, info, sizeof(info)/sizeof(info[0]));
SendMessage(globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)info);
}
......@@ -475,7 +475,7 @@ static BOOL InitApplication(HINSTANCE hInst)
WNDCLASS wc;
WCHAR wszAppName[MAX_LOAD_STRING];
LoadString(hInst, IDS_APPNAME, wszAppName, sizeof(WCHAR[MAX_LOAD_STRING]));
LoadString(hInst, IDS_APPNAME, wszAppName, sizeof(wszAppName)/sizeof(wszAppName[0]));
memset(&wc, 0, sizeof(WNDCLASS));
wc.lpfnWndProc = WndProc;
......@@ -507,8 +507,8 @@ static BOOL InitInstance(HINSTANCE hInst, int nCmdShow)
{5, IDM_VIEW, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0}
};
LoadString(hInst, IDS_APPNAME, wszAppName, sizeof(WCHAR[MAX_LOAD_STRING]));
LoadString(hInst, IDS_APPTITLE, wszTitle, sizeof(WCHAR[MAX_LOAD_STRING]));
LoadString(hInst, IDS_APPNAME, wszAppName, sizeof(wszAppName)/sizeof(wszAppName[0]));
LoadString(hInst, IDS_APPTITLE, wszTitle, sizeof(wszTitle)/sizeof(wszTitle[0]));
hWnd = CreateWindow(wszAppName, wszTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInst, NULL);
......
......@@ -109,9 +109,9 @@ void CreateInst(HTREEITEM item, WCHAR *wszMachineName)
if(FAILED(hRes))
{
LoadString(globals.hMainInst, IDS_CGCOFAIL, wszMessage,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszMessage)/sizeof(wszMessage[0]));
LoadString(globals.hMainInst, IDS_ABOUT, wszTitle,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszTitle)/sizeof(wszTitle[0]));
#define CASE_ERR(i) case i: \
MultiByteToWideChar(CP_ACP, 0, #i, -1, wszFlagName, MAX_LOAD_STRING); \
......@@ -130,7 +130,7 @@ void CreateInst(HTREEITEM item, WCHAR *wszMachineName)
CASE_ERR(CO_E_APPDIDNTREG);
CASE_ERR(CLASS_E_CLASSNOTAVAILABLE);
default:
LoadString(globals.hMainInst, IDS_ERROR_UNKN, wszFlagName, MAX_LOAD_STRING);
LoadString(globals.hMainInst, IDS_ERROR_UNKN, wszFlagName, sizeof(wszFlagName)/sizeof(wszFlagName[0]));
}
wsprintfW(&wszMessage[lstrlenW(wszMessage)], wszFormat,
......@@ -419,7 +419,7 @@ static void AddTypeLib(void)
&& *buffer)
{
LoadString(globals.hMainInst, IDS_TL_VER, wszVer,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszVer)/sizeof(wszVer[0]));
wsprintfW(&buffer[lstrlenW(buffer)], wszFormat, wszVer, valName);
U(tvis).item.pszText = buffer;
......@@ -550,43 +550,43 @@ static void AddBaseEntries(void)
tvis.hParent = TVI_ROOT;
LoadString(globals.hMainInst, IDS_TREE_I, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = CreateITEM_INFO(REGTOP, wszInterface, NULL, NULL);
tree.hI = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_TL, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = CreateITEM_INFO(REGTOP, wszTypeLib, NULL, NULL);
tree.hTL = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_AID, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = CreateITEM_INFO(REGTOP|REGPATH, wszAppID, NULL, NULL);
tree.hAID = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_OC, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = (LPARAM)NULL;
tree.hOC = TreeView_InsertItem(globals.hTree, &tvis);
tvis.hParent = tree.hOC;
LoadString(globals.hMainInst, IDS_TREE_AO, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = CreateITEM_INFO(REGTOP, wszCLSID, NULL, NULL);
tree.hAO = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_CLO, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
tree.hCLO = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_O1O, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = (LPARAM)NULL;
tree.hO1O = TreeView_InsertItem(globals.hTree, &tvis);
LoadString(globals.hMainInst, IDS_TREE_GBCC, U(tvis).item.pszText,
sizeof(WCHAR[MAX_LOAD_STRING]));
MAX_LOAD_STRING);
U(tvis).item.lParam = CreateITEM_INFO(REGTOP|REGPATH,
wszComponentCategories, NULL, NULL);
tree.hGBCC = TreeView_InsertItem(globals.hTree, &tvis);
......
......@@ -105,7 +105,7 @@ static void ShowLastError(void)
WCHAR wszTitle[MAX_LOAD_STRING];
LoadString(globals.hMainInst, IDS_TYPELIBTITLE, wszTitle,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszTitle)/sizeof(wszTitle[0]));
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error, 0, (LPTSTR) &lpMsgBuf, 0, NULL);
MessageBox(NULL, lpMsgBuf, wszTitle, MB_OK | MB_ICONERROR);
......@@ -731,7 +731,7 @@ static int EnumImplTypes(ITypeInfo *pTypeInfo, int cImplTypes, HTREEITEM hParent
if(!cImplTypes) return 0;
LoadString(globals.hMainInst, IDS_INHERITINTERFACES, wszInheritedInterfaces,
sizeof(WCHAR[MAX_LOAD_STRING]));
sizeof(wszInheritedInterfaces)/sizeof(wszInheritedInterfaces[0]));
U(tvis).item.mask = TVIF_TEXT;
U(tvis).item.cchTextMax = MAX_LOAD_STRING;
......@@ -1191,7 +1191,7 @@ static int PopulateTree(void)
WCHAR wszError[MAX_LOAD_STRING];
LoadString(globals.hMainInst, IDS_ERROR_LOADTYPELIB,
wszError, sizeof(WCHAR[MAX_LOAD_STRING]));
wszError, sizeof(wszError)/sizeof(wszError[0]));
wsprintfW(wszMessage, wszError, typelib.wszFileName, hRes);
MessageBox(globals.hMainWnd, wszMessage, NULL, MB_OK|MB_ICONEXCLAMATION);
return 1;
......@@ -1516,8 +1516,8 @@ static void UpdateTypeLibStatusBar(int itemID)
{
WCHAR info[MAX_LOAD_STRING];
if(!LoadString(globals.hMainInst, itemID, info, sizeof(WCHAR[MAX_LOAD_STRING])))
LoadString(globals.hMainInst, IDS_READY, info, sizeof(WCHAR[MAX_LOAD_STRING]));
if(!LoadString(globals.hMainInst, itemID, info, sizeof(info)/sizeof(info[0])))
LoadString(globals.hMainInst, IDS_READY, info, sizeof(info)/sizeof(info[0]));
SendMessage(typelib.hStatusBar, SB_SETTEXT, 0, (LPARAM)info);
}
......@@ -1615,7 +1615,7 @@ BOOL TypeLibRegisterClass(void)
BOOL CreateTypeLibWindow(HINSTANCE hInst, WCHAR *wszFileName)
{
WCHAR wszTitle[MAX_LOAD_STRING];
LoadString(hInst, IDS_TYPELIBTITLE, wszTitle, sizeof(WCHAR[MAX_LOAD_STRING]));
LoadString(hInst, IDS_TYPELIBTITLE, wszTitle, sizeof(wszTitle)/sizeof(wszTitle[0]));
if(wszFileName) lstrcpyW(typelib.wszFileName, wszFileName);
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment