diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-12-11 17:07:46 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-12-12 23:09:38 -0600 |
commit | 701b31e26c3b3dfb6c140cbc0d48c6d39bf1f552 (patch) | |
tree | c17b5a98a1b3db4e6e6151c1130a816e5779a09d | |
parent | eab59ecbfd254bb8707615bc31b840339a6356d6 (diff) | |
download | wix-701b31e26c3b3dfb6c140cbc0d48c6d39bf1f552.tar.gz wix-701b31e26c3b3dfb6c140cbc0d48c6d39bf1f552.tar.bz2 wix-701b31e26c3b3dfb6c140cbc0d48c6d39bf1f552.zip |
Use ConsoleWriteW in netcoresearch.exe.
-rw-r--r-- | src/ext/NetFx/netcoresearch/netcoresearch.cpp | 9 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/conutil.cpp | 10 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/conutil.h | 4 |
3 files changed, 10 insertions, 13 deletions
diff --git a/src/ext/NetFx/netcoresearch/netcoresearch.cpp b/src/ext/NetFx/netcoresearch/netcoresearch.cpp index b2dad9a8..517f6ac4 100644 --- a/src/ext/NetFx/netcoresearch/netcoresearch.cpp +++ b/src/ext/NetFx/netcoresearch/netcoresearch.cpp | |||
@@ -24,9 +24,6 @@ int __cdecl wmain(int argc, LPWSTR argv[]) | |||
24 | HRESULT hr = S_OK; | 24 | HRESULT hr = S_OK; |
25 | DWORD dwMajorVersion = 0; | 25 | DWORD dwMajorVersion = 0; |
26 | VERUTIL_VERSION* pVersion = NULL; | 26 | VERUTIL_VERSION* pVersion = NULL; |
27 | LPSTR pszVersion = NULL; | ||
28 | |||
29 | ::SetConsoleCP(CP_UTF8); | ||
30 | 27 | ||
31 | ConsoleInitialize(); | 28 | ConsoleInitialize(); |
32 | 29 | ||
@@ -43,14 +40,10 @@ int __cdecl wmain(int argc, LPWSTR argv[]) | |||
43 | 40 | ||
44 | if (pVersion) | 41 | if (pVersion) |
45 | { | 42 | { |
46 | hr = StrAnsiAllocString(&pszVersion, pVersion->sczVersion, 0, CP_UTF8); | 43 | ConsoleWriteW(CONSOLE_COLOR_NORMAL, pVersion->sczVersion); |
47 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to convert version to UTF-8."); | ||
48 | |||
49 | ConsoleWrite(CONSOLE_COLOR_NORMAL, "%hs", pszVersion); | ||
50 | } | 44 | } |
51 | 45 | ||
52 | LExit: | 46 | LExit: |
53 | ReleaseStr(pszVersion); | ||
54 | ReleaseVerutilVersion(pVersion); | 47 | ReleaseVerutilVersion(pVersion); |
55 | ConsoleUninitialize(); | 48 | ConsoleUninitialize(); |
56 | return hr; | 49 | return hr; |
diff --git a/src/libs/dutil/WixToolset.DUtil/conutil.cpp b/src/libs/dutil/WixToolset.DUtil/conutil.cpp index 2aec36e5..059af0e0 100644 --- a/src/libs/dutil/WixToolset.DUtil/conutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/conutil.cpp | |||
@@ -30,13 +30,13 @@ static CONSOLE_SCREEN_BUFFER_INFO vcsbiInfo; | |||
30 | 30 | ||
31 | static HRESULT DAPI ReadInteractiveStdIn( | 31 | static HRESULT DAPI ReadInteractiveStdIn( |
32 | __deref_out_z LPWSTR* ppwzBuffer | 32 | __deref_out_z LPWSTR* ppwzBuffer |
33 | ); | 33 | ); |
34 | static HRESULT ReadRedirectedStdIn( | 34 | static HRESULT ReadRedirectedStdIn( |
35 | __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer, | 35 | __deref_out_ecount_opt(*pcchSize) LPWSTR* ppwzBuffer, |
36 | __out DWORD* pcchSize, | 36 | __out DWORD* pcchSize, |
37 | BOOL fReadLine, | 37 | BOOL fReadLine, |
38 | DWORD dwMaxRead | 38 | DWORD dwMaxRead |
39 | ); | 39 | ); |
40 | 40 | ||
41 | 41 | ||
42 | extern "C" HRESULT DAPI ConsoleInitialize() | 42 | extern "C" HRESULT DAPI ConsoleInitialize() |
@@ -207,7 +207,7 @@ LExit: | |||
207 | extern "C" HRESULT DAPI ConsoleWriteW( | 207 | extern "C" HRESULT DAPI ConsoleWriteW( |
208 | __in CONSOLE_COLOR cc, | 208 | __in CONSOLE_COLOR cc, |
209 | __in_z LPCWSTR wzData | 209 | __in_z LPCWSTR wzData |
210 | ) | 210 | ) |
211 | { | 211 | { |
212 | AssertSz(INVALID_HANDLE_VALUE != vhStdOut, "ConsoleInitialize() has not been called"); | 212 | AssertSz(INVALID_HANDLE_VALUE != vhStdOut, "ConsoleInitialize() has not been called"); |
213 | HRESULT hr = S_OK; | 213 | HRESULT hr = S_OK; |
@@ -616,7 +616,7 @@ LExit: | |||
616 | 616 | ||
617 | static HRESULT DAPI ReadInteractiveStdIn( | 617 | static HRESULT DAPI ReadInteractiveStdIn( |
618 | __deref_out_z LPWSTR* ppwzBuffer | 618 | __deref_out_z LPWSTR* ppwzBuffer |
619 | ) | 619 | ) |
620 | { | 620 | { |
621 | HRESULT hr = S_OK; | 621 | HRESULT hr = S_OK; |
622 | LPWSTR pwz = NULL; | 622 | LPWSTR pwz = NULL; |
@@ -678,7 +678,7 @@ static HRESULT ReadRedirectedStdIn( | |||
678 | __out DWORD* pcchSize, | 678 | __out DWORD* pcchSize, |
679 | BOOL fReadLine, | 679 | BOOL fReadLine, |
680 | DWORD dwMaxRead | 680 | DWORD dwMaxRead |
681 | ) | 681 | ) |
682 | { | 682 | { |
683 | HRESULT hr = S_OK; | 683 | HRESULT hr = S_OK; |
684 | LPSTR psz = NULL; | 684 | LPSTR psz = NULL; |
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/conutil.h b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h index 92e7f600..84038d1f 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/conutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/conutil.h | |||
@@ -25,6 +25,10 @@ typedef enum CONSOLE_COLOR { CONSOLE_COLOR_NORMAL, CONSOLE_COLOR_RED, CONSOLE_CO | |||
25 | // structs | 25 | // structs |
26 | 26 | ||
27 | // functions | 27 | // functions |
28 | /******************************************************************** | ||
29 | ConsoleInitialize - initialize console for UTF-8 | ||
30 | |||
31 | *********************************************************************/ | ||
28 | HRESULT DAPI ConsoleInitialize(); | 32 | HRESULT DAPI ConsoleInitialize(); |
29 | void DAPI ConsoleUninitialize(); | 33 | void DAPI ConsoleUninitialize(); |
30 | 34 | ||