https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce0110195bad5df47b8ec…
commit ce0110195bad5df47b8ec2c87ac539c81297409f
Author: He Yang <1160386205(a)qq.com>
AuthorDate: Wed Aug 26 17:10:51 2020 +0800
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Sep 6 17:10:18 2020 +0200
[RAPPS] improve ConInitStdStreams initialization logic (#3098)
---
base/applications/rapps/unattended.cpp | 14 ++++++++++----
base/applications/rapps/winmain.cpp | 2 --
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 839d8a53dcf..d20ef8aa3f2 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -40,6 +40,7 @@ BOOL HandleInstallCommand(LPWSTR szCommand, int argcLeft, LPWSTR *
argvLeft)
{
if (argcLeft == 0)
{
+ ConInitStdStreams(); // Initialize the Console Standard Streams
ConResMsgPrintf(StdOut, NULL, IDS_CMD_NEED_PACKAGE_NAME, szCommand);
return FALSE;
}
@@ -72,9 +73,11 @@ BOOL HandleSetupCommand(LPWSTR szCommand, int argcLeft, LPWSTR *
argvLeft)
{
if (argcLeft != 1)
{
+ ConInitStdStreams(); // Initialize the Console Standard Streams
ConResMsgPrintf(StdOut, NULL, IDS_CMD_NEED_FILE_NAME, szCommand);
return FALSE;
}
+ FreeConsole();
ATL::CSimpleArray<ATL::CStringW> PkgNameList;
HINF InfHandle = SetupOpenInfFileW(argvLeft[0], NULL, INF_STYLE_WIN4, NULL);
@@ -272,6 +275,8 @@ BOOL ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
if (hMutex)
CloseHandle(hMutex);
+
+ return TRUE;
}
else if (MatchCmdOption(argv[1], CMD_KEY_INSTALL))
{
@@ -281,7 +286,11 @@ BOOL ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
{
return HandleSetupCommand(argv[1], argc - 2, argv + 2);
}
- else if (MatchCmdOption(argv[1], CMD_KEY_FIND))
+
+
+ ConInitStdStreams(); // Initialize the Console Standard Streams
+
+ if (MatchCmdOption(argv[1], CMD_KEY_FIND))
{
return HandleFindCommand(argv[1], argc - 2, argv + 2);
}
@@ -299,7 +308,4 @@ BOOL ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
ConResPuts(StdOut, IDS_CMD_INVALID_OPTION);
return FALSE;
}
-
-
- return TRUE;
}
diff --git a/base/applications/rapps/winmain.cpp b/base/applications/rapps/winmain.cpp
index 740e4fa828f..253c802ad61 100644
--- a/base/applications/rapps/winmain.cpp
+++ b/base/applications/rapps/winmain.cpp
@@ -145,8 +145,6 @@ VOID SaveSettings(HWND hwnd)
int wmain(int argc, wchar_t *argv[])
{
- ConInitStdStreams(); // Initialize the Console Standard Streams
-
BOOL bIsFirstLaunch;
InitializeAtlModule(GetModuleHandle(NULL), TRUE);