[KERNEL32]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 16 Jun 2013 17:16:33 +0000 (17:16 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 16 Jun 2013 17:16:33 +0000 (17:16 +0000)
- 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

reactos/dll/win32/kernel32/client/console/console.c
reactos/dll/win32/kernel32/client/console/init.c
reactos/dll/win32/kernel32/include/console.h
reactos/include/reactos/subsys/win/conmsg.h

index da10ae8..cd6f05f 100644 (file)
@@ -937,8 +937,6 @@ AllocConsole(VOID)
     CONSOLE_API_MESSAGE ApiMessage;
     PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &ApiMessage.Data.AllocConsoleRequest;
     PCSR_CAPTURE_BUFFER CaptureBuffer;
     CONSOLE_API_MESSAGE ApiMessage;
     PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &ApiMessage.Data.AllocConsoleRequest;
     PCSR_CAPTURE_BUFFER CaptureBuffer;
-    LPWSTR AppPath = NULL;
-    SIZE_T Length = 0;
 
     if (Parameters->ConsoleHandle)
     {
 
     if (Parameters->ConsoleHandle)
     {
@@ -959,14 +957,8 @@ AllocConsole(VOID)
                               sizeof(CONSOLE_START_INFO),
                               (PVOID*)&AllocConsoleRequest->ConsoleStartInfo);
 
                               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;
 
     AllocConsoleRequest->Console = NULL;
     AllocConsoleRequest->CtrlDispatcher = ConsoleControlDispatcher;
index 957827d..33203b0 100644 (file)
@@ -108,12 +108,16 @@ PropDialogHandler(IN LPVOID lpThreadParameter)
 
 
 VOID
 
 
 VOID
-InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo)
+InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
+                IN PUNICODE_STRING ImagePathName)
 {
     STARTUPINFOW si;
 {
     STARTUPINFOW si;
+    SIZE_T Length;
 
 
+    /* Get the startup information */
     GetStartupInfoW(&si);
 
     GetStartupInfoW(&si);
 
+    /* Initialize the fields */
     ConsoleStartInfo->dwStartupFlags = si.dwFlags;
     if (si.dwFlags & STARTF_USEFILLATTRIBUTE)
     {
     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);
     }
         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);
     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';
     }
     {
         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
     {
     }
     else
     {
-        SIZE_T Length = 0;
         LPCWSTR ExeName;
 
         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'\\');
 
         /* Initialize Input EXE name */
         ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\');
index 78672e0..a7e69e7 100644 (file)
@@ -51,7 +51,8 @@ HANDLE FASTCALL
 TranslateStdHandle(HANDLE hHandle);
 
 VOID
 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,
 
 LPCWSTR
 IntCheckForConsoleFileName(IN LPCWSTR pszName,
index 4434865..0f75fcc 100644 (file)
@@ -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
     // 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
 } CONSOLE_START_INFO, *PCONSOLE_START_INFO;
 
 typedef struct _CONSOLE_CONNECTION_INFO
@@ -315,7 +317,7 @@ typedef struct
     COORD BufferSize;
     COORD BufferCoord;
     SMALL_RECT WriteRegion;
     COORD BufferSize;
     COORD BufferCoord;
     SMALL_RECT WriteRegion;
-    CHAR_INFO* CharInfo;
+    PCHAR_INFO CharInfo;
 } CONSOLE_WRITEOUTPUT, *PCONSOLE_WRITEOUTPUT;
 
 typedef struct
 } CONSOLE_WRITEOUTPUT, *PCONSOLE_WRITEOUTPUT;
 
 typedef struct
@@ -372,12 +374,12 @@ typedef struct
 {
     HANDLE OutputHandle;
 
 {
     HANDLE OutputHandle;
 
-    ULONG BufferSize;
+    ULONG BufferSize; // Seems unusued
     WORD Length;
     COORD Coord;
     COORD EndCoord;
 
     WORD Length;
     COORD Coord;
     COORD EndCoord;
 
-    ULONG NrCharactersWritten;
+    ULONG NrCharactersWritten; // Seems unusued
 
     CODE_TYPE CodeType;
     union
 
     CODE_TYPE CodeType;
     union
@@ -427,7 +429,7 @@ typedef struct
     COORD BufferSize;
     COORD BufferCoord;
     SMALL_RECT ReadRegion;
     COORD BufferSize;
     COORD BufferCoord;
     SMALL_RECT ReadRegion;
-    CHAR_INFO* CharInfo;
+    PCHAR_INFO CharInfo;
 } CONSOLE_READOUTPUT, *PCONSOLE_READOUTPUT;
 
 typedef struct
 } CONSOLE_READOUTPUT, *PCONSOLE_READOUTPUT;
 
 typedef struct