From ad4d3a960206e409a6bf3891e49147fc3ce822f7 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 25 Feb 2024 19:15:54 +0600 Subject: Replace an instance of MAX_PATH with 32767 ... which is the approximate maximum of Windows API, as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Change-Id: I2bfc2f2fa8a405ed36d6bb0c52f961028dd2fe6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163911 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski --- shell/source/win32/spsupp/spsuppServ.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'shell/source') diff --git a/shell/source/win32/spsupp/spsuppServ.cxx b/shell/source/win32/spsupp/spsuppServ.cxx index abd5ec6070d2..f2afd288e5bb 100644 --- a/shell/source/win32/spsupp/spsuppServ.cxx +++ b/shell/source/win32/spsupp/spsuppServ.cxx @@ -40,8 +40,8 @@ ITypeLib* GetTypeLib() typedef std::unique_ptr ITypeLibGuard; static ITypeLibGuard s_aITypeLibGuard = [] { ITypeLibGuard aITypeLibGuard(nullptr, [](IUnknown* p) { if (p) p->Release(); }); - wchar_t szFile[MAX_PATH]; - if (GetModuleFileNameW(GetHModule(), szFile, MAX_PATH) == 0) + wchar_t szFile[32767]; + if (GetModuleFileNameW(GetHModule(), szFile, std::size(szFile)) == 0) return aITypeLibGuard; ITypeLib* pTypeLib; if (FAILED(LoadTypeLib(szFile, &pTypeLib))) @@ -55,8 +55,8 @@ ITypeLib* GetTypeLib() const wchar_t* GetHelperExe() { static wchar_t* s_sPath = []() -> wchar_t* { - static wchar_t sPath[MAX_PATH]; - if (GetModuleFileNameW(GetHModule(), sPath, MAX_PATH) == 0) + static wchar_t sPath[32767]; + if (GetModuleFileNameW(GetHModule(), sPath, std::size(sPath)) == 0) return nullptr; wchar_t* pSlashPos = wcsrchr(sPath, L'\\'); if (pSlashPos == nullptr) @@ -120,8 +120,8 @@ STDAPI DllRegisterServer(void) if (!pTypeLib) return ResultFromScode(SELFREG_E_TYPELIB); - wchar_t szFile[MAX_PATH]; - if (GetModuleFileNameW(GetHModule(), szFile, MAX_PATH) == 0) + wchar_t szFile[32767]; + if (GetModuleFileNameW(GetHModule(), szFile, std::size(szFile)) == 0) return HRESULT_FROM_WIN32(GetLastError()); HRESULT hr = RegisterTypeLib(pTypeLib, szFile, nullptr); -- cgit