https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ee613a18ebed2843e80eb…
commit ee613a18ebed2843e80eb8e02bdc8168e3c4b730
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon May 30 02:41:31 2022 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon May 30 02:41:31 2022 +0200
[DISKPART] Fix build. Simplify PrintMessageString().
---
base/system/diskpart/CMakeLists.txt | 6 ++++--
base/system/diskpart/misc.c | 21 +++++----------------
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/base/system/diskpart/CMakeLists.txt b/base/system/diskpart/CMakeLists.txt
index 7f31e513b4f..3d2d6cf7a86 100644
--- a/base/system/diskpart/CMakeLists.txt
+++ b/base/system/diskpart/CMakeLists.txt
@@ -46,6 +46,10 @@ list(APPEND SOURCE
diskpart.h)
add_executable(diskpart ${SOURCE} diskpart.rc)
+add_pch(diskpart diskpart.h SOURCE)
+add_message_headers(UNICODE diskpart_msg.mc)
+add_dependencies(diskpart diskpart_msg)
+
set_module_type(diskpart win32cui UNICODE)
target_link_libraries(diskpart conutils ${PSEH_LIB})
add_importlibs(diskpart advapi32 msvcrt kernel32 ntdll)
@@ -54,6 +58,4 @@ if(MSVC)
add_importlibs(diskpart ntdll)
endif()
-add_pch(diskpart diskpart.h SOURCE)
-add_message_headers(UNICODE diskpart_msg.mc)
add_cd_file(TARGET diskpart DESTINATION reactos/system32 FOR all)
diff --git a/base/system/diskpart/misc.c b/base/system/diskpart/misc.c
index b530f6581df..ddb2946a840 100644
--- a/base/system/diskpart/misc.c
+++ b/base/system/diskpart/misc.c
@@ -84,20 +84,9 @@ VOID
PrintMessageString(
_In_ DWORD dwMessage)
{
- PWSTR pBuffer;
-
- FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, //hModuleNetMsg,
- dwMessage,
- LANG_USER_DEFAULT,
- (LPWSTR)&pBuffer,
- 0,
- NULL);
- if (pBuffer)
- {
- ConPuts(StdOut, pBuffer);
- LocalFree(pBuffer);
- pBuffer = NULL;
- }
+ ConMsgPuts(StdOut,
+ FORMAT_MESSAGE_FROM_HMODULE,
+ NULL, //hModuleNetMsg,
+ dwMessage,
+ LANG_USER_DEFAULT);
}