[0.4.13][SHELL32] Backport format+logging-trivia, ARRAYSIZE/_countof

Picks various trivial improvements from newer branches, does not fix specific JIRA-tickets and also doesn't
*entirely* cover a specific PR, therefore none of those are mentioned here.
Main motivation is to reduce large scale white-noise diff between the branches, to make
future commits diffs (with some fixes that actually matter) smaller in size and therefore easier to review.

Specifically:
- large-scale formatting & logging improvements, including but not limited to 0.4.15-dev-7653-g 6f91b6c0fe
- strip trailing whitespace
- also typos like 'unkown', missing \n as it was
  part of 0.4.15-dev-6323-g 3854a5d8e9 and
  0.4.15-dev-4492-g 03422451b3
  (I left out the MOUSE_MOVE-one from that, because I consider the missing \n there intentional)
- ports back many usages of ARRAYSIZE/_countof as it was added as part of some commits from Hermes, e.g.:
  *partial* pick of 0.4.15-dev-3642-g 83be315abf (I left out the literals here for now, ...
    I *might* pick them later on their own, but not now. I first want to verify their isolated impact on all compilers generated file-sizes.
    Some of those changes would even increase the binary size, especially those where the same literal is used multiple times,
    because string-pooling is currently not enabled for all toolchains and configurations.)
- COpenWithMenu.cpp: strip double-semicolon
- COpenWithMenu.cpp && folder_options.cpp: add \n to some dbg-prints without increasing their length
- CFSDropTarget.cpp: add \n to some dbg-prints, strip some good-path-traces that are no longer present in master in return to avoid size increase, fix indentation
- CShellLink.cpp: add \n to some dbg-prints without increasing their length
- iconcache.cpp: fix wrong indentation

binary size of shell32.dll has tendency to shrink slightly, which is caused solely by the logging changes:

master          RosBEWin2.2.2 GCC8.4.0 dbg x86               10.538.496 (0.4.15-dev-7640-gbdcfc6b)
releases/0.4.14 RosBEWin2.2.2 GCC8.4.0 dbg x86  9.317.888 ->  9.316.684
releases/0.4.14 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.345.024 ->  9.345.024
releases/0.4.13 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.201.152 ->  9.200.640
releases/0.4.12 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.146.880 ->  9.146.880
releases/0.4.11 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.077.760 ->  9.077.248
releases/0.4.10 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.074.176 ->  9.072.128
releases/0.4. 9 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.825.856 ->  8.824.832
releases/0.4. 8 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.740.864 ->  8.738.816
releases/0.4. 7 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.668.160 ->  8.666.624
This commit is contained in:
Joachim Henze 2024-02-25 01:33:02 +01:00
parent 6d8fa896cc
commit 4d645fbeb8
51 changed files with 665 additions and 909 deletions

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,6 @@ struct _StaticInvokeCommandMap_
{ "rename", FCIDM_SHVIEW_RENAME},
};
class CDefaultContextMenu :
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IContextMenu3,
@ -160,7 +159,6 @@ CDefaultContextMenu::CDefaultContextMenu() :
m_iIdCBLast(0),
m_iIdDfltFirst(0),
m_iIdDfltLast(0)
{
}
@ -773,7 +771,7 @@ HRESULT CDefaultContextMenu::DoPaste(LPCMINVOKECOMMANDINFO lpcmi, BOOL bLink)
dwKey = MK_SHIFT;
}
else {
ERR("No drop effect obtained");
ERR("No drop effect obtained\n");
}
GlobalUnlock(medium2.hGlobal);
}

View file

@ -1,24 +1,5 @@
/*
* IEnumFORMATETC, IDataObject
*
* selecting and droping objects within the shell and/or common dialogs
*
* Copyright 1998, 1999 <juergen.schmied@metronet.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
// LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
// COPYRIGHT: 1998-1999 <juergen.schmied@metronet.de>
#include "precomp.h"

View file

@ -111,7 +111,7 @@ COpenWithList::~COpenWithList()
BOOL COpenWithList::Load()
{
HKEY hKey;
WCHAR wszName[256], wszBuf[100];;
WCHAR wszName[256], wszBuf[100];
DWORD i = 0, cchName, dwSize;
SApp *pApp;
@ -676,7 +676,7 @@ BOOL COpenWithList::SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename)
/* Create file extension key */
if (RegCreateKeyExW(HKEY_CLASSES_ROOT, pwszExt, 0, NULL, 0, KEY_READ|KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
{
ERR("Cannot open ext key");
ERR("Can't open ext key\n");
return FALSE;
}
@ -830,7 +830,7 @@ BOOL COpenWithDialog::IsNoOpen(HWND hwnd)
return TRUE;
else if (dReturnValue == -1)
{
ERR("IsNoOpen failed to load the dialog box.");
ERR("IsNoOpen failed to load dialog box\n");
return TRUE;
}
}

View file

@ -2623,7 +2623,7 @@ HRESULT STDMETHODCALLTYPE CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
HRESULT hr = Resolve(lpici->hwnd, 0);
if (FAILED(hr))
{
TRACE("failed to resolve component with error 0x%08x", hr);
TRACE("failed to resolve component error 0x%08x\n", hr);
return hr;
}

View file

@ -51,14 +51,12 @@ public:
/* Link file formats */
#include "pshpack1.h"
struct volume_info
{
DWORD type;
DWORD serial;
WCHAR label[12]; /* assume 8.3 */
};
#include "poppack.h"
private:

View file

@ -634,5 +634,3 @@ SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
return result;
}

View file

@ -283,7 +283,7 @@ Options_RunDLLCommon(HWND hWnd, HINSTANCE hInst, int fOptions, DWORD nCmdShow)
case 1:
// show taskbar options dialog
FIXME("notify explorer to show taskbar options dialog");
FIXME("notify explorer to show taskbar options dlg\n");
//PostMessage(GetShellWindow(), WM_USER+22, fOptions, 0);
break;

View file

@ -67,8 +67,6 @@ HRESULT CFSDropTarget::_CopyItems(IShellFolder * pSFFrom, UINT cidl,
//Double NULL terminate.
wszTargetPath[wcslen(wszTargetPath) + 1] = '\0';
TRACE ("(%p)->(%p,%u,%p)\n", this, pSFFrom, cidl, apidl);
STRRET strretFrom;
hr = pSFFrom->GetDisplayNameOf(NULL, SHGDN_FORPARSING, &strretFrom);
if (FAILED_UNEXPECTEDLY(hr))
@ -446,7 +444,7 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
if (SUCCEEDED(pDataObject->QueryGetData(&fmt)))
{
hr = pDataObject->GetData(&fmt, &medium);
TRACE("CFSTR_SHELLIDLIST.\n");
TRACE("CFSTR_SHELLIDLIST\n");
/* lock the handle */
LPIDA lpcida = (LPIDA)GlobalLock(medium.hGlobal);
@ -500,33 +498,26 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
if (bLinking)
{
WCHAR wszTargetPath[MAX_PATH];
WCHAR wszPath[MAX_PATH];
WCHAR wszTarget[MAX_PATH];
wcscpy(wszTargetPath, m_sPathTarget);
TRACE("target path = %s", debugstr_w(wszTargetPath));
TRACE("target path = %s\n", debugstr_w(m_sPathTarget));
/* We need to create a link for each pidl in the copied items, so step through the pidls from the clipboard */
for (UINT i = 0; i < lpcida->cidl; i++)
{
//Find out which file we're copying
//Find out which file we're linking
STRRET strFile;
hr = psfFrom->GetDisplayNameOf(apidl[i], SHGDN_FORPARSING, &strFile);
if (FAILED(hr))
{
ERR("Error source obtaining path");
break;
}
hr = StrRetToBufW(&strFile, apidl[i], wszPath, _countof(wszPath));
if (FAILED(hr))
{
ERR("Error putting source path into buffer");
ERR("Error to put source path into buffer\n");
break;
}
TRACE("source path = %s", debugstr_w(wszPath));
// Creating a buffer to hold the combined path
WCHAR buffer_1[MAX_PATH] = L"";
@ -544,13 +535,13 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
//It's a link so, we create a new one which copies the old.
if(!_GetUniqueFileName(placementPath, pwszExt, wszTarget, TRUE))
{
ERR("Error getting unique file name");
ERR("Error to get unique filename\n");
hr = E_FAIL;
break;
}
hr = IShellLink_ConstructFromPath(wszPath, IID_PPV_ARG(IPersistFile, &ppf));
if (FAILED(hr)) {
ERR("Error constructing link from file");
ERR("Error constructing link from file\n");
break;
}
@ -565,7 +556,7 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
//Create a file name for the link
if (!_GetUniqueFileName(placementPath, L".lnk", wszTarget, TRUE))
{
ERR("Error creating unique file name");
ERR("Error creating unique filename\n");
hr = E_FAIL;
break;
}
@ -573,7 +564,7 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
CComPtr<IShellLinkW> pLink;
hr = CShellLink::_CreatorClass::CreateInstance(NULL, IID_PPV_ARG(IShellLinkW, &pLink));
if (FAILED(hr)) {
ERR("Error instantiating IShellLinkW");
ERR("Error instantiating IShellLinkW\n");
break;
}
@ -646,7 +637,7 @@ HRESULT CFSDropTarget::_DoDrop(IDataObject *pDataObject,
}
else
{
ERR("No viable drop format.\n");
ERR("No viable drop format\n");
hr = E_FAIL;
}
return hr;

View file

@ -406,7 +406,7 @@ HRESULT WINAPI CControlPanelFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_A
else if (_ILIsSpecialFolder(*apidl))
m_regFolder->GetAttributesOf(1, apidl, rgfInOut);
else
ERR("Got an unkown pidl here!\n");
ERR("Got unknown pidl\n");
apidl++;
cidl--;
}
@ -443,7 +443,6 @@ HRESULT WINAPI CControlPanelFolder::GetUIObjectOf(HWND hwndOwner,
*ppvOut = NULL;
if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1)) {
/* HACK: We should use callbacks from CDefaultContextMenu instead of creating one on our own */
BOOL bHasCpl = FALSE;
for (UINT i = 0; i < cidl; i++)

View file

@ -506,7 +506,7 @@ HRESULT WINAPI CDrivesFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLEST
else if (_ILIsSpecialFolder(pidlTemp))
m_regFolder->GetAttributesOf(1, &pidlTemp, pdwAttributes);
else
ERR("Got an unkown pidl here!\n");
ERR("Got unknown pidl\n");
}
}

View file

@ -374,7 +374,7 @@ private:
hr = SHELL32_GetCLSIDForDirectory(Tmp, L"CLSID", &clsidFolder);
if (SUCCEEDED(hr))
{
ERR("SHOULD DO SOMETHING WITH CLSID?\n");
ERR("Got CLSID override\n");
}
}
}
@ -1296,7 +1296,6 @@ void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags)
* FIXME
* if the name is in the pidl the ret value should be a STRRET_OFFSET
*/
HRESULT WINAPI CFSFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl,
DWORD dwFlags, LPSTRRET strRet)
{

View file

@ -1155,8 +1155,8 @@ HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryR
{
FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
if (!(pszRootPath) || (pszRootPath[0] == 0) ||
!(pSHQueryRBInfo) || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO)))
if (!pszRootPath || (pszRootPath[0] == 0) ||
!pSHQueryRBInfo || (pSHQueryRBInfo->cbSize < sizeof(SHQUERYRBINFO)))
{
return E_INVALIDARG;
}

View file

@ -503,7 +503,7 @@ HRESULT WINAPI CRegFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apid
if (_ILIsSpecialFolder(*apidl))
GetGuidItemAttributes(*apidl, rgfInOut);
else
ERR("Got an unkown pidl here!\n");
ERR("Got unknown pidl\n");
apidl++;
cidl--;
}

View file

@ -7,4 +7,3 @@ Please see COPYING for details
163.avi
164+169.avi
170.avi

View file

@ -25,8 +25,6 @@
#include <atlcoll.h>
#endif
WINE_DEFAULT_DEBUG_CHANNEL(desktop);
static const WCHAR szProgmanClassName[] = L"Progman";

View file

@ -162,7 +162,6 @@ HRESULT CMenuToolbarBase::OnCustomDraw(LPNMTBCUSTOMDRAW cdraw, LRESULT * theResu
return S_OK;
case CDDS_ITEMPREPAINT:
HWND tlw;
m_menuBand->_GetTopLevelWindow(&tlw);

View file

@ -61,7 +61,6 @@ class CShellMenuCallback :
public IShellMenuCallback
{
private:
HWND m_hwndTray;
CComPtr<IShellMenu> m_pShellMenu;
CComPtr<IBandSite> m_pBandSite;
@ -198,7 +197,6 @@ private:
hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, 0);
if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
else
{
@ -461,7 +459,7 @@ RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv)
hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidlProgramsAbsolute);
if (FAILED_UNEXPECTEDLY(hr))
{
WARN("USER Programs folder not found.");
WARN("USER Programs folder not found\n");
hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS, &pidlProgramsAbsolute);
if (FAILED_UNEXPECTEDLY(hr))
return hr;

View file

@ -181,7 +181,6 @@ RestoreFile(
#undef INTERFACE
#define INTERFACE IRecycleBinFile
DECLARE_INTERFACE_(IRecycleBinFile, IUnknown)
{
BEGIN_INTERFACE
@ -203,10 +202,9 @@ DECLARE_INTERFACE_(IRecycleBinFile, IUnknown)
END_INTERFACE
};
#undef INTERFACE
#define INTERFACE IRecycleBinEnumList
#define INTERFACE IRecycleBinEnumList
DECLARE_INTERFACE_(IRecycleBinEnumList, IUnknown)
{
BEGIN_INTERFACE
@ -223,10 +221,9 @@ DECLARE_INTERFACE_(IRecycleBinEnumList, IUnknown)
END_INTERFACE
};
#undef INTERFACE
#define INTERFACE IRecycleBin
#define INTERFACE IRecycleBin
DECLARE_INTERFACE_(IRecycleBin, IUnknown)
{
BEGIN_INTERFACE

View file

@ -268,7 +268,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, DWORD len, const WCHAR* fmt, const WCHAR*
if (!done || (*fmt == '1'))
{
/*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */
if (SearchPathW(lpDir, lpFile, wszExe, sizeof(xlpFile) / sizeof(WCHAR), xlpFile, NULL))
if (SearchPathW(lpDir, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
cmd = xlpFile;
else
cmd = lpFile;
@ -315,7 +315,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, DWORD len, const WCHAR* fmt, const WCHAR*
pv = SHLockShared(hmem, 0);
chars = swprintf(buf, L":%p", pv);
if (chars >= sizeof(buf) / sizeof(WCHAR))
if (chars >= ARRAY_SIZE(buf))
ERR("pidl format buffer too small!\n");
used += chars;
@ -631,7 +631,7 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, classname, 0, 0x02000000, &hkeyClass))
return SE_ERR_NOASSOC;
if (!HCR_GetDefaultVerbW(hkeyClass, lpVerb, verb, sizeof(verb) / sizeof(verb[0])))
if (!HCR_GetDefaultVerbW(hkeyClass, lpVerb, verb, ARRAY_SIZE(verb)))
return SE_ERR_NOASSOC;
RegCloseKey(hkeyClass);
@ -729,13 +729,13 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
return 33;
}
if (SearchPathW(lpPath, lpFile, wszExe, sizeof(xlpFile) / sizeof(WCHAR), xlpFile, NULL))
if (SearchPathW(lpPath, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
/* The file was found in the application-supplied default directory (or the system search path) */
}
else if (lpPath && SearchPathW(NULL, lpFile, wszExe, sizeof(xlpFile)/sizeof(WCHAR), xlpFile, NULL))
else if (lpPath && SearchPathW(NULL, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
@ -778,7 +778,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
/* See if it's a program - if GetProfileString fails, we skip this
* section. Actually, if GetProfileString fails, we've probably
* got a lot more to worry about than running a program... */
if (GetProfileStringW(L"windows", L"programs", L"exe pif bat cmd com", wBuffer, sizeof(wBuffer) / sizeof(WCHAR)) > 0)
if (GetProfileStringW(L"windows", L"programs", L"exe pif bat cmd com", wBuffer, ARRAY_SIZE(wBuffer)) > 0)
{
CharLowerW(wBuffer);
tok = wBuffer;
@ -810,7 +810,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
&classnamelen) == ERROR_SUCCESS)
{
classnamelen /= sizeof(WCHAR);
if (classnamelen == sizeof(classname) / sizeof(WCHAR))
if (classnamelen == ARRAY_SIZE(classname))
classnamelen--;
classname[classnamelen] = '\0';
@ -858,7 +858,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
{
/* Toss the leading dot */
extension++;
if (GetProfileStringW(L"extensions", extension, L"", command, sizeof(command) / sizeof(WCHAR)) > 0)
if (GetProfileStringW(L"extensions", extension, L"", command, ARRAY_SIZE(command)) > 0)
{
if (wcslen(command) != 0)
{
@ -927,14 +927,14 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
unsigned ret = SE_ERR_NOASSOC;
BOOL unicode = !(GetVersion() & 0x80000000);
if (strlenW(key) + 1 > sizeof(regkey) / sizeof(regkey[0]))
if (strlenW(key) + 1 > ARRAY_SIZE(regkey))
{
FIXME("input parameter %s larger than buffer\n", debugstr_w(key));
return 2;
}
wcscpy(regkey, key);
static const WCHAR wApplication[] = L"\\application";
endkeyLen = sizeof(regkey) / sizeof(regkey[0]) - (endkey - regkey);
endkeyLen = ARRAY_SIZE(regkey) - (endkey - regkey);
if (strlenW(wApplication) + 1 > endkeyLen)
{
FIXME("endkey %s overruns buffer\n", debugstr_w(wApplication));
@ -946,14 +946,14 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
{
WCHAR command[1024], fullpath[MAX_PATH];
static const WCHAR wSo[] = L".so";
DWORD sizeSo = sizeof(wSo) / sizeof(WCHAR);
DWORD sizeSo = ARRAY_SIZE(wSo);
LPWSTR ptr = NULL;
DWORD ret = 0;
/* Get application command from start string and find filename of application */
if (*start == '"')
{
if (strlenW(start + 1) + 1 > sizeof(command) / sizeof(command[0]))
if (strlenW(start + 1) + 1 > ARRAY_SIZE(command))
{
FIXME("size of input parameter %s larger than buffer\n",
debugstr_w(start + 1));
@ -962,7 +962,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
wcscpy(command, start + 1);
if ((ptr = wcschr(command, '"')))
* ptr = 0;
ret = SearchPathW(NULL, command, wszExe, sizeof(fullpath) / sizeof(WCHAR), fullpath, &ptr);
ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr);
}
else
{
@ -973,11 +973,11 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
int idx = space - start;
memcpy(command, start, idx * sizeof(WCHAR));
command[idx] = '\0';
if ((ret = SearchPathW(NULL, command, wszExe, sizeof(fullpath) / sizeof(WCHAR), fullpath, &ptr)))
if ((ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr)))
break;
}
if (!ret)
ret = SearchPathW(NULL, start, wszExe, sizeof(fullpath) / sizeof(WCHAR), fullpath, &ptr);
ret = SearchPathW(NULL, start, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr);
}
if (!ret)
@ -985,7 +985,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
ERR("Unable to find application path for command %s\n", debugstr_w(start));
return ERROR_ACCESS_DENIED;
}
if (strlenW(ptr) + 1 > sizeof(app) / sizeof(app[0]))
if (strlenW(ptr) + 1 > ARRAY_SIZE(app))
{
FIXME("size of found path %s larger than buffer\n", debugstr_w(ptr));
return 2;
@ -1079,8 +1079,8 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
}
}
SHELL_ArgifyW(static_res, sizeof(static_res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline, &resultLen, NULL);
if (resultLen > sizeof(static_res)/sizeof(WCHAR))
SHELL_ArgifyW(static_res, ARRAY_SIZE(static_res), exec, lpFile, pidl, szCommandline, &resultLen, NULL);
if (resultLen > ARRAY_SIZE(static_res))
{
res = dynamic_res = static_cast<WCHAR *>(HeapAlloc(GetProcessHeap(), 0, resultLen * sizeof(WCHAR)));
SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL, NULL);
@ -1146,12 +1146,12 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env,
/* Is there a replace() function anywhere? */
cmdlen /= sizeof(WCHAR);
if (cmdlen >= sizeof(cmd) / sizeof(WCHAR))
cmdlen = sizeof(cmd) / sizeof(WCHAR) - 1;
if (cmdlen >= ARRAY_SIZE(cmd))
cmdlen = ARRAY_SIZE(cmd) - 1;
cmd[cmdlen] = '\0';
SHELL_ArgifyW(param, sizeof(param) / sizeof(WCHAR), cmd, lpFile, (LPITEMIDLIST)psei->lpIDList, szCommandline, &resultLen,
SHELL_ArgifyW(param, ARRAY_SIZE(param), cmd, lpFile, (LPITEMIDLIST)psei->lpIDList, szCommandline, &resultLen,
(psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
if (resultLen > sizeof(param) / sizeof(WCHAR))
if (resultLen > ARRAY_SIZE(param))
ERR("Argify buffer not large enough, truncating\n");
}
@ -1238,7 +1238,7 @@ HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpR
if (lpDirectory)
{
GetCurrentDirectoryW(sizeof(old_dir) / sizeof(WCHAR), old_dir);
GetCurrentDirectoryW(ARRAY_SIZE(old_dir), old_dir);
SetCurrentDirectoryW(lpDirectory);
}
@ -1483,7 +1483,7 @@ static LONG ShellExecute_FromContextMenu( LPSHELLEXECUTEINFOW sei )
i = 0;
while (1)
{
r = RegEnumKeyW(hkeycm, i++, szguid, sizeof(szguid) / sizeof(szguid[0]));
r = RegEnumKeyW(hkeycm, i++, szguid, ARRAY_SIZE(szguid));
if (r != ERROR_SUCCESS)
break;
@ -1530,7 +1530,7 @@ static UINT_PTR SHELL_execute_class(LPCWSTR wszApplicationName, LPSHELLEXECUTEIN
TRACE("SEE_MASK_CLASSNAME->%s, doc->%s\n", debugstr_w(execCmd), debugstr_w(wszApplicationName));
wcmd[0] = '\0';
done = SHELL_ArgifyW(wcmd, sizeof(wcmd) / sizeof(WCHAR), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, NULL, &resultLen,
done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, NULL, &resultLen,
(psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
if (!done && wszApplicationName[0])
{
@ -1544,7 +1544,7 @@ static UINT_PTR SHELL_execute_class(LPCWSTR wszApplicationName, LPSHELLEXECUTEIN
else
strcatW(wcmd, wszApplicationName);
}
if (resultLen > sizeof(wcmd) / sizeof(WCHAR))
if (resultLen > ARRAY_SIZE(wcmd))
ERR("Argify buffer not large enough... truncating\n");
return execfunc(wcmd, NULL, FALSE, psei, psei_out);
}
@ -1569,7 +1569,7 @@ static BOOL SHELL_translate_idlist(LPSHELLEXECUTEINFOW sei, LPWSTR wszParameters
BOOL appKnownSingular = FALSE;
/* last chance to translate IDList: now also allow CLSID paths */
if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW((LPCITEMIDLIST)sei->lpIDList, buffer, sizeof(buffer)/sizeof(WCHAR)))) {
if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW((LPCITEMIDLIST)sei->lpIDList, buffer, ARRAY_SIZE(buffer)))) {
if (buffer[0] == ':' && buffer[1] == ':') {
/* open shell folder for the specified class GUID */
if (strlenW(buffer) + 1 > parametersLen)
@ -1689,14 +1689,14 @@ static void do_error_dialog(UINT_PTR retval, HWND hwnd, WCHAR* filename)
error_code = GetLastError();
if (retval == SE_ERR_NOASSOC)
LoadStringW(shell32_hInstance, IDS_SHLEXEC_NOASSOC, msg, sizeof(msg) / sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_SHLEXEC_NOASSOC, msg, ARRAY_SIZE(msg));
else
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
NULL,
error_code,
LANG_USER_DEFAULT,
msg,
sizeof(msg) / sizeof(WCHAR),
ARRAY_SIZE(msg),
(va_list*)msgArguments);
MessageBoxW(hwnd, msg, NULL, MB_ICONERROR);
@ -1735,9 +1735,9 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc)
WCHAR parametersBuffer[1024], dirBuffer[MAX_PATH], wcmdBuffer[1024];
WCHAR *wszApplicationName, *wszParameters, *wszDir, *wcmd;
DWORD dwApplicationNameLen = MAX_PATH + 2;
DWORD parametersLen = sizeof(parametersBuffer) / sizeof(WCHAR);
DWORD dirLen = sizeof(dirBuffer) / sizeof(WCHAR);
DWORD wcmdLen = sizeof(wcmdBuffer) / sizeof(WCHAR);
DWORD parametersLen = ARRAY_SIZE(parametersBuffer);
DWORD dirLen = ARRAY_SIZE(dirBuffer);
DWORD wcmdLen = ARRAY_SIZE(wcmdBuffer);
DWORD len;
SHELLEXECUTEINFOW sei_tmp; /* modifiable copy of SHELLEXECUTEINFO struct */
WCHAR wfileName[MAX_PATH];

View file

@ -781,8 +781,6 @@
#define IDM_MOVEHERE 0x8
#define IDM_LINKHERE 0xB
/* Registrar scripts (RGS) */
#define IDR_ADMINFOLDERSHORTCUT 128
#define IDR_CONTROLPANEL 130

View file

@ -1111,7 +1111,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
// Set App-specific stuff (icon, app name, szOtherStuff string)
SendDlgItemMessageW(hWnd, IDC_ABOUT_ICON, STM_SETICON, (WPARAM)info->hIcon, 0);
GetWindowTextW( hWnd, szAppTitleTemplate, sizeof(szAppTitleTemplate) / sizeof(WCHAR) );
GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate));
swprintf(szAppTitle, szAppTitleTemplate, info->szApp);
SetWindowTextW(hWnd, szAppTitle);
@ -1173,7 +1173,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
// We need the decimal point of the current locale to display the RAM size correctly
if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL,
szDecimalSeparator,
sizeof(szDecimalSeparator) / sizeof(WCHAR)) > 0)
ARRAY_SIZE(szDecimalSeparator)) > 0)
{
UCHAR uDecimals;
UINT uIntegral;
@ -1196,7 +1196,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
// Add the Authors dialog
hWndAuthors = CreateDialogW(shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT_AUTHORS), hWnd, AboutAuthorsDlgProc);
LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText);
}
@ -1247,12 +1247,12 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM
if(bShowingAuthors)
{
LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText));
ShowWindow(hWndAuthors, SW_HIDE);
}
else
{
LoadStringW( shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, sizeof(szAuthorsText) / sizeof(WCHAR) );
LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText));
ShowWindow(hWndAuthors, SW_SHOW);
}

View file

@ -144,7 +144,7 @@ HRESULT WINAPI SHCoCreateInstance(
}
/* we look up the dll path in the registry */
SHStringFromGUIDW(myclsid, sClassID, sizeof(sClassID)/sizeof(WCHAR));
SHStringFromGUIDW(myclsid, sClassID, ARRAY_SIZE(sClassID));
lstrcpyW(sKeyName, sCLSID);
lstrcatW(sKeyName, sClassID);
lstrcatW(sKeyName, sInProcServer32);

View file

@ -355,12 +355,12 @@ int ShellMessageBoxW(
hInstance,hWnd,lpText,lpCaption,uType);
if (IS_INTRESOURCE(lpCaption))
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, ARRAY_SIZE(szTitle));
else
pszTitle = lpCaption;
if (IS_INTRESOURCE(lpText))
LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0]));
LoadStringW(hInstance, LOWORD(lpText), szText, ARRAY_SIZE(szText));
else
pszText = lpText;

View file

@ -116,7 +116,7 @@ HRESULT WINAPI SHRegQueryValueExW (
LPDWORD pcbData)
{
DWORD ret;
WARN("%p %s %p %p %p %p semi-stub\n",
TRACE("%p %s %p %p %p %p\n",
hkey, debugstr_w(pszValue), pdwReserved, pdwType, pvData, pcbData);
ret = RegQueryValueExW(hkey, pszValue, pdwReserved, pdwType, pvData, pcbData);
return ret;