summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/debug/shim/debugshim.cpp4
-rw-r--r--src/inc/bbsweep.h4
-rw-r--r--src/inc/clr/fs/path.h2
-rw-r--r--src/inc/dlwrap.h1
-rw-r--r--src/inc/downlevel.h15
-rw-r--r--src/inc/eventtracebase.h2
-rw-r--r--src/inc/formattype.cpp2
-rw-r--r--src/inc/newapis.h2
-rw-r--r--src/inc/sbuffer.h4
-rw-r--r--src/inc/stgpool.h4
-rw-r--r--src/inc/sxshelpers.h2
-rw-r--r--src/inc/utilcode.h2
-rw-r--r--src/inc/winrt/windowsstring.h2
-rw-r--r--src/md/compressedinteger.h2
-rw-r--r--src/md/datablob.h26
-rw-r--r--src/md/datablob.inl9
-rw-r--r--src/md/heaps/blobheap.h2
-rw-r--r--src/md/hotdata/hotheap.h2
-rw-r--r--src/utilcode/dlwrap.cpp1
-rw-r--r--src/utilcode/downlevel.cpp1
-rw-r--r--src/utilcode/posterror.cpp2
-rw-r--r--src/utilcode/registrywrapper.cpp2
-rw-r--r--src/utilcode/regutil.cpp4
-rw-r--r--src/utilcode/securitywrapper.cpp3
-rw-r--r--src/utilcode/sortversioning.cpp1
-rw-r--r--src/utilcode/util.cpp2
-rw-r--r--src/utilcode/util_nodependencies.cpp2
-rw-r--r--src/utilcode/utilmessagebox.cpp2
-rw-r--r--src/vm/appdomain.cpp7
-rw-r--r--src/vm/assemblynativeresource.cpp4
-rw-r--r--src/vm/ceeload.cpp2
-rw-r--r--src/vm/clrprivbinderfusion.cpp2
-rw-r--r--src/vm/clrprivbinderwinrt.cpp2
-rw-r--r--src/vm/comdynamic.cpp2
-rw-r--r--src/vm/comisolatedstorage.cpp2
-rw-r--r--src/vm/compile.cpp6
-rw-r--r--src/vm/dllimport.cpp2
-rw-r--r--src/vm/dwbucketmanager.hpp2
-rw-r--r--src/vm/excep.cpp2
-rw-r--r--src/vm/mdaassistants.cpp6
-rw-r--r--src/vm/securitymeta.cpp2
-rw-r--r--src/vm/tlbexport.cpp8
-rw-r--r--src/vm/util.cpp2
43 files changed, 101 insertions, 57 deletions
diff --git a/src/debug/shim/debugshim.cpp b/src/debug/shim/debugshim.cpp
index 2d4e63cad5..55b0b36e24 100644
--- a/src/debug/shim/debugshim.cpp
+++ b/src/debug/shim/debugshim.cpp
@@ -84,10 +84,10 @@ STDMETHODIMP CLRDebuggingImpl::OpenVirtualProcess(
HMODULE hDac = NULL;
DWORD dbiTimestamp;
DWORD dbiSizeOfImage;
- WCHAR dbiName[MAX_PATH_FNAME];
+ WCHAR dbiName[MAX_PATH_FNAME] = {0};
DWORD dacTimestamp;
DWORD dacSizeOfImage;
- WCHAR dacName[MAX_PATH_FNAME];
+ WCHAR dacName[MAX_PATH_FNAME] = {0};
CLR_DEBUGGING_VERSION version;
BOOL versionSupportedByCaller = FALSE;
diff --git a/src/inc/bbsweep.h b/src/inc/bbsweep.h
index 7cebe2000c..f99c36c995 100644
--- a/src/inc/bbsweep.h
+++ b/src/inc/bbsweep.h
@@ -277,8 +277,8 @@ private:
}
#endif // !FEATURE_CORESYSTEM
- WCHAR objectName[MAX_LONGPATH];
- WCHAR objectNamePrefix[MAX_LONGPATH];
+ WCHAR objectName[MAX_LONGPATH] = {0};
+ WCHAR objectNamePrefix[MAX_LONGPATH] = {0};
GetObjectNamePrefix(processID, fromRuntime, objectNamePrefix);
// if there is a non-empty name prefix, append a '\'
if (objectNamePrefix[0] != '\0')
diff --git a/src/inc/clr/fs/path.h b/src/inc/clr/fs/path.h
index 29a70f7260..e90b3188ed 100644
--- a/src/inc/clr/fs/path.h
+++ b/src/inc/clr/fs/path.h
@@ -92,7 +92,7 @@ namespace clr
// result is placed in wzBuffer and the number of chars written is placed in pcchBuffer on
// success; otherwise an error HRESULT is returned.
static HRESULT
- Combine(LPCWSTR wzPathLeft, LPCWSTR wzPathRight, __out DWORD *pcchBuffer, __out_ecount(*pcchBuffer) LPWSTR wzBuffer)
+ Combine(LPCWSTR wzPathLeft, LPCWSTR wzPathRight, __in DWORD *pcchBuffer, __out_ecount(*pcchBuffer) LPWSTR wzBuffer)
{
STATIC_CONTRACT_NOTHROW;
diff --git a/src/inc/dlwrap.h b/src/inc/dlwrap.h
index 9129bcf2bf..d30e01462a 100644
--- a/src/inc/dlwrap.h
+++ b/src/inc/dlwrap.h
@@ -42,6 +42,7 @@ VerQueryValueW_NoThrow(
#endif
#if defined(_WININET_) && !defined (CreateUrlCacheEntryW_NoThrow)
+__success(return)
BOOL
CreateUrlCacheEntryW_NoThrow(
IN LPCWSTR lpszUrlName,
diff --git a/src/inc/downlevel.h b/src/inc/downlevel.h
index 12aeb42cf7..d33a0abb5b 100644
--- a/src/inc/downlevel.h
+++ b/src/inc/downlevel.h
@@ -143,13 +143,14 @@ namespace DownLevel
// User /system defaults
// TODO: I don't think we need all of these.
int GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
- DWORD GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
+ __success(return == 1) DWORD GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
int GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
// Locale and calendar information
int GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
int GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
__out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar);
+ __success(return != 0)
int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
__in CALID Calendar,
__in_opt LPCWSTR pReserved,
@@ -160,12 +161,13 @@ namespace DownLevel
// Compareinfo type information
int TurkishCompareStringIgnoreCase(LCID lcid, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2);
-
- int CompareStringEx(LPCWSTR lpLocaleName, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2,
- int cchCount2, LPNLSVERSIONINFO lpVersionInformation, LPVOID lpReserved, LPARAM lParam );
- int CompareStringOrdinal(LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2, BOOL bIgnoreCase);
+ int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
+ __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
+
+ int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR string1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR string2, __in int cchCount2, __in BOOL bIgnoreCase);
+ __success(return != 0)
int LCMapStringEx(__in LPCWSTR lpLocaleName,
__in DWORD dwMapFlags,
__in_ecount(cchSrc) LPCWSTR lpSrcStr,
@@ -176,6 +178,7 @@ namespace DownLevel
__in_opt LPVOID lpReserved,
__in_opt LPARAM lParam);
+ __success(return != -1)
int FindNLSStringEx(__in LPCWSTR lpLocaleName,
__in DWORD dwFindNLSStringFlags,
__in_ecount(cchSource) LPCWSTR lpStringSource,
@@ -200,6 +203,7 @@ namespace DownLevel
// This is where we fudge data the OS doesn't know (even on Vista)
namespace UplevelFallback
{
+ __success(return != 0)
int LCMapStringEx(__in LPCWSTR lpLocaleName,
__in DWORD dwMapFlags,
__in_ecount(cchSrc) LPCWSTR lpSrcStr,
@@ -225,6 +229,7 @@ namespace DownLevel
int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+ __success(return)
BOOL GetThreadPreferredUILanguages( __in DWORD dwFlags,
__out PULONG pulNumLanguages,
__out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
index eac127e732..9a6b218d3f 100644
--- a/src/inc/eventtracebase.h
+++ b/src/inc/eventtracebase.h
@@ -385,7 +385,7 @@ namespace ETW
friend class ETW::EnumerationLog;
#ifdef FEATURE_EVENT_TRACE
static VOID SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents=FALSE);
- static ULONG SendModuleRange(Module *pModule, DWORD dwEventOptions);
+ static ULONG SendModuleRange(__in Module *pModule, __in DWORD dwEventOptions);
static VOID SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions);
static VOID SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL);
public:
diff --git a/src/inc/formattype.cpp b/src/inc/formattype.cpp
index 05b4c86247..923ff3e9a1 100644
--- a/src/inc/formattype.cpp
+++ b/src/inc/formattype.cpp
@@ -93,7 +93,7 @@ const PCCOR_SIGNATURE PrettyPrintSignature(
const char* name, // can be "", the name of the method for this sig 0 means local var sig
CQuickBytes *out, // where to put the pretty printed string
IMDInternalImport *pIMDI, // ptr to IMDInternalImport class with ComSig
- __in_opt const char* inlabel, // prefix for names (NULL if no names required)
+ _In_opt_z_ const char* inlabel, // prefix for names (NULL if no names required)
BOOL printTyArity=FALSE);
diff --git a/src/inc/newapis.h b/src/inc/newapis.h
index 0ec87b5c70..57286e2051 100644
--- a/src/inc/newapis.h
+++ b/src/inc/newapis.h
@@ -326,7 +326,9 @@ namespace NewApis
// Enumeration functions
__success(return != 0) BOOL
EnumDateFormatsExEx (DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ __success(return != 0)
BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ __success(return != 0)
BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, CALTYPE CalType, LPARAM lParam);
int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags);
diff --git a/src/inc/sbuffer.h b/src/inc/sbuffer.h
index adcde9bab8..0c98fdb668 100644
--- a/src/inc/sbuffer.h
+++ b/src/inc/sbuffer.h
@@ -353,8 +353,8 @@ class SBuffer
// Manipulates contents of the buffer via the plugins below, but
// adds some debugging checks. Should always call through here rather
// than directly calling the extensibility points.
- void DebugMoveBuffer(BYTE *to, BYTE *from, COUNT_T size);
- void DebugCopyConstructBuffer(BYTE *to, const BYTE *from, COUNT_T size);
+ void DebugMoveBuffer(__out_bcount(size) BYTE *to, BYTE *from, COUNT_T size);
+ void DebugCopyConstructBuffer(__out_bcount(size) BYTE *to, const BYTE *from, COUNT_T size);
void DebugConstructBuffer(BYTE *buffer, COUNT_T size);
void DebugDestructBuffer(BYTE *buffer, COUNT_T size);
diff --git a/src/inc/stgpool.h b/src/inc/stgpool.h
index 5932a51464..9170125b37 100644
--- a/src/inc/stgpool.h
+++ b/src/inc/stgpool.h
@@ -333,7 +333,7 @@ protected:
// helper for extension segments.
//*****************************************************************************
__checkReturn
- FORCEINLINE HRESULT GetDataReadOnly(UINT32 nOffset, __in MetaData::DataBlob *pData)
+ FORCEINLINE HRESULT GetDataReadOnly(UINT32 nOffset, __inout MetaData::DataBlob *pData)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(IsReadOnly());
@@ -375,7 +375,7 @@ protected:
// helper for extension segments.
//*****************************************************************************
__checkReturn
- virtual HRESULT GetData(UINT32 nOffset, __in MetaData::DataBlob *pData)
+ virtual HRESULT GetData(UINT32 nOffset, __inout MetaData::DataBlob *pData)
{
WRAPPER_NO_CONTRACT;
return GetDataReadOnly(nOffset, pData);
diff --git a/src/inc/sxshelpers.h b/src/inc/sxshelpers.h
index 3fa450d5b9..3ecf5cc9a2 100644
--- a/src/inc/sxshelpers.h
+++ b/src/inc/sxshelpers.h
@@ -103,7 +103,7 @@ class AssemblyVersion
inline AssemblyVersion(AssemblyVersion& version);
// Init
- HRESULT Init(LPCWSTR pwzVersion, BOOL bStartsWithV);
+ HRESULT Init(__in_z LPCWSTR pwzVersion, BOOL bStartsWithV);
inline HRESULT Init(WORD major, WORD minor, WORD build, WORD revision);
// Mofifiers.
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index 7d380e24de..e832441454 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -5600,6 +5600,7 @@ namespace Clr { namespace Util
namespace Reg
{
HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, SString & ssValue);
+ __success(return == S_OK)
HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, __deref_out __deref_out_z LPWSTR* pwszValue);
}
@@ -5625,6 +5626,7 @@ namespace Win32
SString & ssFileName,
bool fAllowLongFileNames = false);
+ __success(return == S_OK)
HRESULT GetModuleFileName(
HMODULE hModule,
__deref_out_z LPWSTR * pwszFileName,
diff --git a/src/inc/winrt/windowsstring.h b/src/inc/winrt/windowsstring.h
index ff5fcfe811..fe99e69478 100644
--- a/src/inc/winrt/windowsstring.h
+++ b/src/inc/winrt/windowsstring.h
@@ -324,7 +324,7 @@ namespace clr
//
// if the HRESULT indicates failure, does nothing
//
- static HRESULT FreeAndAssignOnSuccess(HRESULT hr, HSTRING newValue, __out HSTRING *target)
+ static HRESULT FreeAndAssignOnSuccess(HRESULT hr, HSTRING newValue, __inout HSTRING *target)
{
STATIC_CONTRACT_LIMITED_METHOD;
if (SUCCEEDED(hr))
diff --git a/src/md/compressedinteger.h b/src/md/compressedinteger.h
index 54a86cb626..2dcae9b60c 100644
--- a/src/md/compressedinteger.h
+++ b/src/md/compressedinteger.h
@@ -67,6 +67,7 @@ public:
// Returns FALSE if the value cannot be encoded as compressed integer, doesn't fill *pcbEncodingSize
// then.
__checkReturn
+ __success(return)
static inline BOOL GetEncodingSize(
UINT32 nValue,
__out UINT32 *pcbEncodingSize);
@@ -74,6 +75,7 @@ public:
// *pcbEncodingSize with 1, 2 or 4 and *pnEncodedValue with the encoded value.
// Returns FALSE if the value cannot be encoded as compressed integer, doesn't fill *pcbEncodingSize
// nor *pnEncodedValue then.
+ __success(return)
static inline BOOL Encode(
UINT32 nValue,
__out UINT32 *pnEncodedValue,
diff --git a/src/md/datablob.h b/src/md/datablob.h
index 891e41eff0..8e00b29cfe 100644
--- a/src/md/datablob.h
+++ b/src/md/datablob.h
@@ -67,19 +67,19 @@ public:
// Returns FALSE if there's not enough data in the blob, doesn't initialize the value '*pnValue' then.
// Returns TRUE otherwise, fills *pnValue, but doesn't move the memory block (doesn't skip the read
// data).
- __checkReturn inline BOOL PeekU1(__out BYTE *pnValue) const;
- __checkReturn inline BOOL PeekU2(__out UINT16 *pnValue) const;
- __checkReturn inline BOOL PeekU4(__out UINT32 *pnValue) const;
- __checkReturn inline BOOL PeekU8(__out UINT64 *pnValue) const;
+ __checkReturn __success(return) inline BOOL PeekU1(__out BYTE *pnValue) const;
+ __checkReturn __success(return) inline BOOL PeekU2(__out UINT16 *pnValue) const;
+ __checkReturn __success(return) inline BOOL PeekU4(__out UINT32 *pnValue) const;
+ __checkReturn __success(return) inline BOOL PeekU8(__out UINT64 *pnValue) const;
//#GetUx_Functions
// Reads the U1/U2/U4/U8 from the data blob and skips the read data.
// Returns FALSE if there's not enough data in the blob, doesn't initialize the value '*pnValue' then.
// Returns TRUE otherwise, fills *pnValue and moves the memory block behind the read data.
- __checkReturn inline BOOL GetU1(__out BYTE *pnValue);
- __checkReturn inline BOOL GetU2(__out UINT16 *pnValue);
- __checkReturn inline BOOL GetU4(__out UINT32 *pnValue);
- __checkReturn inline BOOL GetU8(__out UINT64 *pnValue);
+ __checkReturn __success(return) inline BOOL GetU1(__out BYTE *pnValue);
+ __checkReturn __success(return) inline BOOL GetU2(__out UINT16 *pnValue);
+ __checkReturn __success(return) inline BOOL GetU4(__out UINT32 *pnValue);
+ __checkReturn __success(return) inline BOOL GetU8(__out UINT64 *pnValue);
// Reads compressed integer (1, 2 or 4 bytes of format code:CompressedInteger#Format - returns the size
// in *pcbCompressedValueSize) from the data blob without skipping the read data.
@@ -89,6 +89,7 @@ public:
// Returns TRUE otherwise, fills *pnValue and *pcbCompressedValueSize (with number 1,2 or 4), but
// doesn't move the memory block (doesn't skip the read data).
__checkReturn
+ __success(return)
inline BOOL PeekCompressedU(
__out UINT32 *pnValue,
__out UINT32 *pcbCompressedValueSize);
@@ -97,7 +98,8 @@ public:
// Returns FALSE if there's not enough data in the blob or the compression is invalid (starts with byte
// 111? ????), doesn't initialize the value *pnValue then.
// Returns TRUE otherwise, fills *pnValue and moves the memory block behind the read data.
- __checkReturn
+ __checkReturn
+ __success(return)
inline BOOL GetCompressedU(__out UINT32 *pnValue);
// Reads compressed integer (1, 2 or 4 bytes of format code:CompressedInteger#Format - returns the size
// in *pcbCompressedValueSize) from the data blob and skips the read data.
@@ -107,6 +109,7 @@ public:
// Returns TRUE otherwise, fills *pnValue and *pcbCompressedValueSize (with number 1,2 or 4) and moves
// the memory block behind the read data.
__checkReturn
+ __success(return)
inline BOOL GetCompressedU(
__out UINT32 *pnValue,
__out UINT32 *pcbCompressedValueSize);
@@ -117,6 +120,7 @@ public:
// Returns TRUE otherwise, fills *pData with the "read" data and moves the memory block behind the
// "read" data.
__checkReturn
+ __success(return)
inline BOOL GetDataOfSize(
UINT32 cbDataSize,
__out DataBlob *pData);
@@ -174,11 +178,13 @@ public:
// Returns FALSE if there's less than cbSize data represented.
// Returns TRUE otherwise and truncates the represented data size to cbSize.
__checkReturn
+ __success(return)
inline BOOL TruncateToExactSize(UINT32 cbSize);
// Truncates the buffer by size (cbSize).
// Returns FALSE if there's less than cbSize data represented.
// Returns TRUE otherwise and truncates the represented data size by cbSize.
__checkReturn
+ __success(return)
inline BOOL TruncateBySize(UINT32 cbSize);
#ifdef _DEBUG
@@ -198,12 +204,14 @@ public:
// integer (bigger than code:CompressedInteger::const_Max).
// Returns TRUE on success and moves the memory block behind the written data.
__checkReturn
+ __success(return)
inline BOOL StoreCompressedU(UINT32 nValue);
// Writes data from *pSource to the data blob and skips the written data.
// Returns FALSE if there's not enough data in the blob.
// Returns TRUE on success and moves memory block behind the written data.
__checkReturn
+ __success(return)
inline BOOL StoreData(__in const DataBlob *pSource);
private:
diff --git a/src/md/datablob.inl b/src/md/datablob.inl
index d7ce361013..40c92c2131 100644
--- a/src/md/datablob.inl
+++ b/src/md/datablob.inl
@@ -106,6 +106,7 @@ DataBlob::Init(
// See code:#PeekUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::PeekU1(__out BYTE *pnValue) const
@@ -123,6 +124,7 @@ DataBlob::PeekU1(__out BYTE *pnValue) const
// See code:#PeekUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::PeekU2(__out UINT16 *pnValue) const
@@ -140,6 +142,7 @@ DataBlob::PeekU2(__out UINT16 *pnValue) const
// See code:#PeekUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::PeekU4(__out UINT32 *pnValue) const
@@ -157,6 +160,7 @@ DataBlob::PeekU4(__out UINT32 *pnValue) const
// See code:#PeekUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::PeekU8(__out UINT64 *pnValue) const
@@ -183,6 +187,7 @@ DataBlob::PeekU8(__out UINT64 *pnValue) const
// See code:#GetUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::GetU1(__out BYTE *pnValue)
@@ -201,6 +206,7 @@ DataBlob::GetU1(__out BYTE *pnValue)
// See code:#GetUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::GetU2(__out UINT16 *pnValue)
@@ -219,6 +225,7 @@ DataBlob::GetU2(__out UINT16 *pnValue)
// See code:#GetUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::GetU4(__out UINT32 *pnValue)
@@ -237,6 +244,7 @@ DataBlob::GetU4(__out UINT32 *pnValue)
// See code:#GetUx_Functions above.
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::GetU8(__out UINT64 *pnValue)
@@ -278,6 +286,7 @@ DataBlob::GetCompressedU(__out UINT32 *pnValue)
// doesn't move the memory block (doesn't skip the read data).
//
__checkReturn
+_Success_(return)
inline
BOOL
DataBlob::PeekCompressedU(
diff --git a/src/md/heaps/blobheap.h b/src/md/heaps/blobheap.h
index 91d5430368..d3fb1e324c 100644
--- a/src/md/heaps/blobheap.h
+++ b/src/md/heaps/blobheap.h
@@ -83,7 +83,7 @@ public:
__checkReturn
inline HRESULT GetAllData(
- __out DataBlob *pData)
+ __inout DataBlob *pData)
{
return m_BlobPool.GetDataReadOnly(0, pData);
}
diff --git a/src/md/hotdata/hotheap.h b/src/md/hotdata/hotheap.h
index cc59c8a175..e9e42c4330 100644
--- a/src/md/hotdata/hotheap.h
+++ b/src/md/hotdata/hotheap.h
@@ -52,7 +52,7 @@ public:
__checkReturn
HRESULT GetData(
UINT32 nDataIndex,
- __in DataBlob *pData);
+ __out DataBlob *pData);
inline BOOL IsEmpty() const
{ return m_pHotHeapHeader == NULL; }
diff --git a/src/utilcode/dlwrap.cpp b/src/utilcode/dlwrap.cpp
index f649e5267b..10acc61b76 100644
--- a/src/utilcode/dlwrap.cpp
+++ b/src/utilcode/dlwrap.cpp
@@ -86,6 +86,7 @@ VerQueryValueW_NoThrow(
// is available, and then it will remove unused functions.
// Instead of specifying all libs for imported functions needed by the following codes, we just
// remove them from compiling phase.
+__success(return)
BOOL
CreateUrlCacheEntryW_NoThrow(
IN LPCWSTR lpszUrlName,
diff --git a/src/utilcode/downlevel.cpp b/src/utilcode/downlevel.cpp
index 3b818e59f2..54d09553be 100644
--- a/src/utilcode/downlevel.cpp
+++ b/src/utilcode/downlevel.cpp
@@ -1810,6 +1810,7 @@ namespace DownLevel
return cchSrc;
}
+ __success(return != 0)
int LinguisticCaseString(__in LCID lcid,__in DWORD flags,
__in_ecount(cchSrc) const WCHAR * source,
__in int cchSrc,
diff --git a/src/utilcode/posterror.cpp b/src/utilcode/posterror.cpp
index 0ae48aab71..e409695a4b 100644
--- a/src/utilcode/posterror.cpp
+++ b/src/utilcode/posterror.cpp
@@ -256,7 +256,7 @@ HRESULT FillErrorInfo( // Return status.
}
CONTRACTL_END;
- ICreateErrorInfo *pICreateErr; // Error info creation Iface pointer.
+ ICreateErrorInfo *pICreateErr = NULL; // Error info creation Iface pointer.
IErrorInfo *pIErrInfo = NULL; // The IErrorInfo interface.
HRESULT hr; // Return status.
diff --git a/src/utilcode/registrywrapper.cpp b/src/utilcode/registrywrapper.cpp
index e48fb0941c..96a1d6c886 100644
--- a/src/utilcode/registrywrapper.cpp
+++ b/src/utilcode/registrywrapper.cpp
@@ -217,10 +217,12 @@ HRESULT CheckUseWow6432Node(REGSAM samDesired, bool * fResult)
// lpRedirectedKey is allocated and returned from this method. Caller owns the new string and
// should release
//
+__success(return == ERROR_SUCCESS)
HRESULT RedirectKey(REGSAM samDesired, HKEY hKey, LPCWSTR lpKey, __deref_out_z LPWSTR * lpRedirectedKey)
{
if (hKey != kRegistryRootHive || _wcsnicmp(lpKey, kRegistryRootKey, wcslen(kRegistryRootKey)) != 0)
{
+ *lpRedirectedKey = NULL;
return ERROR_SUCCESS;
}
diff --git a/src/utilcode/regutil.cpp b/src/utilcode/regutil.cpp
index c7c37aa028..9fa98b0b71 100644
--- a/src/utilcode/regutil.cpp
+++ b/src/utilcode/regutil.cpp
@@ -1130,8 +1130,8 @@ HRESULT REGUTIL::RegisterTypeLib( // Return code.
WCHAR szID[64]; // The typelib ID to register.
WCHAR szTLBID[256]; // TypeLib\\szID.
WCHAR szHelpDir[_MAX_PATH];
- WCHAR szDrive[_MAX_DRIVE];
- WCHAR szDir[_MAX_DIR];
+ WCHAR szDrive[_MAX_DRIVE] = {0};
+ WCHAR szDir[_MAX_DIR] = {0};
WCHAR szVersion[64];
LPWSTR szTmp;
diff --git a/src/utilcode/securitywrapper.cpp b/src/utilcode/securitywrapper.cpp
index 1fa8fca54a..f9d709c1e2 100644
--- a/src/utilcode/securitywrapper.cpp
+++ b/src/utilcode/securitywrapper.cpp
@@ -412,13 +412,14 @@ void SidBuffer::InitFromProcess(DWORD pid)
HRESULT SidBuffer::InitFromProcessAppContainerSidNoThrow(DWORD pid)
{
HRESULT hr = S_OK;
+ HANDLE hToken = NULL;
+
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
if (hProcess == NULL)
{
hr = HRESULT_FROM_GetLastError();
goto exit;
}
- HANDLE hToken = NULL;
if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hToken))
{
hr = HRESULT_FROM_GetLastError();
diff --git a/src/utilcode/sortversioning.cpp b/src/utilcode/sortversioning.cpp
index 6b9f56cc8c..5f0d75b58e 100644
--- a/src/utilcode/sortversioning.cpp
+++ b/src/utilcode/sortversioning.cpp
@@ -209,6 +209,7 @@ namespace SortVersioning
}
// Attempts to load a Sort DLL. If this fails, the values of the __out parameters are unchanged.
+ __success(return)
BOOL LoadSortDllAndPublish(
__in LPCWSTR sDllName,
__in DWORD dwVersion,
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index e7d6a620ff..062cf61d95 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -3783,6 +3783,7 @@ namespace Com
{
namespace __imp
{
+ __success(return == S_OK)
static
HRESULT FindSubKeyDefaultValueForCLSID(REFCLSID rclsid, LPCWSTR wszSubKeyName, SString & ssValue)
{
@@ -3803,6 +3804,7 @@ namespace Com
return Clr::Util::Reg::ReadStringValue(HKEY_CLASSES_ROOT, ssKeyName.GetUnicode(), NULL, ssValue);
}
+ __success(return == S_OK)
static
HRESULT FindSubKeyDefaultValueForCLSID(REFCLSID rclsid, LPCWSTR wszSubKeyName, __deref_out __deref_out_z LPWSTR* pwszValue)
{
diff --git a/src/utilcode/util_nodependencies.cpp b/src/utilcode/util_nodependencies.cpp
index 27720ae0f8..9f4bc9423d 100644
--- a/src/utilcode/util_nodependencies.cpp
+++ b/src/utilcode/util_nodependencies.cpp
@@ -516,7 +516,7 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
}
// Look in AeDebug key for "Debugger"; get the size of any value stored there.
- DWORD valueType, valueSize;
+ DWORD valueType, valueSize = 0;
ret = WszRegQueryValueEx(hKeyHolder, kUnmanagedDebuggerValue, 0, &valueType, 0, &valueSize);
_ASSERTE(pcchDebuggerString != NULL);
diff --git a/src/utilcode/utilmessagebox.cpp b/src/utilcode/utilmessagebox.cpp
index f28d2d48f3..c196ddd68a 100644
--- a/src/utilcode/utilmessagebox.cpp
+++ b/src/utilcode/utilmessagebox.cpp
@@ -190,7 +190,7 @@ int MessageBoxImpl(
mustUseMessageBox = (pfnTaskDialogIndirect == NULL);
}
- int result;
+ int result = MB_OK;
if (mustUseMessageBox) {
result = WszMessageBox(hWnd, message, title, uType);
}
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 0067f6b37e..aed588c61d 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -8256,8 +8256,11 @@ public:
}
else
{
- IfFailRet(FString::Utf8_Unicode(szName, bIsAscii, wzBuffer, *pcchBuffer));
- *pcchBuffer = cchName;
+ IfFailRet(FString::Utf8_Unicode(szName, bIsAscii, wzBuffer, cchBuffer));
+ if (pcchBuffer != nullptr)
+ {
+ *pcchBuffer = cchName;
+ }
return S_OK;
}
}
diff --git a/src/vm/assemblynativeresource.cpp b/src/vm/assemblynativeresource.cpp
index 2f13e2b78d..8c18299c9d 100644
--- a/src/vm/assemblynativeresource.cpp
+++ b/src/vm/assemblynativeresource.cpp
@@ -281,8 +281,8 @@ VOID Win32Res::WriteVerResource()
WORD cbStringBlocks;
int i;
bool bUseFileVer = false;
- WCHAR rcFile[_MAX_PATH]; // Name of file without path
- WCHAR rcFileExtension[_MAX_PATH]; // file extension
+ WCHAR rcFile[_MAX_PATH] = {0}; // Name of file without path
+ WCHAR rcFileExtension[_MAX_PATH] = {0}; // file extension
WCHAR rcFileName[_MAX_PATH]; // Name of file with extension but without path
DWORD cbTmp;
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index b379d94365..714547be95 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -3068,7 +3068,7 @@ BOOL Module::IsRuntimeWrapExceptions()
if (hr == S_OK)
{
CustomAttributeParser ca(pVal, cbVal);
- CaNamedArg namedArgs[1];
+ CaNamedArg namedArgs[1] = {0};
// First, the void constructor:
IfFailGo(ParseKnownCaArgs(ca, NULL, 0));
diff --git a/src/vm/clrprivbinderfusion.cpp b/src/vm/clrprivbinderfusion.cpp
index aedecde9c6..8b27d7942f 100644
--- a/src/vm/clrprivbinderfusion.cpp
+++ b/src/vm/clrprivbinderfusion.cpp
@@ -232,7 +232,7 @@ public:
STDMETHOD(GetName)(
- __out LPDWORD lpcwBuffer,
+ __inout LPDWORD lpcwBuffer,
__out_ecount_opt(*lpcwBuffer) WCHAR *pwzName)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/vm/clrprivbinderwinrt.cpp b/src/vm/clrprivbinderwinrt.cpp
index dc6556a7cf..1532943f35 100644
--- a/src/vm/clrprivbinderwinrt.cpp
+++ b/src/vm/clrprivbinderwinrt.cpp
@@ -390,7 +390,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
const WCHAR * wszFileName = pFileNameElem->GetValue();
pAssembly = FindAssemblyByFileName(wszFileName);
- WCHAR wszFileNameStripped[_MAX_PATH];
+ WCHAR wszFileNameStripped[_MAX_PATH] = {0};
SplitPath(wszFileName, NULL, NULL, NULL, NULL, wszFileNameStripped, _MAX_PATH, NULL, NULL);
if (pAssembly == nullptr)
diff --git a/src/vm/comdynamic.cpp b/src/vm/comdynamic.cpp
index 13be5f7008..28bf7ab368 100644
--- a/src/vm/comdynamic.cpp
+++ b/src/vm/comdynamic.cpp
@@ -1404,7 +1404,7 @@ HRESULT COMDynamicWrite::EmitDebugInfoBegin(Module *pModule,
// and fill out the debug directory and save off the symbols now.
if (pWriter != NULL)
{
- IMAGE_DEBUG_DIRECTORY debugDirIDD;
+ IMAGE_DEBUG_DIRECTORY debugDirIDD = {0};
DWORD debugDirDataSize;
BYTE *debugDirData;
diff --git a/src/vm/comisolatedstorage.cpp b/src/vm/comisolatedstorage.cpp
index 50eb9fe1b0..abdcb9b768 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_LONGPATH + 1];
+ WCHAR wszPath[MAX_LONGPATH + 1] = {0};
GetRootDirInternal(dwFlags, wszPath, COUNTOF(wszPath));
retRootDir.Set(wszPath);
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index cf1d399a13..0cb474e2f8 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -759,9 +759,9 @@ HRESULT CEECompileInfo::LoadTypeRefWinRT(
Assembly *pAssembly;
mdToken tkResolutionScope;
- pAssemblyImport->GetResolutionScopeOfTypeRef(ref, &tkResolutionScope);
-
- if(TypeFromToken(tkResolutionScope) == mdtAssemblyRef)
+ if(FAILED(pAssemblyImport->GetResolutionScopeOfTypeRef(ref, &tkResolutionScope)))
+ hr = S_FALSE;
+ else if(TypeFromToken(tkResolutionScope) == mdtAssemblyRef)
{
DWORD dwAssemblyRefFlags;
IfFailThrow(pAssemblyImport->GetAssemblyRefProps(tkResolutionScope, NULL, NULL,
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp
index df0f9bf4c9..f6fabde447 100644
--- a/src/vm/dllimport.cpp
+++ b/src/vm/dllimport.cpp
@@ -4031,7 +4031,7 @@ struct HiddenParameterInfo
void CheckForHiddenParameters(DWORD cParamMarshalInfo,
__in_ecount(cParamMarshalInfo) MarshalInfo *pParamMarshalInfo,
__out DWORD *pcHiddenNativeParameters,
- __out_ecount(*pcHiddenNativeParameters) HiddenParameterInfo **ppHiddenNativeParameters)
+ __out HiddenParameterInfo **ppHiddenNativeParameters)
{
CONTRACTL
{
diff --git a/src/vm/dwbucketmanager.hpp b/src/vm/dwbucketmanager.hpp
index 11d56de66b..abcc6f3ed0 100644
--- a/src/vm/dwbucketmanager.hpp
+++ b/src/vm/dwbucketmanager.hpp
@@ -513,7 +513,7 @@ void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targe
WCHAR appPath[MAX_LONGPATH];
DWORD cchAppPath = NumItems(appPath);
- WCHAR verBuf[23];
+ WCHAR verBuf[23] = {0};
USHORT major, minor, build, revision;
if ((GetCurrentModuleFileName(appPath, &cchAppPath) == S_OK) && SUCCEEDED(DwGetFileVersionInfo(appPath, major, minor, build, revision)))
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index 7b4899d662..a8a8b167dc 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -5868,7 +5868,7 @@ DefaultCatchHandler(PEXCEPTION_POINTERS pExceptionPointers,
}
const int buf_size = 128;
- WCHAR buf[buf_size];
+ WCHAR buf[buf_size] = {0};
// See detailed explanation of this flag in threads.cpp. But the basic idea is that we already
// reported the exception in the AppDomain where it went unhandled, so we don't need to report
diff --git a/src/vm/mdaassistants.cpp b/src/vm/mdaassistants.cpp
index 38c38d89b0..cac15fdd81 100644
--- a/src/vm/mdaassistants.cpp
+++ b/src/vm/mdaassistants.cpp
@@ -996,7 +996,11 @@ void MdaPInvokeLog::LogPInvoke(NDirectMethodDesc* pMD, HINSTANCE hMod)
StackSString sszEntryPoint;
sszEntryPoint.SetUTF8(pMD->GetEntrypointName());
- WCHAR szDllFullName[_MAX_PATH], szDrive[_MAX_PATH], szPath[_MAX_PATH], szFileName[_MAX_PATH], szExt[_MAX_PATH];
+ WCHAR szDllFullName[_MAX_PATH] = {0};
+ WCHAR szDrive[_MAX_PATH] = {0};
+ WCHAR szPath[_MAX_PATH] = {0};
+ WCHAR szFileName[_MAX_PATH] = {0};
+ WCHAR szExt[_MAX_PATH] = {0};
WszGetModuleFileName(hMod, szDllFullName, _MAX_PATH);
SplitPath(szDllFullName, szDrive, _MAX_PATH, szPath, _MAX_PATH, szFileName, _MAX_PATH, szExt, _MAX_PATH);
diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp
index b46ac44b73..9c7e447c51 100644
--- a/src/vm/securitymeta.cpp
+++ b/src/vm/securitymeta.cpp
@@ -1834,7 +1834,7 @@ TokenSecurityDescriptorFlags ParseAptcaAttribute(const BYTE *pbAptcaBlob, DWORD
aptcaFlags |= TokenSecurityDescriptorFlags_APTCA;
// Look for the PartialTrustVisibilityLevel named argument
- CaNamedArg namedArgs[1];
+ CaNamedArg namedArgs[1] = {0};
namedArgs[0].InitI4FieldEnum(g_PartialTrustVisibilityLevel, g_SecurityPartialTrustVisibilityLevel);
if (SUCCEEDED(ParseKnownCaNamedArgs(cap, namedArgs, _countof(namedArgs))))
diff --git a/src/vm/tlbexport.cpp b/src/vm/tlbexport.cpp
index 17861387bc..744671099a 100644
--- a/src/vm/tlbexport.cpp
+++ b/src/vm/tlbexport.cpp
@@ -277,10 +277,10 @@ void ExportTypeLibFromLoadedAssembly(
TypeLibExporter exporter; // Exporter object.
LPCWSTR szModule=0; // Module filename.
- WCHAR rcDrive[_MAX_DRIVE];
- WCHAR rcDir[_MAX_DIR];
- WCHAR rcFile[_MAX_FNAME];
- WCHAR rcTlb[_MAX_PATH+5]; // Buffer for the tlb filename.
+ WCHAR rcDrive[_MAX_DRIVE] = {0};
+ WCHAR rcDir[_MAX_DIR] = {0};
+ WCHAR rcFile[_MAX_FNAME] = {0};
+ WCHAR rcTlb[_MAX_PATH+5] = {0}; // Buffer for the tlb filename.
int bDynamic=0; // If true, dynamic module.
Module *pModule; // The Assembly's SecurityModule.
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 9c135407da..f823aa9c8d 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -31,7 +31,7 @@
// Called again with a nonnull *pdstout to fill in the actual buffer.
//
// Returns the # of arguments.
-static UINT ParseCommandLine(LPCWSTR psrc, __out LPWSTR *pdstout)
+static UINT ParseCommandLine(LPCWSTR psrc, __inout LPWSTR *pdstout)
{
CONTRACTL
{