Author: hbelusca Date: Sun Jun 16 17:16:33 2013 New Revision: 59234 URL: http://svn.reactos.org/svn/reactos?rev=59234&view=rev Log: [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...) Modified: trunk/reactos/dll/win32/kernel32/client/console/console.c trunk/reactos/dll/win32/kernel32/client/console/init.c trunk/reactos/dll/win32/kernel32/include/console.h trunk/reactos/include/reactos/subsys/win/conmsg.h Modified: trunk/reactos/dll/win32/kernel32/client/console/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/console/console.c?rev=59234&r1=59233&r2=59234&view=diff ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/console/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/console/console.c [iso-8859-1] Sun Jun 16 17:16:33 2013 @@ -937,8 +937,6 @@ 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 @@ 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; Modified: trunk/reactos/dll/win32/kernel32/client/console/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/console/init.c?rev=59234&r1=59233&r2=59234&view=diff ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/console/init.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/console/init.c [iso-8859-1] Sun Jun 16 17:16:33 2013 @@ -108,12 +108,16 @@ 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 @@ 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 @@ { 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 @@ } 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'\\'); Modified: trunk/reactos/dll/win32/kernel32/include/console.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include/console.h?rev=59234&r1=59233&r2=59234&view=diff ============================================================================== --- trunk/reactos/dll/win32/kernel32/include/console.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/console.h [iso-8859-1] Sun Jun 16 17:16:33 2013 @@ -51,7 +51,8 @@ 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, Modified: trunk/reactos/include/reactos/subsys/win/conmsg.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win/conmsg.h?rev=59234&r1=59233&r2=59234&view=diff ============================================================================== --- trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] Sun Jun 16 17:16:33 2013 @@ -122,6 +122,8 @@ // 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 @@ COORD BufferSize; COORD BufferCoord; SMALL_RECT WriteRegion; - CHAR_INFO* CharInfo; + PCHAR_INFO CharInfo; } CONSOLE_WRITEOUTPUT, *PCONSOLE_WRITEOUTPUT; typedef struct @@ -372,12 +374,12 @@ { 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 @@ COORD BufferSize; COORD BufferCoord; SMALL_RECT ReadRegion; - CHAR_INFO* CharInfo; + PCHAR_INFO CharInfo; } CONSOLE_READOUTPUT, *PCONSOLE_READOUTPUT; typedef struct