aboutsummaryrefslogtreecommitdiff
path: root/src/dutil/guidutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dutil/guidutil.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/dutil/guidutil.cpp b/src/dutil/guidutil.cpp
index c0353892..204c9af2 100644
--- a/src/dutil/guidutil.cpp
+++ b/src/dutil/guidutil.cpp
@@ -2,6 +2,21 @@
2 2
3#include "precomp.h" 3#include "precomp.h"
4 4
5
6// Exit macros
7#define GuidExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
8#define GuidExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
9#define GuidExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
10#define GuidExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
11#define GuidExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
12#define GuidExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_GUIDUTIL, x, s, __VA_ARGS__)
13#define GuidExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_GUIDUTIL, p, x, e, s, __VA_ARGS__)
14#define GuidExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_GUIDUTIL, p, x, s, __VA_ARGS__)
15#define GuidExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_GUIDUTIL, p, x, e, s, __VA_ARGS__)
16#define GuidExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_GUIDUTIL, p, x, s, __VA_ARGS__)
17#define GuidExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_GUIDUTIL, e, x, s, __VA_ARGS__)
18#define GuidExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_GUIDUTIL, g, x, s, __VA_ARGS__)
19
5extern "C" HRESULT DAPI GuidFixedCreate( 20extern "C" HRESULT DAPI GuidFixedCreate(
6 _Out_z_cap_c_(GUID_STRING_LENGTH) WCHAR* wzGuid 21 _Out_z_cap_c_(GUID_STRING_LENGTH) WCHAR* wzGuid
7 ) 22 )
@@ -10,12 +25,12 @@ extern "C" HRESULT DAPI GuidFixedCreate(
10 UUID guid = { }; 25 UUID guid = { };
11 26
12 hr = HRESULT_FROM_RPC(::UuidCreate(&guid)); 27 hr = HRESULT_FROM_RPC(::UuidCreate(&guid));
13 ExitOnFailure(hr, "UuidCreate failed."); 28 GuidExitOnFailure(hr, "UuidCreate failed.");
14 29
15 if (!::StringFromGUID2(guid, wzGuid, GUID_STRING_LENGTH)) 30 if (!::StringFromGUID2(guid, wzGuid, GUID_STRING_LENGTH))
16 { 31 {
17 hr = E_OUTOFMEMORY; 32 hr = E_OUTOFMEMORY;
18 ExitOnRootFailure(hr, "Failed to convert guid into string."); 33 GuidExitOnRootFailure(hr, "Failed to convert guid into string.");
19 } 34 }
20 35
21LExit: 36LExit:
@@ -29,10 +44,10 @@ extern "C" HRESULT DAPI GuidCreate(
29 HRESULT hr = S_OK; 44 HRESULT hr = S_OK;
30 45
31 hr = StrAlloc(psczGuid, GUID_STRING_LENGTH); 46 hr = StrAlloc(psczGuid, GUID_STRING_LENGTH);
32 ExitOnFailure(hr, "Failed to allocate space for guid"); 47 GuidExitOnFailure(hr, "Failed to allocate space for guid");
33 48
34 hr = GuidFixedCreate(*psczGuid); 49 hr = GuidFixedCreate(*psczGuid);
35 ExitOnFailure(hr, "Failed to create new guid."); 50 GuidExitOnFailure(hr, "Failed to create new guid.");
36 51
37LExit: 52LExit:
38 return hr; 53 return hr;