From 034d1a61e8ac83d3b91819f7a19d7cb34e2902d3 Mon Sep 17 00:00:00 2001 From: Lakshmi Priya Sekar Date: Tue, 25 Aug 2015 16:19:37 -0700 Subject: Replace MAX_PATH with new defines in vm. --- src/inc/bbsweep.h | 16 ++++++------- src/palrt/path.cpp | 4 ++-- src/utilcode/util_nodependencies.cpp | 2 +- src/vm/appdomain.cpp | 4 ++-- src/vm/aptca.cpp | 2 +- src/vm/assembly.cpp | 4 ++-- src/vm/assemblynative.cpp | 6 ++--- src/vm/ceemain.cpp | 14 ++++++------ src/vm/codeman.cpp | 10 ++++----- src/vm/comisolatedstorage.cpp | 4 ++-- src/vm/commodule.cpp | 10 ++++----- src/vm/compile.cpp | 20 ++++++++--------- src/vm/corhost.cpp | 2 +- src/vm/crossgenroresolvenamespace.cpp | 4 ++-- src/vm/debugdebugger.cpp | 4 ++-- src/vm/dwbucketmanager.hpp | 4 ++-- src/vm/dwreport.cpp | 6 ++--- src/vm/eventreporter.cpp | 4 ++-- src/vm/eventtrace.cpp | 10 ++++----- src/vm/excep.cpp | 10 ++++----- src/vm/fusioninit.cpp | 42 +++++++++++++++++------------------ src/vm/hosting.cpp | 10 ++++----- src/vm/ilmarshalers.h | 10 ++++----- src/vm/pefile.cpp | 8 +++---- src/vm/peimage.cpp | 6 ++--- src/vm/peimage.h | 2 +- src/vm/peimagelayout.cpp | 6 ++--- src/vm/perfmap.cpp | 4 ++-- src/vm/profattach.cpp | 2 +- src/vm/profattach.h | 2 +- src/vm/profattachclient.cpp | 2 +- src/vm/profilinghelper.cpp | 2 +- src/vm/rtlfunctions.cpp | 8 +++---- src/vm/securityconfig.cpp | 12 +++++----- src/vm/securitypolicy.cpp | 28 +++++++++++------------ src/vm/tlbexport.cpp | 2 +- src/vm/util.cpp | 22 +++++++++--------- src/vm/util.hpp | 2 +- src/vm/winrthelpers.cpp | 6 ++--- 39 files changed, 158 insertions(+), 158 deletions(-) (limited to 'src') diff --git a/src/inc/bbsweep.h b/src/inc/bbsweep.h index 455e07ffb0..8b57369cc7 100644 --- a/src/inc/bbsweep.h +++ b/src/inc/bbsweep.h @@ -277,23 +277,23 @@ private: } #endif // !FEATURE_CORESYSTEM - WCHAR objectName[MAX_PATH]; - WCHAR objectNamePrefix[MAX_PATH]; + WCHAR objectName[MAX_LONGPATH]; + WCHAR objectNamePrefix[MAX_LONGPATH]; GetObjectNamePrefix(processID, fromRuntime, objectNamePrefix); // if there is a non-empty name prefix, append a '\' if (objectNamePrefix[0] != '\0') wcscat_s(objectNamePrefix, ARRAYSIZE(objectNamePrefix), W("\\")); - swprintf_s(objectName, MAX_PATH, W("%sBBSweep_hSweepMutex"), objectNamePrefix); + swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hSweepMutex"), objectNamePrefix); hSweepMutex = ::WszCreateMutex(pSecurityAttributes, false, objectName); - swprintf_s(objectName, MAX_PATH, W("%sBBSweep_hProfDataWriterMutex"), objectNamePrefix); + swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hProfDataWriterMutex"), objectNamePrefix); hProfDataWriterMutex = ::WszCreateMutex(pSecurityAttributes, false, objectName); - swprintf_s(objectName, MAX_PATH, W("%sBBSweep_hSweepEvent"), objectNamePrefix); + swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hSweepEvent"), objectNamePrefix); hSweepEvent = ::WszCreateEvent(pSecurityAttributes, true, false, objectName); // Note that hTerminateEvent is not a named event. That is because it is not // shared amongst the CLR processes (each process terminates at a different time) hTerminationEvent = ::WszCreateEvent(pSecurityAttributes, true, false, NULL); - swprintf_s(objectName, MAX_PATH, W("%sBBSweep_hProfWriterSemaphore"), objectNamePrefix); + swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hProfWriterSemaphore"), objectNamePrefix); hProfWriterSemaphore = ::WszCreateSemaphore(pSecurityAttributes, MAX_COUNT, MAX_COUNT, objectName); #ifndef FEATURE_CORESYSTEM // @CORESYSTEMTODO @@ -373,7 +373,7 @@ cleanup: // construct the object name prefix using AppContainerNamedObjectPath if (OpenProcessToken(hProcess, TOKEN_QUERY, &hToken) && IsAppContainerProcess(hToken)) { - WCHAR appxNamedObjPath[MAX_PATH] = { 0 }; + WCHAR appxNamedObjPath[MAX_LONGPATH] = { 0 }; ULONG appxNamedObjPathBufLen = 0; if (fromRuntime) @@ -399,7 +399,7 @@ cleanup: DWORD sessionId = 0; ProcessIdToSessionId(processID, &sessionId); pfnGetAppContainerNamedObjectPath(hToken, NULL, sizeof (appxNamedObjPath) / sizeof (WCHAR), appxNamedObjPath, &appxNamedObjPathBufLen); - swprintf_s(objectNamePrefix, MAX_PATH, W("Global\\Session\\%d\\%s"), sessionId, appxNamedObjPath); + swprintf_s(objectNamePrefix, MAX_LONGPATH, W("Global\\Session\\%d\\%s"), sessionId, appxNamedObjPath); } } } diff --git a/src/palrt/path.cpp b/src/palrt/path.cpp index 6b6f81af73..3aaae18a27 100644 --- a/src/palrt/path.cpp +++ b/src/palrt/path.cpp @@ -412,7 +412,7 @@ Returns: pointer to lpszDest STDAPI_(LPWSTR) PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile) { #ifdef DEBUG - RIPMSG(lpszDest && IS_VALID_WRITE_BUFFER(lpszDest, TCHAR, MAX_PATH), "PathCombine: caller passed bad lpszDest"); + RIPMSG(lpszDest && IS_VALID_WRITE_BUFFER(lpszDest, TCHAR, MAX_LONGPATH), "PathCombine: caller passed bad lpszDest"); RIPMSG(!lpszDir || IS_VALID_STRING_PTR(lpszDir, -1), "PathCombine: caller passed bad lpszDir"); RIPMSG(!lpszFile || IS_VALID_STRING_PTR(lpszFile, -1), "PathCombine: caller passed bad lpszFile"); RIPMSG(lpszDir || lpszFile, "PathCombine: caller neglected to pass lpszDir or lpszFile"); @@ -421,7 +421,7 @@ STDAPI_(LPWSTR) PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile) if (lpszDest) { - TCHAR szTemp[MAX_PATH]; + TCHAR szTemp[MAX_LONGPATH]; LPWSTR pszT; *szTemp = W('\0'); diff --git a/src/utilcode/util_nodependencies.cpp b/src/utilcode/util_nodependencies.cpp index 135e1737c5..8246a2074a 100644 --- a/src/utilcode/util_nodependencies.cpp +++ b/src/utilcode/util_nodependencies.cpp @@ -321,7 +321,7 @@ HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __ino } // Get the appname to look up in the exclusion or inclusion list. - WCHAR appPath[MAX_PATH + 2]; + WCHAR appPath[MAX_LONGPATH + 2]; DWORD ret = WszGetModuleFileName(NULL, appPath, NumItems(appPath)); diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 62b07478b0..bc3f474e15 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -4775,8 +4775,8 @@ void SystemDomain::GetDevpathW(__out_ecount_opt(1) LPWSTR* pDevpath, DWORD* pdwD RegKeyHolder userKey; RegKeyHolder machineKey; - WCHAR pVersion[MAX_PATH]; - DWORD dwVersion = MAX_PATH; + WCHAR pVersion[MAX_PATH_FNAME]; + DWORD dwVersion = MAX_PATH_FNAME; HRESULT hr = S_OK; hr = FusionBind::GetVersion(pVersion, &dwVersion); if(SUCCEEDED(hr)) { diff --git a/src/vm/aptca.cpp b/src/vm/aptca.cpp index fdb8869386..65c334a422 100644 --- a/src/vm/aptca.cpp +++ b/src/vm/aptca.cpp @@ -420,7 +420,7 @@ namespace DWORD cchSubKeySize = 0; if (WszRegQueryInfoKey(hKeyAptca, NULL, NULL, NULL, NULL, &cchSubKeySize, NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { - cchSubKeySize = MAX_PATH; + cchSubKeySize = MAX_PATH_FNAME; } ++cchSubKeySize; diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index ba722d6f95..45045e1bce 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -4301,7 +4301,7 @@ void Assembly::WriteBreadcrumb(const SString &ssDisplayName) { STANDARD_VM_CONTRACT; - WCHAR path[MAX_PATH]; + WCHAR path[MAX_LONGPATH]; HRESULT hr = WszSHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, ARRAYSIZE(path), path); if (hr != S_OK) { @@ -5127,7 +5127,7 @@ ExistingOobAssemblyList::ExistingOobAssemblyList() for (DWORD i = 0; ; i++) { - WCHAR name[MAX_PATH + 1]; + WCHAR name[MAX_PATH_FNAME + 1]; DWORD cchName = ARRAYSIZE(name); status = RegEnumKeyExW(hKey, i, name, &cchName, NULL, NULL, NULL, NULL); diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index 3b542cddd8..40df0068c5 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -2335,8 +2335,8 @@ void QCALLTYPE AssemblyNative::CreateVersionInfoResource(LPCWSTR pwzFilename, const void *pvData=0; // Pointer to the resource. ULONG cbData; // Size of the resource data. ULONG cbWritten; - WCHAR szFile[MAX_PATH+1]; // File name for resource file. - WCHAR szPath[MAX_PATH+1]; // Path name for resource file. + WCHAR szFile[MAX_PATH_FNAME+1]; // File name for resource file. + WCHAR szPath[MAX_LONGPATH+1]; // Path name for resource file. HandleHolder hFile; res.SetInfo(pwzFilename, @@ -2358,7 +2358,7 @@ void QCALLTYPE AssemblyNative::CreateVersionInfoResource(LPCWSTR pwzFilename, // messages including the path/file name // Persist to a file. - if (!WszGetTempPath(MAX_PATH, szPath)) + if (!WszGetTempPath(MAX_LONGPATH, szPath)) COMPlusThrowWin32(); if (!WszGetTempFileName(szPath, W("RES"), 0, szFile)) COMPlusThrowWin32(); diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 07c037fa41..c6e67d0e8c 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -2941,9 +2941,9 @@ static BOOL CacheCommandLine(__in LPWSTR pCmdLine, __in_opt LPWSTR* ArgvW) } if (ArgvW != NULL && ArgvW[0] != NULL) { - WCHAR wszModuleName[MAX_PATH]; - WCHAR wszCurDir[MAX_PATH]; - if (!WszGetCurrentDirectory(MAX_PATH, wszCurDir)) + WCHAR wszModuleName[MAX_LONGPATH]; + WCHAR wszCurDir[MAX_LONGPATH]; + if (!WszGetCurrentDirectory(MAX_LONGPATH, wszCurDir)) return FALSE; #ifdef _PREFAST_ @@ -3077,13 +3077,13 @@ BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn) EX_TRY_NOCATCH(LPWSTR, pImageNameInner, pImageNameIn) { - WCHAR wzPath[MAX_PATH]; + WCHAR wzPath[MAX_LONGPATH]; DWORD dwPathLength = 0; // get the path of executable - dwPathLength = WszGetFullPathName(pImageNameInner, MAX_PATH, wzPath, NULL); + dwPathLength = WszGetFullPathName(pImageNameInner, MAX_LONGPATH, wzPath, NULL); - if (!dwPathLength || dwPathLength > MAX_PATH) + if (!dwPathLength || dwPathLength > MAX_LONGPATH) { ThrowWin32( !dwPathLength ? GetLastError() : ERROR_FILENAME_EXCED_RANGE); } @@ -4262,7 +4262,7 @@ static HRESULT InitializeIPCManager(void) if (!WszGetModuleFileName(GetModuleInst(), (PWSTR) g_pIPCManagerInterface-> GetInstancePath(), - MAX_PATH)) + MAX_LONGPATH)) { hr = HRESULT_FROM_GetLastErrorNA(); } diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp index e00dff78ee..5e409600fa 100644 --- a/src/vm/codeman.cpp +++ b/src/vm/codeman.cpp @@ -1345,15 +1345,15 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I HRESULT hr = E_FAIL; #ifdef FEATURE_MERGE_JIT_AND_ENGINE - WCHAR CoreClrFolder[MAX_PATH + 1]; + WCHAR CoreClrFolder[MAX_LONGPATH + 1]; extern HINSTANCE g_hThisInst; - if (WszGetModuleFileName(g_hThisInst, CoreClrFolder, MAX_PATH)) + if (WszGetModuleFileName(g_hThisInst, CoreClrFolder, MAX_LONGPATH)) { WCHAR *filePtr = wcsrchr(CoreClrFolder, DIRECTORY_SEPARATOR_CHAR_W); if (filePtr) { filePtr[1] = W('\0'); - wcscat_s(CoreClrFolder, MAX_PATH, pwzJitName); + wcscat_s(CoreClrFolder, MAX_LONGPATH, pwzJitName); *phJit = CLRLoadLibrary(CoreClrFolder); if (*phJit != NULL) { @@ -1550,8 +1550,8 @@ BOOL EEJitManager::LoadJIT() // back to JIT64. This same file is also used to prevent this app from participating in AutoNgen. if (AppX::IsAppXProcess()) { - WCHAR szPathName[MAX_PATH]; - UINT32 cchPathName = MAX_PATH; + WCHAR szPathName[MAX_LONGPATH]; + UINT32 cchPathName = MAX_LONGPATH; if (AppX::FindFileInCurrentPackage(L"UseLegacyJit.txt", &cchPathName, szPathName, PACKAGE_FILTER_HEAD) == S_OK) { fUsingCompatJit = TRUE; diff --git a/src/vm/comisolatedstorage.cpp b/src/vm/comisolatedstorage.cpp index fd31a079fd..cba98c6adb 100644 --- a/src/vm/comisolatedstorage.cpp +++ b/src/vm/comisolatedstorage.cpp @@ -312,7 +312,7 @@ void QCALLTYPE COMIsolatedStorageFile::GetRootDir(DWORD dwF QCALL_CONTRACT; BEGIN_QCALL; - WCHAR wszPath[MAX_PATH + 1]; + WCHAR wszPath[MAX_LONGPATH + 1]; GetRootDirInternal(dwFlags, wszPath, COUNTOF(wszPath)); retRootDir.Set(wszPath); @@ -550,7 +550,7 @@ void COMIsolatedStorageFile::GetRootDirInternal( CONTRACTL { STANDARD_VM_CHECK; PRECONDITION(cPath > 1); - PRECONDITION(cPath <= MAX_PATH + 1); + PRECONDITION(cPath <= MAX_LONGPATH + 1); } CONTRACTL_END; ULONG len; diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp index 25c02ae64d..ee57e6f206 100644 --- a/src/vm/commodule.cpp +++ b/src/vm/commodule.cpp @@ -989,21 +989,21 @@ void QCALLTYPE COMModule::GetFullyQualifiedName(QCall::ModuleHandle pModule, QCa // if (pModule->GetFile()->GetAssembly()->GetILimage()->IsTrustedNativeImage()) { - WCHAR fileNameWithoutNi[MAX_PATH]; + WCHAR fileNameWithoutNi[MAX_LONGPATH]; - wcscpy_s(fileNameWithoutNi, MAX_PATH, fileName); + wcscpy_s(fileNameWithoutNi, MAX_LONGPATH, fileName); if (StringEndsWith(fileName, W(".ni.dll"))) { - wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.dll")), MAX_PATH, W(".dll")); + wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.dll")), MAX_LONGPATH, W(".dll")); } else if (StringEndsWith(fileName, W(".ni.exe"))) { - wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.exe")), MAX_PATH, W(".exe")); + wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.exe")), MAX_LONGPATH, W(".exe")); } else if (StringEndsWith(fileName, W(".ni.winmd"))) { - wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.winmd")), MAX_PATH, W(".winmd")); + wcscpy_s(fileNameWithoutNi + wcslen(fileNameWithoutNi) - wcslen(W(".ni.winmd")), MAX_LONGPATH, W(".winmd")); } retString.Set(fileNameWithoutNi); diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 3cbe518648..e03905e69e 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -3078,7 +3078,7 @@ private: // interfaces and close the PDB file BEFORE this holder tries to *delete* the PDB // file. Also, keep these two in this relative order, so that m_deletePDBFileHolder // is destructed before m_wszPDBFilePath. - WCHAR m_wszPDBFilePath[MAX_PATH]; + WCHAR m_wszPDBFilePath[MAX_LONGPATH]; DeleteFileHolder m_deletePDBFileHolder; // // ************* NOTE! ************* @@ -3249,7 +3249,7 @@ HRESULT NGenModulePdbWriter::WriteStringTable() UINT64 cbStringTableEstimate = sizeof(DWORD) + sizeof(CV_DebugSSubsectionHeader_t) + - m_cDocs * (MAX_PATH + 1); + m_cDocs * (MAX_LONGPATH + 1); if (!FitsIn(cbStringTableEstimate)) { return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); @@ -3276,7 +3276,7 @@ HRESULT NGenModulePdbWriter::WriteStringTable() // The actual strings for (ULONG32 i=0; i < m_cDocs; i++) { - WCHAR wszURL[MAX_PATH]; + WCHAR wszURL[MAX_LONGPATH]; ULONG32 cchURL; hr = m_rgpDocs[i]->GetURL(_countof(wszURL), &cchURL, wszURL); if (FAILED(hr)) @@ -3361,7 +3361,7 @@ HRESULT NGenModulePdbWriter::InitILPdbData() GetSvcLogger()->Log(W("Loaded managed PDB")); // Grab the full path of the managed PDB so we can log it - WCHAR wszIlPdbPath[MAX_PATH]; + WCHAR wszIlPdbPath[MAX_LONGPATH]; ULONG32 cchIlPdbPath; hr = m_pReader->GetSymbolStoreFileName( _countof(wszIlPdbPath), @@ -3698,8 +3698,8 @@ HRESULT NGenModulePdbWriter::WriteFileChecksums() // write it into the NGEN PDB. for (ULONG32 i=0; i < m_cDocs; i++) { - WCHAR wszURL[MAX_PATH]; - char szURL[MAX_PATH]; + WCHAR wszURL[MAX_LONGPATH]; + char szURL[MAX_LONGPATH]; ULONG32 cchURL; hr = m_rgpDocs[i]->GetURL(_countof(wszURL), &cchURL, wszURL); if (FAILED(hr)) @@ -4171,7 +4171,7 @@ HRESULT NGenMethodLinesPdbWriter::WriteLinesSubsection( BOOL fBeginNewBlock = TRUE; ULONG32 iSeqPointsPrev = (ULONG32) -1; DWORD dwNativeOffsetPrev = (DWORD) -1; - WCHAR wszURLPrev[MAX_PATH]; + WCHAR wszURLPrev[MAX_LONGPATH]; memset(&wszURLPrev, 0, sizeof(wszURLPrev)); LPBYTE pbEnd = NULL; @@ -4197,7 +4197,7 @@ HRESULT NGenMethodLinesPdbWriter::WriteLinesSubsection( // This is the first iteration where we're looking at this iSeqPoints. So // check whether the document name has changed on us. If it has, that means // we need to start a new block. - WCHAR wszURL[MAX_PATH]; + WCHAR wszURL[MAX_LONGPATH]; ULONG32 cchURL; hr = m_rgpDocs[iSeqPoints]->GetURL(_countof(wszURL), &cchURL, wszURL); if (FAILED(hr)) @@ -4238,7 +4238,7 @@ HRESULT NGenMethodLinesPdbWriter::WriteLinesSubsection( } // Now get the info we'll need for the next block - char szURL[MAX_PATH]; + char szURL[MAX_LONGPATH]; int cbWritten = WideCharToMultiByte( CP_UTF8, 0, // dwFlags @@ -7859,7 +7859,7 @@ HRESULT { if (NingenEnabled()) { - WCHAR buf[MAX_PATH + sizeof(CONFIGURATION_EXTENSION)/sizeof(WCHAR) + 1]; + WCHAR buf[MAX_LONGPATH + sizeof(CONFIGURATION_EXTENSION)/sizeof(WCHAR) + 1]; if (0 != wcscpy_s(buf, sizeof(buf)/sizeof(*buf), path)) { COMPlusThrowHR(COR_E_PATHTOOLONG); diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp index 2e8d5aa4b7..451043fc45 100644 --- a/src/vm/corhost.cpp +++ b/src/vm/corhost.cpp @@ -6774,7 +6774,7 @@ HRESULT CCLRErrorReportingManager::SetApplicationData(ApplicationDataKey key, WC if(g_fEEStarted) return HOST_E_INVALIDOPERATION; - if (pValue == NULL || wcslen(pValue) > MAX_PATH) + if (pValue == NULL || wcslen(pValue) > MAX_LONGPATH) return E_INVALIDARG; HRESULT hr = S_OK; diff --git a/src/vm/crossgenroresolvenamespace.cpp b/src/vm/crossgenroresolvenamespace.cpp index e31adaff69..5ef041f46f 100644 --- a/src/vm/crossgenroresolvenamespace.cpp +++ b/src/vm/crossgenroresolvenamespace.cpp @@ -78,7 +78,7 @@ FindNamespaceFileInDirectory( if (wszDirectory == nullptr) return ERROR_NOT_SUPPORTED; - WCHAR wszFilePath[MAX_PATH + 1]; + WCHAR wszFilePath[MAX_LONGPATH + 1]; wcscpy_s( wszFilePath, _countof(wszFilePath), @@ -90,7 +90,7 @@ FindNamespaceFileInDirectory( if (*(wszFirstFileNameChar - 1) != '\\') *wszFirstFileNameChar++ = '\\'; - WCHAR wszRemainingNamespace[MAX_PATH +1]; + WCHAR wszRemainingNamespace[MAX_PATH_FNAME +1]; wcscpy_s( wszRemainingNamespace, _countof(wszRemainingNamespace), diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp index 3a620fae9f..4219b85551 100644 --- a/src/vm/debugdebugger.cpp +++ b/src/vm/debugdebugger.cpp @@ -625,7 +625,7 @@ FCIMPL3(void, DebugStackTrace::GetStackFramesInternal, // Use the MethodDesc... ULONG32 sourceLine = 0; ULONG32 sourceColumn = 0; - WCHAR wszFileName[MAX_PATH]; + WCHAR wszFileName[MAX_LONGPATH]; ULONG32 fileNameLength = 0; { @@ -747,7 +747,7 @@ FCIMPL3(void, DebugStackTrace::GetStackFramesInternal, // Also get the filename from the document... _ASSERTE (documents [j] != NULL); - hr = documents [j]->GetURL (MAX_PATH, &fileNameLength, wszFileName); + hr = documents [j]->GetURL (MAX_LONGPATH, &fileNameLength, wszFileName); _ASSERTE ( SUCCEEDED(hr) || (hr == E_OUTOFMEMORY) || (hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY)) ); diff --git a/src/vm/dwbucketmanager.hpp b/src/vm/dwbucketmanager.hpp index cd727f7b82..11d56de66b 100644 --- a/src/vm/dwbucketmanager.hpp +++ b/src/vm/dwbucketmanager.hpp @@ -486,7 +486,7 @@ void BaseBucketParamsManager::GetAppName(__out_ecount(maxLength) WCHAR* targetPa CONTRACTL_END; HMODULE hModule = WszGetModuleHandle(NULL); - WCHAR appPath[MAX_PATH]; + WCHAR appPath[MAX_LONGPATH]; DWORD cchAppPath = NumItems(appPath); if (GetCurrentModuleFileName(appPath, &cchAppPath) == S_OK) @@ -510,7 +510,7 @@ void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targe CONTRACTL_END; HMODULE hModule = WszGetModuleHandle(NULL); - WCHAR appPath[MAX_PATH]; + WCHAR appPath[MAX_LONGPATH]; DWORD cchAppPath = NumItems(appPath); WCHAR verBuf[23]; diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp index ccf41ea953..9fe8ca76be 100644 --- a/src/vm/dwreport.cpp +++ b/src/vm/dwreport.cpp @@ -215,7 +215,7 @@ BOOL RegisterOutOfProcessWatsonCallbacks() CONTRACTL_END; WCHAR wszDACName[] = MAIN_DAC_MODULE_NAME_W W(".dll"); - WCHAR wszDACPath[MAX_PATH]; + WCHAR wszDACPath[MAX_LONGPATH]; DWORD dwSize = 0; if ((FAILED(::GetCORSystemDirectoryInternal(wszDACPath, NumItems(wszDACPath), &dwSize))) || @@ -1471,8 +1471,8 @@ BOOL RunWatson( startupInfo.cb = sizeof(STARTUPINFOW); - WCHAR watsonAppName[MAX_PATH]; - WCHAR watsonCommandLine[MAX_PATH+1]; + WCHAR watsonAppName[MAX_LONGPATH]; + WCHAR watsonCommandLine[MAX_LONGPATH+1]; { #if !defined(FEATURE_CORECLR) diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp index 72f7ba9976..747a0454ef 100644 --- a/src/vm/eventreporter.cpp +++ b/src/vm/eventreporter.cpp @@ -47,7 +47,7 @@ EventReporter::EventReporter(EventReporterType type) m_eventType = type; HMODULE hModule = WszGetModuleHandle(NULL); - WCHAR appPath[MAX_PATH]; + WCHAR appPath[MAX_LONGPATH]; DWORD ret = WszGetModuleFileName(hModule, appPath, NumItems(appPath)); fBufferFull = FALSE; @@ -739,7 +739,7 @@ void EventReporter::GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * p _ASSERTE(hModRuntime != NULL); // Get the path to the runtime - WCHAR runtimePath[MAX_PATH]; + WCHAR runtimePath[MAX_LONGPATH]; DWORD ret = WszGetModuleFileName(hModRuntime, runtimePath, NumItems(runtimePath)); if (ret != 0) { diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 0587daef9d..055fb2f6f5 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -4846,7 +4846,7 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type) PCWSTR szDtraceOutput1=W(""),szDtraceOutput2=W(""); UINT8 startupMode = 0; UINT startupFlags = 0; - WCHAR dllPath[MAX_PATH+1] = {0}; + WCHAR dllPath[MAX_LONGPATH+1] = {0}; UINT8 Sku = 0; _ASSERTE(g_fEEManagedEXEStartup || //CLR started due to a managed exe g_fEEIJWStartup || //CLR started as a mixed mode Assembly @@ -4931,7 +4931,7 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type) startupMode = ETW::InfoLog::InfoStructs::Other; } - _ASSERTE (NumItems(dllPath) > MAX_PATH); + _ASSERTE (NumItems(dllPath) > MAX_LONGPATH); // if WszGetModuleFileName fails, we return an empty string if (!WszGetModuleFileName(GetCLRModule(), dllPath, MAX_PATH)) { dllPath[0] = 0; @@ -5761,10 +5761,10 @@ static void GetCodeViewInfo(Module * pModule, CV_INFO_PDB70 * pCvInfoIL, CV_INFO return; // cbDebugData actually can be < sizeof(CV_INFO_PDB70), since the "path" field - // can be truncated to its actual data length (i.e., fewer than MAX_PATH chars + // can be truncated to its actual data length (i.e., fewer than MAX_LONGPATH chars // may be present in the PE file). In some cases, though, cbDebugData will - // include all MAX_PATH chars even though path gets null-terminated well before - // the MAX_PATH limit. + // include all MAX_LONGPATH chars even though path gets null-terminated well before + // the MAX_LONGPATH limit. // Gotta have at least one byte of the path if (cbDebugData < offsetof(CV_INFO_PDB70, path) + sizeof(char)) diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 4c595409c7..9b6020f6b1 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -13865,7 +13865,7 @@ VOID GetAssemblyDetailInfo(SString &sType, { WRAPPER_NO_CONTRACT; - InlineSString sFormat; + InlineSString sFormat; #ifdef FEATURE_FUSION const WCHAR *pwzLoadContext = GetContextName(pPEAssembly->GetLoadContext(), pPEAssembly->IsIntrospectionOnly()); @@ -13921,8 +13921,8 @@ VOID CheckAndThrowSameTypeAndAssemblyInvalidCastException(TypeHandle thCastFrom, _ASSERTE(pPEAssemblyTypeFrom != NULL); _ASSERTE(pPEAssemblyTypeTo != NULL); - InlineSString sAssemblyFromDisplayName; - InlineSString sAssemblyToDisplayName; + InlineSString sAssemblyFromDisplayName; + InlineSString sAssemblyToDisplayName; pPEAssemblyTypeFrom->GetDisplayName(sAssemblyFromDisplayName); pPEAssemblyTypeTo->GetDisplayName(sAssemblyToDisplayName); @@ -13930,8 +13930,8 @@ VOID CheckAndThrowSameTypeAndAssemblyInvalidCastException(TypeHandle thCastFrom, // Found the culprit case. Now format the new exception text. InlineSString strCastFromName; InlineSString strCastToName; - InlineSString sAssemblyDetailInfoFrom; - InlineSString sAssemblyDetailInfoTo; + InlineSString sAssemblyDetailInfoFrom; + InlineSString sAssemblyDetailInfoTo; thCastFrom.GetName(strCastFromName); thCastTo.GetName(strCastToName); diff --git a/src/vm/fusioninit.cpp b/src/vm/fusioninit.cpp index 9408c8b620..b246308e38 100644 --- a/src/vm/fusioninit.cpp +++ b/src/vm/fusioninit.cpp @@ -41,8 +41,8 @@ STDAPI InitializeNativeBinder(); extern HMODULE g_pMSCorEE; extern BOOL g_bRunningOnNT6OrHigher; -WCHAR g_szWindowsDir[MAX_PATH+1]; -WCHAR g_FusionDllPath[MAX_PATH+1]; +WCHAR g_szWindowsDir[MAX_LONGPATH+1]; +WCHAR g_FusionDllPath[MAX_LONGPATH+1]; HINSTANCE g_hInst = NULL; HMODULE g_hMSCorEE = NULL; DWORD g_dwLogInMemory; @@ -57,7 +57,7 @@ BOOL g_fWow64Process; // Wow64 Process PEKIND g_peKindProcess; List *g_pDownloadList; BOOL g_bLogToWininet; -WCHAR g_wzCustomLogPath[MAX_PATH]; +WCHAR g_wzCustomLogPath[MAX_LONGPATH]; DWORD g_dwConfigForceUnification; DWORD g_dwFileInUseRetryAttempts; DWORD g_dwFileInUseMillisecondsBetweenRetries; @@ -77,7 +77,7 @@ extern LCID g_lcid; IIdentityAuthority *g_pIdentityAuthority; CIdentityCache *g_pIdentityCache; -WCHAR g_wzEXEPath[MAX_PATH+1]; +WCHAR g_wzEXEPath[MAX_LONGPATH+1]; #ifdef _DEBUG @@ -100,8 +100,8 @@ pfnMsiInstallProductW g_pfnMsiInstallProductW; BOOL g_bCheckedMSIPresent; HMODULE g_hModMSI; -WCHAR g_wzLocalDevOverridePath[MAX_PATH + 1]; -WCHAR g_wzGlobalDevOverridePath[MAX_PATH + 1]; +WCHAR g_wzLocalDevOverridePath[MAX_LONGPATH + 1]; +WCHAR g_wzGlobalDevOverridePath[MAX_LONGPATH + 1]; DWORD g_dwDevOverrideFlags; HRESULT GetScavengerQuotasFromReg(DWORD *pdwZapQuotaInGAC, @@ -262,7 +262,7 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() #define _GetConfigDWORD(name, default) GetConfigDWORD(hKey, name, default) // Get this executable's filename - fExecutableIsKnown = WszGetModuleFileName(NULL, g_wzEXEPath, MAX_PATH); + fExecutableIsKnown = WszGetModuleFileName(NULL, g_wzEXEPath, MAX_LONGPATH); if(!fExecutableIsKnown) { hr = StringCbCopy(g_wzEXEPath, sizeof(g_wzEXEPath), W("Unknown")); if (FAILED(hr)) { @@ -283,19 +283,19 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() // executable, then read it pwzFileName = PathFindFileName(g_wzEXEPath); if(fExecutableIsKnown && pwzFileName) { - WCHAR wzValue[MAX_PATH + 1]; + WCHAR wzValue[MAX_LONGPATH + 1]; HKEY hKeyExeName = NULL; DWORD dwType = REG_SZ; wzValue[0] = W('\0'); // key name + '\' + filename + null - if(lstrlenW(REG_KEY_IMAGE_FILE_EXECUTION_OPTIONS) + 1 + lstrlenW(pwzFileName) + 1 > MAX_PATH) { + if(lstrlenW(REG_KEY_IMAGE_FILE_EXECUTION_OPTIONS) + 1 + lstrlenW(pwzFileName) + 1 > MAX_PATH_FNAME) { hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); goto Exit; } - hr = StringCchPrintf(wzValue, MAX_PATH, W("%ws\\%ws"), + hr = StringCchPrintf(wzValue, MAX_PATH_FNAME, W("%ws\\%ws"), REG_KEY_IMAGE_FILE_EXECUTION_OPTIONS, pwzFileName); if (FAILED(hr)) { goto Exit; @@ -309,7 +309,7 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() } } else { // Success - dwSize = MAX_PATH * sizeof(WCHAR); + dwSize = MAX_LONGPATH * sizeof(WCHAR); wzValue[0] = W('\0'); lResult = WszRegQueryValueEx(hKeyExeName, BINDING_CONFIGURATION, NULL, &dwType, (LPBYTE)wzValue, &dwSize); @@ -339,8 +339,8 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() // If we didn't get a path from the registry, // try the ENV variable. if(!wzBindingConfigPath[0]) { - dwSize = WszGetEnvironmentVariable(BINDING_CONFIGURATION, wzBindingConfigPath, MAX_PATH); - if(dwSize > MAX_PATH) { + dwSize = WszGetEnvironmentVariable(BINDING_CONFIGURATION, wzBindingConfigPath, MAX_LONGPATH); + if(dwSize > MAX_LONGPATH) { hr = HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); goto Exit; } @@ -423,10 +423,10 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() } { - WCHAR wzBuf[MAX_PATH]; + WCHAR wzBuf[1]; wzBuf[0] = W('\0'); - dwSize = WszGetEnvironmentVariable(W("USE_LEGACY_IDENTITY_FORMAT"), wzBuf, MAX_PATH); + dwSize = WszGetEnvironmentVariable(W("USE_LEGACY_IDENTITY_FORMAT"), wzBuf, 1); if (dwSize == 1 && !FusionCompareString(wzBuf, W("1"))) { g_dwUseLegacyIdentityFormat = 1; } @@ -434,7 +434,7 @@ HRESULT STDMETHODCALLTYPE InitializeFusion() if (IsLoggingNeeded()) { g_bLogToWininet = TRUE; - dwSize = MAX_PATH; + dwSize = MAX_LONGPATH; DWORD dwAttr; BOOL fExists; g_wzCustomLogPath[0] = W('\0'); @@ -524,13 +524,13 @@ HRESULT SetupDevOverride(LPCWSTR pwzBindingConfigDevOverridePath) if (g_dwDevOverrideEnable != 0) { // Check local dev path - if (!WszGetModuleFileName(NULL, g_wzLocalDevOverridePath, MAX_PATH)) { + if (!WszGetModuleFileName(NULL, g_wzLocalDevOverridePath, MAX_LONGPATH)) { hr = HRESULT_FROM_GetLastError(); goto Exit; } - if (lstrlenW(g_wzLocalDevOverridePath) + lstrlenW(DEVOVERRIDE_PATH) <= MAX_PATH) { - // Only process .devoverride if the total path length <= MAX_PATH + if (lstrlenW(g_wzLocalDevOverridePath) + lstrlenW(DEVOVERRIDE_PATH) <= MAX_LONGPATH) { + // Only process .devoverride if the total path length <= MAX_LONGPATH hr = StringCbCat(g_wzLocalDevOverridePath, sizeof(g_wzLocalDevOverridePath), DEVOVERRIDE_PATH); if (FAILED(hr)) { @@ -565,7 +565,7 @@ HRESULT SetupDevOverride(LPCWSTR pwzBindingConfigDevOverridePath) // BINDING_CONFIGURATION Env check if(pwzBindingConfigDevOverridePath && pwzBindingConfigDevOverridePath[0]) { - WCHAR wzTempPath[MAX_PATH + 1]; + WCHAR wzTempPath[MAX_LONGPATH + 1]; BOOL fExists = FALSE; WIN32_FILE_ATTRIBUTE_DATA fileInfo; @@ -610,7 +610,7 @@ HRESULT SetupDevOverride(LPCWSTR pwzBindingConfigDevOverridePath) } if(g_dwDevOverrideFlags & DEVOVERRIDE_GLOBAL) { - PathAddBackslashWrap(g_wzGlobalDevOverridePath, MAX_PATH); + PathAddBackslashWrap(g_wzGlobalDevOverridePath, MAX_LONGPATH); } } diff --git a/src/vm/hosting.cpp b/src/vm/hosting.cpp index 6003aefb32..9b01712c7e 100644 --- a/src/vm/hosting.cpp +++ b/src/vm/hosting.cpp @@ -1738,10 +1738,10 @@ STDAPI CorLaunchApplication (HOST_TYPE dwClickOnceHost, } } } - wszDirectory = new WCHAR[MAX_PATH + 1]; - wszVersion = new WCHAR[MAX_PATH + 1]; + wszDirectory = new WCHAR[MAX_LONGPATH + 1]; + wszVersion = new WCHAR[MAX_PATH_FNAME + 1]; wszVersion[0] = 0; // we don't prefer any version - DWORD cchBuffer = MAX_PATH; + DWORD cchBuffer = MAX_LONGPATH; // Use GetRequestedRuntimeInfo because MetaHost APIs do not yet support architecture arguments. // Calls to GetRequestedRuntimeInfo() will goes to a local copy inside clr.dll, @@ -1769,8 +1769,8 @@ STDAPI CorLaunchApplication (HOST_TYPE dwClickOnceHost, 0, // startupFlags dwRuntimeInfoFlags, // Will bind to post-v2 runtimes if EXE PE runtime version is post-v2 // or EXE has config file binding to post-v2 runtime. - wszDirectory, MAX_PATH, NULL, // Retrieve bound directory - wszVersion, MAX_PATH, NULL); // Retrieve bound version + wszDirectory, MAX_LONGPATH, NULL, // Retrieve bound directory + wszVersion, MAX_PATH_FNAME, NULL); // Retrieve bound version if (SUCCEEDED(hr)) { commandLine.Append(wszDirectory); diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h index 7b3f753bf8..5a2453b603 100644 --- a/src/vm/ilmarshalers.h +++ b/src/vm/ilmarshalers.h @@ -2010,7 +2010,7 @@ public: enum { // If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack - MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH + 1) * 2 + MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2 }; ILWSTRBufferMarshaler() : @@ -2039,7 +2039,7 @@ public: enum { // If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack - MAX_LOCAL_BUFFER_LENGTH = MAX_PATH + 1 + MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1 }; ILCSTRBufferMarshaler() : @@ -2440,7 +2440,7 @@ public: enum { // If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack - MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH + 1) * 2 + sizeof(DWORD) + MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2 + sizeof(DWORD) }; @@ -2536,7 +2536,7 @@ public: enum { // If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack - MAX_LOCAL_BUFFER_LENGTH = MAX_PATH + 1 + MAX_LOCAL_BUFFER_LENGTH = MAX_PATH_FNAME + 1 }; ILCSTRMarshaler() : @@ -2565,7 +2565,7 @@ public: enum { // If required buffer length > MAX_LOCAL_BUFFER_LENGTH, don't optimize by allocating memory on stack - MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH + 1) * 2 + 4 + MAX_LOCAL_BUFFER_LENGTH = (MAX_PATH_FNAME + 1) * 2 + 4 }; ILBSTRMarshaler() : diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index 658d7f5ca6..517092549c 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -3911,8 +3911,8 @@ void PEAssembly::SetNativeImage(IBindResult *pNativeFusionAssembly) CONTRACTL_END; StackSString path; - WCHAR pwzPath[MAX_PATH]; - DWORD dwCCPath = MAX_PATH; + WCHAR pwzPath[MAX_LONGPATH]; + DWORD dwCCPath = MAX_LONGPATH; ReleaseHolder pIAssemblyLocation; IfFailThrow(pNativeFusionAssembly->GetAssemblyLocation(&pIAssemblyLocation)); @@ -4846,9 +4846,9 @@ PEModule::PEModule(PEImage *image, PEAssembly *assembly, mdFile token, IMetaData { IAssemblyLocation *pIAssemblyLocation = assembly->GetNativeAssemblyLocation(); - WCHAR wzPath[MAX_PATH]; + WCHAR wzPath[MAX_LONGPATH]; WCHAR *pwzTemp = NULL; - DWORD dwCCPath = MAX_PATH; + DWORD dwCCPath = MAX_LONGPATH; SString path; SString moduleName(SString::Utf8, GetSimpleName()); diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp index 705f165d00..b421214b4e 100644 --- a/src/vm/peimage.cpp +++ b/src/vm/peimage.cpp @@ -424,7 +424,7 @@ void PEImage::GetPathFromDll(HINSTANCE hMod, SString &result) CONTRACTL_END; DWORD ret; - DWORD length = MAX_PATH; + DWORD length = MAX_LONGPATH; do { WCHAR *buffer = result.OpenUnicodeBuffer(length); @@ -1367,7 +1367,7 @@ void PEImage::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) continue; } // Because data may be corrupted make sure we null terminate the string. - pCvInfo->path[MAX_PATH - 1] = '\0'; + pCvInfo->path[MAX_LONGPATH - 1] = '\0'; //Find the filename from pdb full path char* fileName = strrchr(pCvInfo->path, '\\'); @@ -1381,7 +1381,7 @@ void PEImage::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) memmove(pCvInfo->path, fileName, fileNameLenght); // NULL out the rest of the path buffer. - for (size_t i = fileNameLenght; i < MAX_PATH - 1; i++) + for (size_t i = fileNameLenght; i < MAX_PATH_FNAME - 1; i++) { pCvInfo->path[i] = '\0'; } diff --git a/src/vm/peimage.h b/src/vm/peimage.h index 8fb4efe850..6aa95918bf 100644 --- a/src/vm/peimage.h +++ b/src/vm/peimage.h @@ -53,7 +53,7 @@ struct CV_INFO_PDB70 DWORD magic; GUID signature; // unique identifier DWORD age; // an always-incrementing value - char path[MAX_PATH]; // zero terminated string with the name of the PDB file + char path[MAX_LONGPATH]; // zero terminated string with the name of the PDB file }; typedef DPTR(class PEImage) PTR_PEImage; diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index 0178664ebd..066cb0d2a7 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -318,9 +318,9 @@ RawImageLayout::RawImageLayout(const void *mapped, PEImage* pOwner, BOOL bTakeOw if (bTakeOwnership) { #ifndef FEATURE_PAL - WCHAR wszDllName[MAX_PATH]; - WszGetModuleFileName((HMODULE)mapped, wszDllName, MAX_PATH); - wszDllName[MAX_PATH - 1] = W('\0'); + WCHAR wszDllName[MAX_LONGPATH]; + WszGetModuleFileName((HMODULE)mapped, wszDllName, MAX_LONGPATH); + wszDllName[MAX_LONGPATH - 1] = W('\0'); m_LibraryHolder=CLRLoadLibraryEx(wszDllName,NULL,GetLoadWithAlteredSearchPathFlag()); #else // !FEATURE_PAL _ASSERTE(!"bTakeOwnership Should not be used on FEATURE_PAL"); diff --git a/src/vm/perfmap.cpp b/src/vm/perfmap.cpp index ccb511fc86..f868bcf817 100644 --- a/src/vm/perfmap.cpp +++ b/src/vm/perfmap.cpp @@ -60,8 +60,8 @@ PerfMap::PerfMap(int pid) m_ErrorEncountered = false; // Build the path to the map file on disk. - WCHAR tempPath[MAX_PATH+1]; - if(!GetTempPathW(MAX_PATH, tempPath)) + WCHAR tempPath[MAX_LONGPATH+1]; + if(!GetTempPathW(MAX_LONGPATH, tempPath)) { return; } diff --git a/src/vm/profattach.cpp b/src/vm/profattach.cpp index 0703606dc6..05b9f2ca4c 100644 --- a/src/vm/profattach.cpp +++ b/src/vm/profattach.cpp @@ -1282,7 +1282,7 @@ HRESULT CLRProfilingImpl::AttachProfiler(DWORD dwProfileeProcessID, } CONTRACTL_END; - WCHAR wszRuntimeVersion[MAX_PATH]; + WCHAR wszRuntimeVersion[MAX_PATH_FNAME]; DWORD dwSize = _countof(wszRuntimeVersion); HRESULT hr = GetCORVersionInternal(wszRuntimeVersion, dwSize, &dwSize); if (FAILED(hr)) diff --git a/src/vm/profattach.h b/src/vm/profattach.h index be96e23a93..20dca65f16 100644 --- a/src/vm/profattach.h +++ b/src/vm/profattach.h @@ -126,7 +126,7 @@ public: CLSID m_clsidProfiler; // The path to the profiler's COM object to load - WCHAR m_wszProfilerPath[MAX_PATH]; + WCHAR m_wszProfilerPath[MAX_LONGPATH]; // Client data is custom data that the profiler's // trigger-process wishes to copy into this process. diff --git a/src/vm/profattachclient.cpp b/src/vm/profattachclient.cpp index b406a68118..bd117770c8 100644 --- a/src/vm/profattachclient.cpp +++ b/src/vm/profattachclient.cpp @@ -210,7 +210,7 @@ HRESULT ProfilingAPIAttachClient::AttachProfiler( return E_INVALIDARG; } - if ((wszProfilerPath != NULL) && (wcslen(wszProfilerPath) >= MAX_PATH)) + if ((wszProfilerPath != NULL) && (wcslen(wszProfilerPath) >= MAX_LONGPATH)) { return E_INVALIDARG; } diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp index 7efc952d78..5468e42bb7 100644 --- a/src/vm/profilinghelper.cpp +++ b/src/vm/profilinghelper.cpp @@ -792,7 +792,7 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup() return S_FALSE; } - if ((wszProfilerDLL != NULL) && (wcslen(wszProfilerDLL) >= MAX_PATH)) + if ((wszProfilerDLL != NULL) && (wcslen(wszProfilerDLL) >= MAX_LONGPATH)) { LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but COR_PROFILER_PATH was not set properly.\n")); diff --git a/src/vm/rtlfunctions.cpp b/src/vm/rtlfunctions.cpp index d2c5b54785..60d001c96a 100644 --- a/src/vm/rtlfunctions.cpp +++ b/src/vm/rtlfunctions.cpp @@ -77,20 +77,20 @@ VOID InstallEEFunctionTable ( CONTRACTL_END; static LPWSTR wszModuleName = NULL; - static WCHAR rgwModuleName[MAX_PATH] = {0}; + static WCHAR rgwModuleName[MAX_LONGPATH] = {0}; if (wszModuleName == NULL) { WCHAR rgwTempName[MAX_PATH] = {0}; - DWORD dwTempNameSize = MAX_PATH; + DWORD dwTempNameSize = MAX_LONGPATH; // Leaves trailing backslash on path, producing something like "c:\windows\microsoft.net\framework\v4.0.x86dbg\" HRESULT hr = GetInternalSystemDirectory(rgwTempName, &dwTempNameSize); //finish creating complete path and copy to buffer if we can if (FAILED(hr) || - (wcscat_s(rgwTempName, MAX_PATH, MAIN_DAC_MODULE_DLL_NAME_W) != 0) || - (wcscpy_s(rgwModuleName, MAX_PATH, rgwTempName) != 0)) + (wcscat_s(rgwTempName, MAX_LONGPATH, MAIN_DAC_MODULE_DLL_NAME_W) != 0) || + (wcscpy_s(rgwModuleName, MAX_LONGPATH, rgwTempName) != 0)) { // The CLR should become unavailable in this case. EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); } diff --git a/src/vm/securityconfig.cpp b/src/vm/securityconfig.cpp index ba4d47a4e2..91ede52859 100644 --- a/src/vm/securityconfig.cpp +++ b/src/vm/securityconfig.cpp @@ -2014,9 +2014,9 @@ void QCALLTYPE SecurityConfig::_GetMachineDirectory(QCall::StringHandleOnStack r BEGIN_QCALL; - WCHAR machine[MAX_PATH]; + WCHAR machine[MAX_LONGPATH]; - HRESULT hr = GetMachineDirectory(machine, MAX_PATH); + HRESULT hr = GetMachineDirectory(machine, MAX_LONGPATH); if (FAILED(hr)) ThrowHR(hr); @@ -2031,9 +2031,9 @@ void QCALLTYPE SecurityConfig::_GetUserDirectory(QCall::StringHandleOnStack retD BEGIN_QCALL; - WCHAR user[MAX_PATH]; + WCHAR user[MAX_LONGPATH]; - BOOL result = GetUserDirectory(user, MAX_PATH); + BOOL result = GetUserDirectory(user, MAX_LONGPATH); if (result) retDirectory.Set(user); @@ -2065,10 +2065,10 @@ BOOL SecurityConfig::GetVIUserDirectory(__out_ecount(bufferCount) __out_z WCHAR* { STANDARD_VM_CONTRACT; - WCHAR scratchBuffer[MAX_PATH]; + WCHAR scratchBuffer[MAX_LONGPATH]; BOOL retval = FALSE; - DWORD size = MAX_PATH; + DWORD size = MAX_LONGPATH; if (!GetUserDir(buffer, bufferCount, TRUE)) goto CLEANUP; diff --git a/src/vm/securitypolicy.cpp b/src/vm/securitypolicy.cpp index 3d287b6179..189e5fd7bb 100644 --- a/src/vm/securitypolicy.cpp +++ b/src/vm/securitypolicy.cpp @@ -59,12 +59,12 @@ void SecurityPolicy::InitPolicyConfig() { // Note: These buffers should be at least as big as the longest possible // string that will be placed into them by the code below. - const size_t cchcache = MAX_PATH + sizeof( W("defaultusersecurity.config.cch") ) / sizeof( WCHAR ) + 1; - const size_t cchconfig = MAX_PATH + sizeof( W("defaultusersecurity.config.cch") ) / sizeof( WCHAR ) + 1; + const size_t cchcache = MAX_LONGPATH + sizeof( W("defaultusersecurity.config.cch") ) / sizeof( WCHAR ) + 1; + const size_t cchconfig = MAX_LONGPATH + sizeof( W("defaultusersecurity.config.cch") ) / sizeof( WCHAR ) + 1; NewArrayHolder cache(new WCHAR[cchcache]); NewArrayHolder config(new WCHAR[cchconfig]); - HRESULT hr = SecurityConfig::GetMachineDirectory(config, MAX_PATH); + HRESULT hr = SecurityConfig::GetMachineDirectory(config, MAX_LONGPATH); if (FAILED(hr)) ThrowHR(hr); @@ -73,7 +73,7 @@ void SecurityPolicy::InitPolicyConfig() wcscat_s( cache, cchcache, W(".cch") ); SecurityConfig::InitData( SecurityConfig::MachinePolicyLevel, config, cache ); - hr = SecurityConfig::GetMachineDirectory(config, MAX_PATH); + hr = SecurityConfig::GetMachineDirectory(config, MAX_LONGPATH); if (FAILED(hr)) ThrowHR(hr); @@ -82,7 +82,7 @@ void SecurityPolicy::InitPolicyConfig() wcscat_s( cache, cchcache, W(".cch") ); SecurityConfig::InitData( SecurityConfig::EnterprisePolicyLevel, config, cache ); - BOOL result = SecurityConfig::GetUserDirectory(config, MAX_PATH); + BOOL result = SecurityConfig::GetUserDirectory(config, MAX_LONGPATH); if (result) { wcscat_s( config, cchconfig, W("security.config") ); wcscpy_s( cache, cchcache, config ); @@ -677,10 +677,10 @@ void QCALLTYPE SecurityPolicy::_GetLongPathName(LPCWSTR wszPath, QCall::StringHa BEGIN_QCALL; #if !defined(PLATFORM_UNIX) - WCHAR wszBuffer[MAX_PATH + 1]; + WCHAR wszBuffer[MAX_LONGPATH + 1]; ZeroMemory(wszBuffer, sizeof(wszBuffer)); - if (SecurityPolicy::GetLongPathNameHelper( wszPath, wszBuffer, MAX_PATH ) != 0) + if (SecurityPolicy::GetLongPathNameHelper( wszPath, wszBuffer, MAX_LONGPATH ) != 0) { retLongPath.Set( wszBuffer ); } @@ -708,9 +708,9 @@ size_t SecurityPolicy::GetLongPathNameHelper( const WCHAR* wszShortPath, __inout // trying GetLongPathName on every subdirectory until // it succeeds or we run out of string. - WCHAR wszIntermediateBuffer[MAX_PATH]; + WCHAR wszIntermediateBuffer[MAX_LONGPATH]; - if (wcslen( wszShortPath ) >= MAX_PATH) + if (wcslen( wszShortPath ) >= MAX_LONGPATH) return 0; wcscpy_s( wszIntermediateBuffer, COUNTOF(wszIntermediateBuffer), wszShortPath ); @@ -736,13 +736,13 @@ size_t SecurityPolicy::GetLongPathNameHelper( const WCHAR* wszShortPath, __inout #pragma prefast(pop) #endif - size = WszGetLongPathName(wszIntermediateBuffer, wszBuffer, MAX_PATH); + size = WszGetLongPathName(wszIntermediateBuffer, wszBuffer, MAX_LONGPATH); if (size != 0) { size_t sizeBuffer = wcslen( wszBuffer ); - if (sizeBuffer + wcslen( &wszIntermediateBuffer[index] ) > MAX_PATH - 2) + if (sizeBuffer + wcslen( &wszIntermediateBuffer[index] ) > MAX_LONGPATH - 2) { return 0; } @@ -759,7 +759,7 @@ size_t SecurityPolicy::GetLongPathNameHelper( const WCHAR* wszShortPath, __inout return 0; } - else if (size > MAX_PATH) + else if (size > MAX_LONGPATH) { return 0; } @@ -777,8 +777,8 @@ void QCALLTYPE SecurityPolicy::GetDeviceName(LPCWSTR wszDriveLetter, QCall::Stri #if !defined(FEATURE_CORECLR) BEGIN_QCALL; - WCHAR networkName[MAX_PATH]; - DWORD networkNameSize = MAX_PATH; + WCHAR networkName[MAX_LONGPATH]; + DWORD networkNameSize = MAX_LONGPATH; ZeroMemory( networkName, sizeof( networkName ) ); UINT driveType = WszGetDriveType( wszDriveLetter ); diff --git a/src/vm/tlbexport.cpp b/src/vm/tlbexport.cpp index d7894b2210..17861387bc 100644 --- a/src/vm/tlbexport.cpp +++ b/src/vm/tlbexport.cpp @@ -796,7 +796,7 @@ void TypeLibExporter::Convert( // Win2K: passing in too long a filename triggers a nasty buffer overrun bug // when the SaveAll() method is called. We'll avoid triggering this here. // - if (wcslen(szTlbName) > MAX_PATH) + if (wcslen(szTlbName) > MAX_PATH_FNAME) IfFailReport(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE)); // Reverting to old behavior here until we can fix up the vtable offsets as well. diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 46e7f4c7bc..5abf8c880a 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -1297,7 +1297,7 @@ HRESULT WszSHGetFolderPath( HANDLE hToken, DWORD dwFlags, size_t cchPathMax, - __out_ecount(MAX_PATH) LPWSTR pwszPath) + __out_ecount(MAX_LONGPATH) LPWSTR pwszPath) { CONTRACTL { @@ -1307,8 +1307,8 @@ HRESULT WszSHGetFolderPath( } CONTRACTL_END; - // SHGetFolderPath requirement: path buffer >= MAX_PATH chars - _ASSERTE(cchPathMax >= MAX_PATH); + // SHGetFolderPath requirement: path buffer >= MAX_LONGPATH chars + _ASSERTE(cchPathMax >= MAX_LONGPATH); HRESULT hr; ULONG maxLength = MAX_PATH; @@ -1465,16 +1465,16 @@ BOOL IsUsingValidAppDataPath(__in_z WCHAR *userPath) } CONTRACTL_END; - WCHAR defaultPath[MAX_PATH]; + WCHAR defaultPath[MAX_LONGPATH]; HRESULT hr; HANDLE hToken; hToken = (HANDLE)(-1); - hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA, hToken, SHGFP_TYPE_CURRENT, MAX_PATH, defaultPath); + hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA, hToken, SHGFP_TYPE_CURRENT, MAX_LONGPATH, defaultPath); if (FAILED(hr)) { - hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA, hToken, SHGFP_TYPE_DEFAULT, MAX_PATH, defaultPath); + hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA, hToken, SHGFP_TYPE_DEFAULT, MAX_LONGPATH, defaultPath); } if (FAILED(hr)) return FALSE; @@ -1512,11 +1512,11 @@ BOOL GetUserDir(__out_ecount(bufferCount) WCHAR * buffer, size_t bufferCount, BO // In Windows ME, there is currently a bug that makes local appdata and roaming appdata // point to the same location, so we've decided to "do our own thing" and add \Local Settings before \Application Data if (!fRoaming) { - WCHAR appdatafolder[MAX_PATH]; - hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, MAX_PATH, appdatafolder); + WCHAR appdatafolder[MAX_LONGPATH]; + hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, MAX_LONGPATH, appdatafolder); if (FAILED(hr)) { - hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_DEFAULT, MAX_PATH, appdatafolder); + hr = WszSHGetFolderPath(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_DEFAULT, MAX_LONGPATH, appdatafolder); } if (FAILED(hr)) return FALSE; @@ -1532,7 +1532,7 @@ BOOL GetUserDir(__out_ecount(bufferCount) WCHAR * buffer, size_t bufferCount, BO if (!wcscmp(appdatafolder, buffer)) { - WCHAR tempPartialPath[MAX_PATH]; + WCHAR tempPartialPath[MAX_LONGPATH]; ULONG slen = (ULONG)wcslen(buffer); if (buffer[slen - 1] == W('\\')) @@ -1706,7 +1706,7 @@ BOOL GetInternetCacheDir(__out_ecount(bufferCount) WCHAR * buffer, size_t buffer } CONTRACTL_END; - _ASSERTE( bufferCount == MAX_PATH && "You should pass in a buffer of size MAX_PATH" ); + _ASSERTE( bufferCount == MAX_LONGPATH && "You should pass in a buffer of size MAX_LONGPATH" ); HRESULT hr = WszSHGetFolderPath( NULL, CSIDL_INTERNET_CACHE, NULL, SHGFP_TYPE_CURRENT, bufferCount, buffer ); if (FAILED(hr)) diff --git a/src/vm/util.hpp b/src/vm/util.hpp index 0b4fb0a46b..0b5cf5fe85 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -365,7 +365,7 @@ HRESULT LoadMscorsn(); #ifndef FEATURE_PAL -HRESULT WszSHGetFolderPath(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, size_t cchPath, __out_ecount(MAX_PATH) LPWSTR pszwPath); +HRESULT WszSHGetFolderPath(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, size_t cchPath, __out_ecount(MAX_LONGPATH) LPWSTR pszwPath); HRESULT WszShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd); #ifndef DACCESS_COMPILE diff --git a/src/vm/winrthelpers.cpp b/src/vm/winrthelpers.cpp index a294a67ad0..25f77cf726 100644 --- a/src/vm/winrthelpers.cpp +++ b/src/vm/winrthelpers.cpp @@ -147,10 +147,10 @@ GetBindableWinRTName( // Therefore we do not have to use file name to create fake type name IfFailRet(GetFirstWinRTTypeDef(pMDInternalImport, &szNameSpace, &szTypeName, NULL, NULL)); - DWORD dwSize = MAX_PATH; - WCHAR wzAsmName[MAX_PATH]; + DWORD dwSize = MAX_PATH_FNAME; + WCHAR wzAsmName[MAX_PATH_FNAME]; - dwSize = MAX_PATH * sizeof(WCHAR); + dwSize = MAX_PATH_FNAME * sizeof(WCHAR); IfFailRet(pIAssemblyName->GetProperty(ASM_NAME_NAME, wzAsmName, &dwSize)); StackSString sNamespaceAndType(wzAsmName); -- cgit v1.2.3