From 8f6b4125819644ba91b1386170df1baa9a9c197d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 26 Feb 2024 09:15:44 +0600 Subject: Define a name for the extended path buffer size, instead of a literal Change-Id: If6d40c818e021b3241d6b6b33aceca07c6393511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163926 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- shell/source/win32/jumplist/JumpList.cxx | 5 +++-- shell/source/win32/shlxthandler/shlxthdl.cxx | 4 +++- shell/source/win32/simplemail/smplmailclient.cxx | 3 ++- shell/source/win32/spsupp/spsuppHelper.cxx | 3 ++- shell/source/win32/spsupp/spsuppServ.cxx | 8 +++++--- 5 files changed, 15 insertions(+), 8 deletions(-) (limited to 'shell/source') diff --git a/shell/source/win32/jumplist/JumpList.cxx b/shell/source/win32/jumplist/JumpList.cxx index 182af345c18e..d81aa1aa16e4 100644 --- a/shell/source/win32/jumplist/JumpList.cxx +++ b/shell/source/win32/jumplist/JumpList.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -477,13 +478,13 @@ Sequence SAL_CALL JumpListImpl::getRemovedItems(const OUString& sA item.arguments = o3tl::toU(PropVariantToStringWithDefault(propvar, L"")); PropVariantClear(&propvar); - wchar_t itemDesc[32767]; + wchar_t itemDesc[EXTENDED_MAX_PATH]; ThrowIfFailed(pShellLinkItem->GetDescription( itemDesc, std::extent::value), "GetDescription failed."); item.description = o3tl::toU(itemDesc); - wchar_t path[32767]; + wchar_t path[EXTENDED_MAX_PATH]; int icon_index; ThrowIfFailed(pShellLinkItem->GetIconLocation( path, std::extent::value, &icon_index), diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx index 13f687ad5a6b..d794e9f800b7 100644 --- a/shell/source/win32/shlxthandler/shlxthdl.cxx +++ b/shell/source/win32/shlxthandler/shlxthdl.cxx @@ -30,6 +30,8 @@ #include // declarations of DllRegisterServer/DllUnregisterServer +#include + // Module global LONG g_DllRefCnt = 0; @@ -300,7 +302,7 @@ namespace /* private */ STDAPI DllRegisterServer() { - WCHAR ModuleFileName[32767]; + WCHAR ModuleFileName[EXTENDED_MAX_PATH]; GetModuleFileNameW( GetCurrentModuleHandle(), diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx index 333277353d03..b74425a155b5 100644 --- a/shell/source/win32/simplemail/smplmailclient.cxx +++ b/shell/source/win32/simplemail/smplmailclient.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ namespace /* private */ LONG lret = RegOpenKeyW(HKEY_CURRENT_USER, L"Software\\LibreOffice\\SendAsEMailClient", &hkey); if (lret == ERROR_SUCCESS) { - wchar_t buff[32767]; + wchar_t buff[EXTENDED_MAX_PATH]; LONG sz = sizeof(buff); lret = RegQueryValueW(hkey, nullptr, buff, &sz); if (lret == ERROR_SUCCESS) diff --git a/shell/source/win32/spsupp/spsuppHelper.cxx b/shell/source/win32/spsupp/spsuppHelper.cxx index 9ee49401a3c8..5867a5ea393d 100644 --- a/shell/source/win32/spsupp/spsuppHelper.cxx +++ b/shell/source/win32/spsupp/spsuppHelper.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "res/spsuppDlg.h" @@ -31,7 +32,7 @@ const OUString& GetSofficeExe() { static const OUString s_sPath = []() { OUString result; - wchar_t sPath[32767]; + wchar_t sPath[EXTENDED_MAX_PATH]; if (GetModuleFileNameW(nullptr, sPath, std::size(sPath)) == 0) return result; wchar_t* pSlashPos = wcsrchr(sPath, L'\\'); diff --git a/shell/source/win32/spsupp/spsuppServ.cxx b/shell/source/win32/spsupp/spsuppServ.cxx index f2afd288e5bb..17d0797ed98e 100644 --- a/shell/source/win32/spsupp/spsuppServ.cxx +++ b/shell/source/win32/spsupp/spsuppServ.cxx @@ -28,6 +28,8 @@ #include // declaration of DllInstall +#include + namespace { HANDLE g_hModule; @@ -40,7 +42,7 @@ ITypeLib* GetTypeLib() typedef std::unique_ptr ITypeLibGuard; static ITypeLibGuard s_aITypeLibGuard = [] { ITypeLibGuard aITypeLibGuard(nullptr, [](IUnknown* p) { if (p) p->Release(); }); - wchar_t szFile[32767]; + wchar_t szFile[EXTENDED_MAX_PATH]; if (GetModuleFileNameW(GetHModule(), szFile, std::size(szFile)) == 0) return aITypeLibGuard; ITypeLib* pTypeLib; @@ -55,7 +57,7 @@ ITypeLib* GetTypeLib() const wchar_t* GetHelperExe() { static wchar_t* s_sPath = []() -> wchar_t* { - static wchar_t sPath[32767]; + static wchar_t sPath[EXTENDED_MAX_PATH]; if (GetModuleFileNameW(GetHModule(), sPath, std::size(sPath)) == 0) return nullptr; wchar_t* pSlashPos = wcsrchr(sPath, L'\\'); @@ -120,7 +122,7 @@ STDAPI DllRegisterServer(void) if (!pTypeLib) return ResultFromScode(SELFREG_E_TYPELIB); - wchar_t szFile[32767]; + wchar_t szFile[EXTENDED_MAX_PATH]; if (GetModuleFileNameW(GetHModule(), szFile, std::size(szFile)) == 0) return HRESULT_FROM_WIN32(GetLastError()); -- cgit