summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp4
-rw-r--r--src/coreclr/hosts/coreconsole/coreconsole.cpp8
-rw-r--r--src/coreclr/hosts/corerun/corerun.cpp6
-rw-r--r--src/dlls/dbgshim/dbgshim.cpp2
-rw-r--r--src/gc/gc.cpp2
-rw-r--r--src/inc/corhost.h2
-rw-r--r--src/inc/eventtracebase.h4
-rw-r--r--src/inc/utilcode.h2
-rw-r--r--src/strongname/api/strongnamecoreclr.cpp2
-rw-r--r--src/tools/crossgen/crossgen.cpp7
-rw-r--r--src/vm/comisolatedstorage.h2
-rw-r--r--src/vm/compile.cpp8
-rw-r--r--src/vm/corhost.cpp5
-rw-r--r--src/vm/excep.cpp8
-rw-r--r--src/vm/interoputil.cpp4
-rw-r--r--src/vm/olevariant.cpp2
-rw-r--r--src/vm/securityconfig.cpp2
-rw-r--r--src/zap/zapimage.cpp2
18 files changed, 42 insertions, 30 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index f34f642137..1ee3eabc0b 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -12698,11 +12698,11 @@ DECLARE_API(SaveModule)
IMAGE_DOS_HEADER DosHeader;
if (g_ExtData->ReadVirtual(TO_CDADDR(dllBase), &DosHeader, sizeof(DosHeader), NULL) != S_OK)
- return FALSE;
+ return S_FALSE;
IMAGE_NT_HEADERS Header;
if (g_ExtData->ReadVirtual(TO_CDADDR(dllBase + DosHeader.e_lfanew), &Header, sizeof(Header), NULL) != S_OK)
- return FALSE;
+ return S_FALSE;
DWORD_PTR sectionAddr = dllBase + DosHeader.e_lfanew + offsetof(IMAGE_NT_HEADERS,OptionalHeader)
+ Header.FileHeader.SizeOfOptionalHeader;
diff --git a/src/coreclr/hosts/coreconsole/coreconsole.cpp b/src/coreclr/hosts/coreconsole/coreconsole.cpp
index 603526a5a0..1533dff88e 100644
--- a/src/coreclr/hosts/coreconsole/coreconsole.cpp
+++ b/src/coreclr/hosts/coreconsole/coreconsole.cpp
@@ -185,7 +185,7 @@ public:
}
}
- bool TPAListContainsFile(wchar_t* fileNameWithoutExtension, wchar_t** rgTPAExtensions, int countExtensions)
+ bool TPAListContainsFile(_In_z_ wchar_t* fileNameWithoutExtension, _In_reads_(countExtensions) wchar_t** rgTPAExtensions, int countExtensions)
{
if (!m_tpaList.CStr()) return false;
@@ -205,7 +205,7 @@ public:
return false;
}
- void RemoveExtensionAndNi(wchar_t* fileName)
+ void RemoveExtensionAndNi(_In_z_ wchar_t* fileName)
{
// Remove extension, if it exists
wchar_t* extension = wcsrchr(fileName, W('.'));
@@ -225,7 +225,7 @@ public:
}
}
- void AddFilesFromDirectoryToTPAList(wchar_t* targetPath, wchar_t** rgTPAExtensions, int countExtensions)
+ void AddFilesFromDirectoryToTPAList(_In_z_ wchar_t* targetPath, _In_reads_(countExtensions) wchar_t** rgTPAExtensions, int countExtensions)
{
*m_log << W("Adding assemblies from ") << targetPath << W(" to the TPA list") << Logger::endl;
wchar_t assemblyPath[MAX_LONGPATH];
@@ -360,7 +360,7 @@ public:
};
-bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbose, const bool waitForDebugger, DWORD &exitCode, wchar_t* programPath)
+bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbose, const bool waitForDebugger, DWORD &exitCode, _In_z_ wchar_t* programPath)
{
// Assume failure
exitCode = -1;
diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp
index 7b1f81ed9a..9a7ed4214c 100644
--- a/src/coreclr/hosts/corerun/corerun.cpp
+++ b/src/coreclr/hosts/corerun/corerun.cpp
@@ -208,7 +208,7 @@ public:
}
}
- bool TPAListContainsFile(wchar_t* fileNameWithoutExtension, wchar_t** rgTPAExtensions, int countExtensions)
+ bool TPAListContainsFile(_In_z_ wchar_t* fileNameWithoutExtension, _In_reads_(countExtensions) wchar_t** rgTPAExtensions, int countExtensions)
{
if (!m_tpaList.CStr()) return false;
@@ -228,7 +228,7 @@ public:
return false;
}
- void RemoveExtensionAndNi(wchar_t* fileName)
+ void RemoveExtensionAndNi(_In_z_ wchar_t* fileName)
{
// Remove extension, if it exists
wchar_t* extension = wcsrchr(fileName, W('.'));
@@ -248,7 +248,7 @@ public:
}
}
- void AddFilesFromDirectoryToTPAList(wchar_t* targetPath, wchar_t** rgTPAExtensions, int countExtensions)
+ void AddFilesFromDirectoryToTPAList(_In_z_ wchar_t* targetPath, _In_reads_(countExtensions) wchar_t** rgTPAExtensions, int countExtensions)
{
*m_log << W("Adding assemblies from ") << targetPath << W(" to the TPA list") << Logger::endl;
wchar_t assemblyPath[MAX_LONGPATH];
diff --git a/src/dlls/dbgshim/dbgshim.cpp b/src/dlls/dbgshim/dbgshim.cpp
index e6934cf722..efd3e1fa06 100644
--- a/src/dlls/dbgshim/dbgshim.cpp
+++ b/src/dlls/dbgshim/dbgshim.cpp
@@ -282,7 +282,7 @@ public:
return hr;
}
- HRESULT InternalEnumerateCLRs(HANDLE** ppHandleArray, LPWSTR** ppStringArray, DWORD* pdwArrayLength)
+ HRESULT InternalEnumerateCLRs(HANDLE** ppHandleArray, _In_reads_(*pdwArrayLength) LPWSTR** ppStringArray, DWORD* pdwArrayLength)
{
int numTries = 0;
HRESULT hr;
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 5633d8bd4f..869b0b95e6 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -467,7 +467,7 @@ void log_va_msg_config(const char *fmt, va_list args)
pBuffer[0] = '\r';
pBuffer[1] = '\n';
int buffer_start = 2;
- int msg_len = _vsnprintf (&pBuffer[buffer_start], BUFFERSIZE - buffer_start, fmt, args );
+ int msg_len = _vsnprintf_s (&pBuffer[buffer_start], BUFFERSIZE - buffer_start, _TRUNCATE, fmt, args );
assert (msg_len != -1);
msg_len += buffer_start;
diff --git a/src/inc/corhost.h b/src/inc/corhost.h
index 483580d47f..5b2dd3854a 100644
--- a/src/inc/corhost.h
+++ b/src/inc/corhost.h
@@ -653,7 +653,7 @@ class CCLRErrorReportingManager :
BucketParamsCache* m_pBucketParamsCache;
- HRESULT CopyToDataCache(WCHAR** pTarget, WCHAR const* pSource);
+ HRESULT CopyToDataCache(_In_ WCHAR** pTarget, WCHAR const* pSource);
#endif // FEATURE_WINDOWSPHONE
public:
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
index 67e841f5aa..c14f701068 100644
--- a/src/inc/eventtracebase.h
+++ b/src/inc/eventtracebase.h
@@ -644,8 +644,8 @@ namespace ETW
BOOL fIsTreatAsSafe);
#else
public:
- static VOID StrongNameVerificationStart(DWORD dwInFlags,LPWSTR strFullyQualifiedAssemblyName) {};
- static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, LPWSTR strFullyQualifiedAssemblyName) {};
+ static VOID StrongNameVerificationStart(DWORD dwInFlags, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {};
+ static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {};
static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName,
LPCWSTR wszModuleName,
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index ef97f63854..78dc438ddb 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -512,7 +512,7 @@ inline void *__cdecl operator new(size_t, void *_P)
void * __cdecl
operator new(size_t n);
-_Ret_bytecap_(_Size) void * __cdecl
+_Ret_bytecap_(n) void * __cdecl
operator new[](size_t n);
void __cdecl
diff --git a/src/strongname/api/strongnamecoreclr.cpp b/src/strongname/api/strongnamecoreclr.cpp
index 861ca2c635..1b81ff6252 100644
--- a/src/strongname/api/strongnamecoreclr.cpp
+++ b/src/strongname/api/strongnamecoreclr.cpp
@@ -47,7 +47,7 @@ IExecutionEngine * __stdcall SnIEE()
return ApiShim<IEEFn_t>("IEE")();
}
-STDAPI SnGetCorSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLength)
+STDAPI SnGetCorSystemDirectory(_In_z_ LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLength)
{
typedef HRESULT (__stdcall *GetCorSystemDirectoryFn_t)(LPWSTR, DWORD, DWORD *);
return ApiShim<GetCorSystemDirectoryFn_t>("GetCORSystemDirectory")(pbuffer, cchBuffer, dwLength);
diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp
index 8ada40e555..53e5aa133b 100644
--- a/src/tools/crossgen/crossgen.cpp
+++ b/src/tools/crossgen/crossgen.cpp
@@ -282,11 +282,12 @@ bool StringEndsWith(LPCWSTR pwzString, LPCWSTR pwzCandidate)
// When using the Phone binding model (TrustedPlatformAssemblies), automatically
// detect which path mscorlib.[ni.]dll lies in.
//
-bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DWORD cbMscorlibPath, LPCWSTR pwzTrustedPlatformAssemblies)
+bool ComputeMscorlibPathFromTrustedPlatformAssemblies(_In_z_ LPWSTR pwzMscorlibPath, DWORD cbMscorlibPath, LPCWSTR pwzTrustedPlatformAssemblies)
{
LPWSTR wszTrustedPathCopy = new WCHAR[wcslen(pwzTrustedPlatformAssemblies) + 1];
wcscpy_s(wszTrustedPathCopy, wcslen(pwzTrustedPlatformAssemblies) + 1, pwzTrustedPlatformAssemblies);
- LPWSTR wszSingleTrustedPath = wcstok(wszTrustedPathCopy, PATH_SEPARATOR_STR_W);
+ wchar_t *context;
+ LPWSTR wszSingleTrustedPath = wcstok_s(wszTrustedPathCopy, PATH_SEPARATOR_STR_W, &context);
while (wszSingleTrustedPath != NULL)
{
@@ -315,7 +316,7 @@ bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DW
return true;
}
- wszSingleTrustedPath = wcstok(NULL, PATH_SEPARATOR_STR_W);
+ wszSingleTrustedPath = wcstok_s(NULL, PATH_SEPARATOR_STR_W, &context);
}
delete [] wszTrustedPathCopy;
diff --git a/src/vm/comisolatedstorage.h b/src/vm/comisolatedstorage.h
index 17e0d5d916..7eb219975e 100644
--- a/src/vm/comisolatedstorage.h
+++ b/src/vm/comisolatedstorage.h
@@ -192,7 +192,7 @@ private:
static void GetRootDirInternal(DWORD dwFlags, __in_ecount(cPath) WCHAR *path, DWORD cPath);
static void CreateDirectoryIfNotPresent(__in_z const WCHAR *path, LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL);
#ifndef FEATURE_ISOSTORE_LIGHT
- static BOOL GetMachineStoreDirectory(__out_ecount(cchMachineStorageRoot) WCHAR *path, DWORD cPath);
+ static BOOL GetMachineStoreDirectory(__out_ecount(cchMachineStorageRoot) WCHAR *wszMachineStorageRoot, DWORD cchMachineStorageRoot);
static HRESULT GetMachineStoreDacl(PACL *ppAcl);
#endif // !FEATURE_ISOSTORE_LIGHT
};
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index 0734425e29..422189ae6b 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -879,7 +879,13 @@ HRESULT CEECompileInfo::SetCachedSigningLevel(HANDLE hNI, HANDLE *pModules, COUN
handles.Append(hFile);
}
- IfFailGo(SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, hNI));
+ if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, hNI))
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ _ASSERTE(FAILED(hr));
+ goto ErrExit;
+ }
+
for (COUNT_T i = 0; i < nModules; i++)
{
if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, pModules[i]))
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index d2c68ad4c4..648708fac3 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -3109,6 +3109,7 @@ STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
else
{
_ASSERTE(!"Not reachable");
+#pragma prefast(suppress:33021, "This code is not reacheble so this assignment is fine.")
hr = FALSE;
}
}
@@ -6723,7 +6724,7 @@ HRESULT CCLRErrorReportingManager::EndCustomDump()
}
#ifdef FEATURE_WINDOWSPHONE
-HRESULT CopyStringWorker(WCHAR** pTarget, WCHAR const* pSource)
+HRESULT CopyStringWorker(_Out_ WCHAR** pTarget, WCHAR const* pSource)
{
LIMITED_METHOD_CONTRACT;
@@ -6812,7 +6813,7 @@ HRESULT CCLRErrorReportingManager::BucketParamsCache::SetAt(BucketParameterIndex
return CopyStringWorker(&m_pParams[index], val);
}
-HRESULT CCLRErrorReportingManager::CopyToDataCache(WCHAR** pTarget, WCHAR const* pSource)
+HRESULT CCLRErrorReportingManager::CopyToDataCache(_Out_ WCHAR** pTarget, WCHAR const* pSource)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index d4f0bf78bf..e8a17d4262 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -4978,8 +4978,9 @@ BOOL InstallUnhandledExceptionFilter() {
// We will be here only for CoreCLR on WLC since we dont
// register UEF for SL.
if (g_pOriginalUnhandledExceptionFilter == FILTER_NOT_INSTALLED) {
- g_pOriginalUnhandledExceptionFilter =
- SetUnhandledExceptionFilter(COMUnhandledExceptionFilter);
+
+#pragma prefast(suppress:28725, "Calling to SetUnhandledExceptionFilter is intentional in this case.")
+ g_pOriginalUnhandledExceptionFilter = SetUnhandledExceptionFilter(COMUnhandledExceptionFilter);
// make sure is set (ie. is not our special value to indicate unset)
LOG((LF_EH, LL_INFO10, "InstallUnhandledExceptionFilter registered UEF with OS for CoreCLR!\n"));
}
@@ -5013,7 +5014,10 @@ void UninstallUnhandledExceptionFilter() {
#else // !FEATURE_UEF_CHAINMANAGER
// We will be here only for CoreCLR on WLC or on Mac SL.
if (g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED) {
+
+#pragma prefast(suppress:28725, "Calling to SetUnhandledExceptionFilter is intentional in this case.")
SetUnhandledExceptionFilter(g_pOriginalUnhandledExceptionFilter);
+
g_pOriginalUnhandledExceptionFilter = FILTER_NOT_INSTALLED;
LOG((LF_EH, LL_INFO10, "UninstallUnhandledExceptionFilter unregistered UEF from OS for CoreCLR!\n"));
}
diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp
index 8254707c53..6b5f897a3b 100644
--- a/src/vm/interoputil.cpp
+++ b/src/vm/interoputil.cpp
@@ -2708,7 +2708,7 @@ HRESULT ClrSafeArrayGetVartype(SAFEARRAY *psa, VARTYPE *pvt)
//--------------------------------------------------------------------------------
// // safe VariantChangeType
// Release helper, enables and disables GC during call-outs
-HRESULT SafeVariantChangeType(VARIANT* pVarRes, VARIANT* pVarSrc,
+HRESULT SafeVariantChangeType(_Inout_ VARIANT* pVarRes, _In_ VARIANT* pVarSrc,
unsigned short wFlags, VARTYPE vt)
{
CONTRACTL
@@ -2744,7 +2744,7 @@ HRESULT SafeVariantChangeType(VARIANT* pVarRes, VARIANT* pVarSrc,
}
//--------------------------------------------------------------------------------
-HRESULT SafeVariantChangeTypeEx(VARIANT* pVarRes, VARIANT* pVarSrc,
+HRESULT SafeVariantChangeTypeEx(_Inout_ VARIANT* pVarRes, _In_ VARIANT* pVarSrc,
LCID lcid, unsigned short wFlags, VARTYPE vt)
{
CONTRACTL
diff --git a/src/vm/olevariant.cpp b/src/vm/olevariant.cpp
index 639e4347ab..8c133ac006 100644
--- a/src/vm/olevariant.cpp
+++ b/src/vm/olevariant.cpp
@@ -1100,7 +1100,7 @@ void VariantData::NewVariant(VariantData * const& dest, const CVTypes type, INT6
}
}
-void SafeVariantClearHelper(VARIANT* pVar)
+void SafeVariantClearHelper(_Inout_ VARIANT* pVar)
{
STATIC_CONTRACT_SO_INTOLERANT;
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/securityconfig.cpp b/src/vm/securityconfig.cpp
index 300c00b395..7cb3cebe7b 100644
--- a/src/vm/securityconfig.cpp
+++ b/src/vm/securityconfig.cpp
@@ -496,7 +496,7 @@ void* SecurityConfig::GetData( INT32 id )
return NULL;
}
-static BOOL CacheOutOfDate( FILETIME* configFileTime, __in_z WCHAR* configFileName, __in_opt __in_z WCHAR* cacheFileName )
+static BOOL CacheOutOfDate( FILETIME* configFileTime, __in_z WCHAR* configFileName, __in_z_opt WCHAR* cacheFileName )
{
CONTRACTL
{
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index 4ba417c76f..727f457e94 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -1160,7 +1160,7 @@ typedef BOOL (WINAPI *WofShouldCompressBinaries_t) (
typedef HRESULT (WINAPI *WofSetFileDataLocation_t) (
__in HANDLE hFile,
- __out ULONG Provider,
+ __in ULONG Provider,
__in PVOID FileInfo,
__in ULONG Length
);