From: Hermès Bélusca-Maïto Date: Sun, 16 Jun 2013 17:16:33 +0000 (+0000) Subject: [KERNEL32] X-Git-Tag: backups/vs_jc@59301^2~21 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=aa910aeae4e1adedd20bea1d9ee6e56201045977 [KERNEL32] - Simplify initialization of CONSOLE_START_INFO objects by also initializing their AppPath member in InitConsoleInfo. - Add two members IconPath and IconIndex in the CONSOLE_START_INFO structure, to be used in a future work... [HEADERS] - CHAR_INFO* == PCHAR_INFO - Add two informative comments for two fields of the CONSOLE_READOUTPUT structure (again, to be used in a future work...) svn path=/trunk/; revision=59234 --- diff --git a/reactos/dll/win32/kernel32/client/console/console.c b/reactos/dll/win32/kernel32/client/console/console.c index da10ae82b3d..cd6f05f98d0 100644 --- a/reactos/dll/win32/kernel32/client/console/console.c +++ b/reactos/dll/win32/kernel32/client/console/console.c @@ -937,8 +937,6 @@ AllocConsole(VOID) CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &ApiMessage.Data.AllocConsoleRequest; PCSR_CAPTURE_BUFFER CaptureBuffer; - LPWSTR AppPath = NULL; - SIZE_T Length = 0; if (Parameters->ConsoleHandle) { @@ -959,14 +957,8 @@ AllocConsole(VOID) sizeof(CONSOLE_START_INFO), (PVOID*)&AllocConsoleRequest->ConsoleStartInfo); -/** Copied from BasepInitConsole **********************************************/ - InitConsoleInfo(AllocConsoleRequest->ConsoleStartInfo); - - AppPath = AllocConsoleRequest->ConsoleStartInfo->AppPath; - Length = min(MAX_PATH, Parameters->ImagePathName.Length / sizeof(WCHAR)); - wcsncpy(AppPath, Parameters->ImagePathName.Buffer, Length); - AppPath[Length] = L'\0'; -/******************************************************************************/ + InitConsoleInfo(AllocConsoleRequest->ConsoleStartInfo, + &Parameters->ImagePathName); AllocConsoleRequest->Console = NULL; AllocConsoleRequest->CtrlDispatcher = ConsoleControlDispatcher; diff --git a/reactos/dll/win32/kernel32/client/console/init.c b/reactos/dll/win32/kernel32/client/console/init.c index 957827d179f..33203b00942 100644 --- a/reactos/dll/win32/kernel32/client/console/init.c +++ b/reactos/dll/win32/kernel32/client/console/init.c @@ -108,12 +108,16 @@ PropDialogHandler(IN LPVOID lpThreadParameter) VOID -InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo) +InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo, + IN PUNICODE_STRING ImagePathName) { STARTUPINFOW si; + SIZE_T Length; + /* Get the startup information */ GetStartupInfoW(&si); + /* Initialize the fields */ ConsoleStartInfo->dwStartupFlags = si.dwFlags; if (si.dwFlags & STARTF_USEFILLATTRIBUTE) { @@ -138,12 +142,8 @@ InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo) ConsoleStartInfo->ConsoleWindowSize.cx = (LONG)(si.dwXSize); ConsoleStartInfo->ConsoleWindowSize.cy = (LONG)(si.dwYSize); } - /* - if (si.dwFlags & STARTF_RUNFULLSCREEN) - { - } - */ + /* Set up the title for the console */ if (si.lpTitle) { wcsncpy(ConsoleStartInfo->ConsoleTitle, si.lpTitle, MAX_PATH + 1); @@ -152,6 +152,16 @@ InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo) { ConsoleStartInfo->ConsoleTitle[0] = L'\0'; } + + /* Retrieve the application path name */ + Length = min(sizeof(ConsoleStartInfo->AppPath) / sizeof(ConsoleStartInfo->AppPath[0]) - 1, + ImagePathName->Length / sizeof(WCHAR)); + wcsncpy(ConsoleStartInfo->AppPath, ImagePathName->Buffer, Length); + ConsoleStartInfo->AppPath[Length] = L'\0'; + + /* The Console Server will use these fields to set up the console icon */ + ConsoleStartInfo->IconPath[0] = L'\0'; + ConsoleStartInfo->IconIndex = 0; } @@ -191,15 +201,10 @@ BasepInitConsole(VOID) } else { - SIZE_T Length = 0; LPCWSTR ExeName; - InitConsoleInfo(&ConnectInfo.ConsoleStartInfo); - - Length = min(sizeof(ConnectInfo.ConsoleStartInfo.AppPath) / sizeof(ConnectInfo.ConsoleStartInfo.AppPath[0]) - 1, - Parameters->ImagePathName.Length / sizeof(WCHAR)); - wcsncpy(ConnectInfo.ConsoleStartInfo.AppPath, Parameters->ImagePathName.Buffer, Length); - ConnectInfo.ConsoleStartInfo.AppPath[Length] = L'\0'; + InitConsoleInfo(&ConnectInfo.ConsoleStartInfo, + &Parameters->ImagePathName); /* Initialize Input EXE name */ ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); diff --git a/reactos/dll/win32/kernel32/include/console.h b/reactos/dll/win32/kernel32/include/console.h index 78672e0dad9..a7e69e727f3 100644 --- a/reactos/dll/win32/kernel32/include/console.h +++ b/reactos/dll/win32/kernel32/include/console.h @@ -51,7 +51,8 @@ HANDLE FASTCALL TranslateStdHandle(HANDLE hHandle); VOID -InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo); +InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo, + IN PUNICODE_STRING ImagePathName); LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, diff --git a/reactos/include/reactos/subsys/win/conmsg.h b/reactos/include/reactos/subsys/win/conmsg.h index 443486558e7..0f75fcc373c 100644 --- a/reactos/include/reactos/subsys/win/conmsg.h +++ b/reactos/include/reactos/subsys/win/conmsg.h @@ -122,6 +122,8 @@ typedef struct _CONSOLE_START_INFO // UNICODE_STRING ConsoleTitle; WCHAR ConsoleTitle[MAX_PATH + 1]; // Console title or full path to the startup shortcut WCHAR AppPath[MAX_PATH + 1]; // Full path of the launched app + WCHAR IconPath[MAX_PATH + 1]; // Path to the file containing the icon + INT IconIndex; // Index of the icon } CONSOLE_START_INFO, *PCONSOLE_START_INFO; typedef struct _CONSOLE_CONNECTION_INFO @@ -315,7 +317,7 @@ typedef struct COORD BufferSize; COORD BufferCoord; SMALL_RECT WriteRegion; - CHAR_INFO* CharInfo; + PCHAR_INFO CharInfo; } CONSOLE_WRITEOUTPUT, *PCONSOLE_WRITEOUTPUT; typedef struct @@ -372,12 +374,12 @@ typedef struct { HANDLE OutputHandle; - ULONG BufferSize; + ULONG BufferSize; // Seems unusued WORD Length; COORD Coord; COORD EndCoord; - ULONG NrCharactersWritten; + ULONG NrCharactersWritten; // Seems unusued CODE_TYPE CodeType; union @@ -427,7 +429,7 @@ typedef struct COORD BufferSize; COORD BufferCoord; SMALL_RECT ReadRegion; - CHAR_INFO* CharInfo; + PCHAR_INFO CharInfo; } CONSOLE_READOUTPUT, *PCONSOLE_READOUTPUT; typedef struct