From 10ebf674da5df9224e4eddd3545518434c5b455b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 2 Mar 2021 14:19:14 -0600 Subject: Update rest of dutil to use their own source with the Exit* macros. Fix some CA warnings. --- src/dutil/uncutil.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/dutil/uncutil.cpp') diff --git a/src/dutil/uncutil.cpp b/src/dutil/uncutil.cpp index 6deb43bd..415ea198 100644 --- a/src/dutil/uncutil.cpp +++ b/src/dutil/uncutil.cpp @@ -2,6 +2,21 @@ #include "precomp.h" + +// Exit macros +#define UncExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_UNCUTIL, x, s, __VA_ARGS__) +#define UncExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_UNCUTIL, p, x, e, s, __VA_ARGS__) +#define UncExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_UNCUTIL, p, x, s, __VA_ARGS__) +#define UncExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_UNCUTIL, p, x, e, s, __VA_ARGS__) +#define UncExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_UNCUTIL, p, x, s, __VA_ARGS__) +#define UncExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_UNCUTIL, e, x, s, __VA_ARGS__) +#define UncExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_UNCUTIL, g, x, s, __VA_ARGS__) + DAPI_(HRESULT) UncConvertFromMountedDrive( __inout LPWSTR *psczUNCPath, __in LPCWSTR sczMountedDrivePath @@ -14,7 +29,7 @@ DAPI_(HRESULT) UncConvertFromMountedDrive( // Only copy drive letter and colon hr = StrAllocString(&sczDrive, sczMountedDrivePath, 2); - ExitOnFailure(hr, "Failed to copy drive"); + UncExitOnFailure(hr, "Failed to copy drive"); // ERROR_NOT_CONNECTED means it's not a mapped drive er = ::WNetGetConnectionW(sczDrive, NULL, &dwLength); @@ -23,7 +38,7 @@ DAPI_(HRESULT) UncConvertFromMountedDrive( er = ERROR_SUCCESS; hr = StrAlloc(psczUNCPath, dwLength); - ExitOnFailure(hr, "Failed to allocate string to get raw UNC path of length %u", dwLength); + UncExitOnFailure(hr, "Failed to allocate string to get raw UNC path of length %u", dwLength); er = ::WNetGetConnectionW(sczDrive, *psczUNCPath, &dwLength); if (ERROR_CONNECTION_UNAVAIL == er) @@ -31,11 +46,11 @@ DAPI_(HRESULT) UncConvertFromMountedDrive( // This means the drive is remembered but not currently connected, this can mean the location is accessible via UNC path but not via mounted drive path er = ERROR_SUCCESS; } - ExitOnWin32Error(er, hr, "::WNetGetConnectionW() failed with buffer provided on drive %ls", sczDrive); + UncExitOnWin32Error(er, hr, "::WNetGetConnectionW() failed with buffer provided on drive %ls", sczDrive); // Skip drive letter and colon hr = StrAllocConcat(psczUNCPath, sczMountedDrivePath + 2, 0); - ExitOnFailure(hr, "Failed to copy rest of database path"); + UncExitOnFailure(hr, "Failed to copy rest of database path"); } else { @@ -44,7 +59,7 @@ DAPI_(HRESULT) UncConvertFromMountedDrive( er = ERROR_NO_DATA; } - ExitOnWin32Error(er, hr, "::WNetGetConnectionW() failed on drive %ls", sczDrive); + UncExitOnWin32Error(er, hr, "::WNetGetConnectionW() failed on drive %ls", sczDrive); } LExit: -- cgit v1.2.3-55-g6feb