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);