diff options
author | Rob Mensching <rob@firegiant.com> | 2022-11-17 16:05:22 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-11-21 09:12:41 -0800 |
commit | 83a63bdc1943187e93749420a3408cd6248eedb9 (patch) | |
tree | 617e931eddbf3ed96839ad4e100421e627a1ced5 /src/libs/dutil/WixToolset.DUtil/inc/conutil.h | |
parent | 307e3f1bb587b93ad386bbfd9b2d4603a72d80c4 (diff) | |
download | wix-83a63bdc1943187e93749420a3408cd6248eedb9.tar.gz wix-83a63bdc1943187e93749420a3408cd6248eedb9.tar.bz2 wix-83a63bdc1943187e93749420a3408cd6248eedb9.zip |
Add support for UTF-8 console and use it for passing smartcab paths
Fixes 7024
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/inc/conutil.h')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/conutil.h | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/conutil.h b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h index 38aaea84..92e7f600 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/conutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h | |||
@@ -33,16 +33,46 @@ void DAPI ConsoleRed(); | |||
33 | void DAPI ConsoleYellow(); | 33 | void DAPI ConsoleYellow(); |
34 | void DAPI ConsoleNormal(); | 34 | void DAPI ConsoleNormal(); |
35 | 35 | ||
36 | /******************************************************************** | ||
37 | ConsoleWrite - full color printfA without libc | ||
38 | |||
39 | NOTE: only supports ANSI characters | ||
40 | assumes already in normal color and resets the screen to normal color | ||
41 | ********************************************************************/ | ||
36 | HRESULT DAPI ConsoleWrite( | 42 | HRESULT DAPI ConsoleWrite( |
37 | CONSOLE_COLOR cc, | 43 | CONSOLE_COLOR cc, |
38 | __in_z __format_string LPCSTR szFormat, | 44 | __in_z __format_string LPCSTR szFormat, |
39 | ... | 45 | ... |
40 | ); | 46 | ); |
47 | |||
48 | /******************************************************************** | ||
49 | ConsoleWriteW - sends UTF-8 characters to console out in color. | ||
50 | |||
51 | NOTE: assumes already in normal color and resets the screen to normal color | ||
52 | ********************************************************************/ | ||
53 | HRESULT DAPI ConsoleWriteW( | ||
54 | __in CONSOLE_COLOR cc, | ||
55 | __in_z LPCWSTR wzData | ||
56 | ); | ||
57 | |||
58 | /******************************************************************** | ||
59 | ConsoleWriteLine - full color printfA plus newline without libc | ||
60 | |||
61 | NOTE: only supports ANSI characters | ||
62 | assumes already in normal color and resets the screen to normal color | ||
63 | ********************************************************************/ | ||
41 | HRESULT DAPI ConsoleWriteLine( | 64 | HRESULT DAPI ConsoleWriteLine( |
42 | CONSOLE_COLOR cc, | 65 | CONSOLE_COLOR cc, |
43 | __in_z __format_string LPCSTR szFormat, | 66 | __in_z __format_string LPCSTR szFormat, |
44 | ... | 67 | ... |
45 | ); | 68 | ); |
69 | |||
70 | /******************************************************************** | ||
71 | ConsoleWriteError - display an error to the console out | ||
72 | |||
73 | NOTE: only supports ANSI characters | ||
74 | does not write to stderr | ||
75 | ********************************************************************/ | ||
46 | HRESULT DAPI ConsoleWriteError( | 76 | HRESULT DAPI ConsoleWriteError( |
47 | HRESULT hrError, | 77 | HRESULT hrError, |
48 | CONSOLE_COLOR cc, | 78 | CONSOLE_COLOR cc, |
@@ -50,28 +80,58 @@ HRESULT DAPI ConsoleWriteError( | |||
50 | ... | 80 | ... |
51 | ); | 81 | ); |
52 | 82 | ||
83 | /******************************************************************** | ||
84 | ConsoleReadW - reads a line from console in as UTF-8 to populate Unicode buffer | ||
85 | |||
86 | ********************************************************************/ | ||
53 | HRESULT DAPI ConsoleReadW( | 87 | HRESULT DAPI ConsoleReadW( |
54 | __deref_out_z LPWSTR* ppwzBuffer | 88 | __deref_out_z LPWSTR* ppwzBuffer |
55 | ); | 89 | ); |
56 | 90 | ||
91 | /******************************************************************** | ||
92 | ConsoleReadNonBlockingW - Read from the console without blocking | ||
93 | Won't work for redirected files (exe < txtfile), but will work for stdin redirected to | ||
94 | an anonymous or named pipe | ||
95 | |||
96 | if (fReadLine), stop reading immediately when \r\n is found | ||
97 | *********************************************************************/ | ||
98 | HRESULT DAPI ConsoleReadNonBlockingW( | ||
99 | __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer, | ||
100 | __out DWORD* pcchSize, | ||
101 | BOOL fReadLine | ||
102 | ); | ||
103 | |||
104 | /******************************************************************** | ||
105 | ConsoleReadStringA - get console input without libc | ||
106 | |||
107 | NOTE: only supports ANSI characters | ||
108 | *********************************************************************/ | ||
57 | HRESULT DAPI ConsoleReadStringA( | 109 | HRESULT DAPI ConsoleReadStringA( |
58 | __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPSTR* szCharBuffer, | 110 | __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPSTR* szCharBuffer, |
59 | CONST DWORD cchCharBuffer, | 111 | CONST DWORD cchCharBuffer, |
60 | __out DWORD* pcchNumCharReturn | 112 | __out DWORD* pcchNumCharReturn |
61 | ); | 113 | ); |
114 | |||
115 | /******************************************************************** | ||
116 | ConsoleReadStringW - get console input without libc | ||
117 | |||
118 | *********************************************************************/ | ||
62 | HRESULT DAPI ConsoleReadStringW( | 119 | HRESULT DAPI ConsoleReadStringW( |
63 | __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPWSTR* szCharBuffer, | 120 | __deref_inout_ecount_part(cchCharBuffer,*pcchNumCharReturn) LPWSTR* szCharBuffer, |
64 | CONST DWORD cchCharBuffer, | 121 | CONST DWORD cchCharBuffer, |
65 | __out DWORD* pcchNumCharReturn | 122 | __out DWORD* pcchNumCharReturn |
66 | ); | 123 | ); |
67 | 124 | ||
68 | HRESULT DAPI ConsoleReadNonBlockingW( | 125 | /******************************************************************** |
69 | __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer, | 126 | ConsoleSetReadHidden - set console input no echo |
70 | __out DWORD* pcchSize, | ||
71 | BOOL fReadLine | ||
72 | ); | ||
73 | 127 | ||
128 | *********************************************************************/ | ||
74 | HRESULT DAPI ConsoleSetReadHidden(void); | 129 | HRESULT DAPI ConsoleSetReadHidden(void); |
130 | |||
131 | /******************************************************************** | ||
132 | ConsoleSetReadNormal - reset to echo | ||
133 | |||
134 | *********************************************************************/ | ||
75 | HRESULT DAPI ConsoleSetReadNormal(void); | 135 | HRESULT DAPI ConsoleSetReadNormal(void); |
76 | 136 | ||
77 | #ifdef __cplusplus | 137 | #ifdef __cplusplus |