summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorRahul Kumar <rahku@microsoft.com>2015-09-25 14:03:54 -0700
committerMatt Ellis <matell@microsoft.com>2015-09-25 17:24:02 -0700
commit6ac3cef4e3b82b3b9fbbce50a4a762e576464634 (patch)
treee4740ff710922047a7359b0927274988ef14c052 /src/utilcode
parentf0c1382fd5c65e44585b84a4bf3dd8ec86d73c6c (diff)
downloadcoreclr-6ac3cef4e3b82b3b9fbbce50a4a762e576464634.tar.gz
coreclr-6ac3cef4e3b82b3b9fbbce50a4a762e576464634.tar.bz2
coreclr-6ac3cef4e3b82b3b9fbbce50a4a762e576464634.zip
Fix for 134453: fix prefast warnings
[tfs-changeset: 1529946]
Diffstat (limited to 'src/utilcode')
-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
10 files changed, 14 insertions, 6 deletions
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);
}