Replace MAX_PATH with new defines in vm.
authorLakshmi Priya Sekar <lasekar@microsoft.com>
Tue, 25 Aug 2015 23:19:37 +0000 (16:19 -0700)
committerLakshmi Priya Sekar <lasekar@microsoft.com>
Tue, 25 Aug 2015 23:27:45 +0000 (16:27 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/034d1a61e8ac83d3b91819f7a19d7cb34e2902d3

39 files changed:
src/coreclr/src/inc/bbsweep.h
src/coreclr/src/palrt/path.cpp
src/coreclr/src/utilcode/util_nodependencies.cpp
src/coreclr/src/vm/appdomain.cpp
src/coreclr/src/vm/aptca.cpp
src/coreclr/src/vm/assembly.cpp
src/coreclr/src/vm/assemblynative.cpp
src/coreclr/src/vm/ceemain.cpp
src/coreclr/src/vm/codeman.cpp
src/coreclr/src/vm/comisolatedstorage.cpp
src/coreclr/src/vm/commodule.cpp
src/coreclr/src/vm/compile.cpp
src/coreclr/src/vm/corhost.cpp
src/coreclr/src/vm/crossgenroresolvenamespace.cpp
src/coreclr/src/vm/debugdebugger.cpp
src/coreclr/src/vm/dwbucketmanager.hpp
src/coreclr/src/vm/dwreport.cpp
src/coreclr/src/vm/eventreporter.cpp
src/coreclr/src/vm/eventtrace.cpp
src/coreclr/src/vm/excep.cpp
src/coreclr/src/vm/fusioninit.cpp
src/coreclr/src/vm/hosting.cpp
src/coreclr/src/vm/ilmarshalers.h
src/coreclr/src/vm/pefile.cpp
src/coreclr/src/vm/peimage.cpp
src/coreclr/src/vm/peimage.h
src/coreclr/src/vm/peimagelayout.cpp
src/coreclr/src/vm/perfmap.cpp
src/coreclr/src/vm/profattach.cpp
src/coreclr/src/vm/profattach.h
src/coreclr/src/vm/profattachclient.cpp
src/coreclr/src/vm/profilinghelper.cpp
src/coreclr/src/vm/rtlfunctions.cpp
src/coreclr/src/vm/securityconfig.cpp
src/coreclr/src/vm/securitypolicy.cpp
src/coreclr/src/vm/tlbexport.cpp
src/coreclr/src/vm/util.cpp
src/coreclr/src/vm/util.hpp
src/coreclr/src/vm/winrthelpers.cpp

index 455e07f..8b57369 100644 (file)
@@ -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);
                     }
                 }
             }
index 6b6f81a..3aaae18 100644 (file)
@@ -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');
index 135e173..8246a20 100644 (file)
@@ -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));
 
index 62b0747..bc3f474 100644 (file)
@@ -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)) {
index fdb8869..65c334a 100644 (file)
@@ -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;
 
index ba722d6..45045e1 100644 (file)
@@ -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);
 
index 3b542cd..40df006 100644 (file)
@@ -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</TODO>
 
     // Persist to a file.
-    if (!WszGetTempPath(MAX_PATH, szPath))
+    if (!WszGetTempPath(MAX_LONGPATH, szPath))
         COMPlusThrowWin32();
     if (!WszGetTempFileName(szPath, W("RES"), 0, szFile))
         COMPlusThrowWin32();
index 07c037f..c6e67d0 100644 (file)
@@ -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();
         }
index e00dff7..5e40960 100644 (file)
@@ -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;
index fd31a07..cba98c6 100644 (file)
@@ -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;
index 25c02ae..ee57e6f 100644 (file)
@@ -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);
index 3cbe518..e03905e 100644 (file)
@@ -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<ULONG32>(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);
index 2e8d5aa..451043f 100644 (file)
@@ -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;
index e31adaf..5ef041f 100644 (file)
@@ -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), 
index 3a620fa..4219b85 100644 (file)
@@ -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)) );
 
 
index cd727f7..11d56de 100644 (file)
@@ -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];
index ccf41ea..9fe8ca7 100644 (file)
@@ -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)
index 72f7ba9..747a045 100644 (file)
@@ -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)
     {
index 0587dae..055fb2f 100644 (file)
@@ -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))
index 4c59540..9b6020f 100644 (file)
@@ -13865,7 +13865,7 @@ VOID GetAssemblyDetailInfo(SString    &sType,
 {
     WRAPPER_NO_CONTRACT;
 
-    InlineSString<MAX_PATH> sFormat;
+    InlineSString<MAX_LONGPATH> 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<MAX_PATH> sAssemblyFromDisplayName;
-         InlineSString<MAX_PATH> sAssemblyToDisplayName;
+         InlineSString<MAX_LONGPATH> sAssemblyFromDisplayName;
+         InlineSString<MAX_LONGPATH> 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<MAX_CLASSNAME_LENGTH + 1> strCastFromName;
          InlineSString<MAX_CLASSNAME_LENGTH + 1> strCastToName;
-         InlineSString<MAX_PATH> sAssemblyDetailInfoFrom;
-         InlineSString<MAX_PATH> sAssemblyDetailInfoTo;
+         InlineSString<MAX_LONGPATH> sAssemblyDetailInfoFrom;
+         InlineSString<MAX_LONGPATH> sAssemblyDetailInfoTo;
 
          thCastFrom.GetName(strCastFromName);
          thCastTo.GetName(strCastToName);
index 9408c8b..b246308 100644 (file)
@@ -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<CAssemblyDownload *>    *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);
         }
     }
 
index 6003aef..9b01712 100644 (file)
@@ -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);
index 7b3f753..5a2453b 100644 (file)
@@ -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() :
index 658d7f5..5170925 100644 (file)
@@ -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<IAssemblyLocation> 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());
 
index 705f165..b421214 100644 (file)
@@ -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';
                         }
index 8fb4efe..6aa9591 100644 (file)
@@ -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;
index 0178664..066cb0d 100644 (file)
@@ -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");
index ccb511f..f868bcf 100644 (file)
@@ -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;
     }
index 0703606..05b9f2c 100644 (file)
@@ -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))
index be96e23..20dca65 100644 (file)
@@ -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.
index b406a68..bd11777 100644 (file)
@@ -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;
     }
index 7efc952..5468e42 100644 (file)
@@ -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"));
 
index d2c5b54..60d001c 100644 (file)
@@ -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);
         }
index ba4d47a..91ede52 100644 (file)
@@ -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;
index 3d287b6..189e5fd 100644 (file)
@@ -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<WCHAR> cache(new WCHAR[cchcache]);
         NewArrayHolder<WCHAR> 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 );
index d7894b2..1786138 100644 (file)
@@ -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.
index 46e7f4c..5abf8c8 100644 (file)
@@ -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))
index 0b4fb0a..0b5cf5f 100644 (file)
@@ -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
index a294a67..25f77cf 100644 (file)
@@ -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);