aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/WixToolset.DUtil/inc/conutil.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/conutil.h')
-rw-r--r--src/libs/dutil/WixToolset.DUtil/inc/conutil.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/conutil.h b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h
new file mode 100644
index 00000000..38aaea84
--- /dev/null
+++ b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h
@@ -0,0 +1,80 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#define ConsoleExitOnFailureSource(d, x, c, f, ...) if (FAILED(x)) { ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; }
10#define ConsoleExitOnLastErrorSource(d, x, c, f, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; } }
11#define ConsoleExitOnNullSource(d, p, x, e, c, f, ...) if (NULL == p) { x = e; ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; }
12#define ConsoleExitOnNullWithLastErrorSource(d, p, x, c, f, ...) if (NULL == p) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; }
13#define ConsoleExitWithLastErrorSource(d, x, c, f, ...) { DWORD Dutil_er = ::GetLastError(); x = HRESULT_FROM_WIN32(Dutil_er); if (!FAILED(x)) { x = E_FAIL; } ConsoleWriteError(x, c, f, __VA_ARGS__); ExitTraceSource(d, x, f, __VA_ARGS__); goto LExit; }
14
15
16#define ConsoleExitOnFailure(x, c, f, ...) ConsoleExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, c, f, __VA_ARGS__)
17#define ConsoleExitOnLastError(x, c, f, ...) ConsoleExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, c, f, __VA_ARGS__)
18#define ConsoleExitOnNull(p, x, e, c, f, ...) ConsoleExitOnNullSource(DUTIL_SOURCE_DEFAULT, p, x, e, c, f, __VA_ARGS__)
19#define ConsoleExitOnNullWithLastError(p, x, c, f, ...) ConsoleExitOnNullWithLastErrorSource(DUTIL_SOURCE_DEFAULT, p, x, c, f, __VA_ARGS__)
20#define ConsoleExitWithLastError(x, c, f, ...) ConsoleExitWithLastErrorSource(DUTIL_SOURCE_DEFAULT, x, c, f, __VA_ARGS__)
21
22// enums
23typedef enum CONSOLE_COLOR { CONSOLE_COLOR_NORMAL, CONSOLE_COLOR_RED, CONSOLE_COLOR_YELLOW, CONSOLE_COLOR_GREEN } CONSOLE_COLOR;
24
25// structs
26
27// functions
28HRESULT DAPI ConsoleInitialize();
29void DAPI ConsoleUninitialize();
30
31void DAPI ConsoleGreen();
32void DAPI ConsoleRed();
33void DAPI ConsoleYellow();
34void DAPI ConsoleNormal();
35
36HRESULT DAPI ConsoleWrite(
37 CONSOLE_COLOR cc,
38 __in_z __format_string LPCSTR szFormat,
39 ...
40 );
41HRESULT DAPI ConsoleWriteLine(
42 CONSOLE_COLOR cc,
43 __in_z __format_string LPCSTR szFormat,
44 ...
45 );
46HRESULT DAPI ConsoleWriteError(
47 HRESULT hrError,
48 CONSOLE_COLOR cc,
49 __in_z __format_string LPCSTR szFormat,
50 ...
51 );
52
53HRESULT DAPI ConsoleReadW(
54 __deref_out_z LPWSTR* ppwzBuffer
55 );
56
57HRESULT DAPI ConsoleReadStringA(
58 __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPSTR* szCharBuffer,
59 CONST DWORD cchCharBuffer,
60 __out DWORD* pcchNumCharReturn
61 );
62HRESULT DAPI ConsoleReadStringW(
63 __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPWSTR* szCharBuffer,
64 CONST DWORD cchCharBuffer,
65 __out DWORD* pcchNumCharReturn
66 );
67
68HRESULT DAPI ConsoleReadNonBlockingW(
69 __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer,
70 __out DWORD* pcchSize,
71 BOOL fReadLine
72 );
73
74HRESULT DAPI ConsoleSetReadHidden(void);
75HRESULT DAPI ConsoleSetReadNormal(void);
76
77#ifdef __cplusplus
78}
79#endif
80