[CONSRV]: Reorganize/rename/add some fields to CONSRV_API_CONNECTINFO, partially...
authorAlex Ionescu <aionescu@gmail.com>
Fri, 30 Aug 2013 17:14:41 +0000 (17:14 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Fri, 30 Aug 2013 17:14:41 +0000 (17:14 +0000)
svn path=/trunk/; revision=59904

reactos/dll/win32/kernel32/client/console/init.c
reactos/include/reactos/subsys/win/conmsg.h
reactos/win32ss/user/winsrv/consrv/console.c
reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c
reactos/win32ss/user/winsrv/consrv/init.c

index 4c8f7c5..80a7dff 100644 (file)
@@ -121,26 +121,26 @@ InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
     ConsoleStartInfo->dwStartupFlags = si.dwFlags;
     if (si.dwFlags & STARTF_USEFILLATTRIBUTE)
     {
-        ConsoleStartInfo->FillAttribute = si.dwFillAttribute;
+        ConsoleStartInfo->wFillAttribute = si.dwFillAttribute;
     }
     if (si.dwFlags & STARTF_USECOUNTCHARS)
     {
-        ConsoleStartInfo->ScreenBufferSize.X = (SHORT)(si.dwXCountChars);
-        ConsoleStartInfo->ScreenBufferSize.Y = (SHORT)(si.dwYCountChars);
+        ConsoleStartInfo->dwScreenBufferSize.X = (SHORT)(si.dwXCountChars);
+        ConsoleStartInfo->dwScreenBufferSize.Y = (SHORT)(si.dwYCountChars);
     }
     if (si.dwFlags & STARTF_USESHOWWINDOW)
     {
-        ConsoleStartInfo->ShowWindow = si.wShowWindow;
+        ConsoleStartInfo->wShowWindow = si.wShowWindow;
     }
     if (si.dwFlags & STARTF_USEPOSITION)
     {
-        ConsoleStartInfo->ConsoleWindowOrigin.x = (LONG)(si.dwX);
-        ConsoleStartInfo->ConsoleWindowOrigin.y = (LONG)(si.dwY);
+        ConsoleStartInfo->dwWindowOrigin.X = (LONG)(si.dwX);
+        ConsoleStartInfo->dwWindowOrigin.Y = (LONG)(si.dwY);
     }
     if (si.dwFlags & STARTF_USESIZE)
     {
-        ConsoleStartInfo->ConsoleWindowSize.cx = (LONG)(si.dwXSize);
-        ConsoleStartInfo->ConsoleWindowSize.cy = (LONG)(si.dwYSize);
+        ConsoleStartInfo->dwWindowSize.X = (LONG)(si.dwXSize);
+        ConsoleStartInfo->dwWindowSize.Y = (LONG) (si.dwYSize);
     }
 
     /* Set up the title for the console */
@@ -194,7 +194,7 @@ BasepInitConsole(VOID)
     {
         DPRINT("Image is not a console application\n");
         Parameters->ConsoleHandle = NULL;
-        ConnectInfo.ConsoleNeeded = FALSE; // ConsoleNeeded is used for knowing whether or not this is a CUI app.
+        ConnectInfo.ConsoleStartInfo.ConsoleNeeded = FALSE; // ConsoleNeeded is used for knowing whether or not this is a CUI app.
 
         ConnectInfo.ConsoleStartInfo.ConsoleTitle[0] = L'\0';
         ConnectInfo.ConsoleStartInfo.AppPath[0] = L'\0';
@@ -211,7 +211,7 @@ BasepInitConsole(VOID)
         if (ExeName) SetConsoleInputExeNameW(ExeName + 1);
 
         /* Assume one is needed */
-        ConnectInfo.ConsoleNeeded = TRUE;
+        ConnectInfo.ConsoleStartInfo.ConsoleNeeded = TRUE;
 
         /* Handle the special flags given to us by BasePushProcessParameters */
         if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS)
@@ -219,7 +219,7 @@ BasepInitConsole(VOID)
             /* No console to create */
             DPRINT("No console to create\n");
             Parameters->ConsoleHandle = NULL;
-            ConnectInfo.ConsoleNeeded = FALSE;
+            ConnectInfo.ConsoleStartInfo.ConsoleNeeded = FALSE;
         }
         else if (Parameters->ConsoleHandle == HANDLE_CREATE_NEW_CONSOLE)
         {
@@ -232,7 +232,7 @@ BasepInitConsole(VOID)
             /* We'll get the real one soon */
             DPRINT("Creating new invisible console\n");
             Parameters->ConsoleHandle = NULL;
-            ConnectInfo.ConsoleStartInfo.ShowWindow = SW_HIDE;
+            ConnectInfo.ConsoleStartInfo.wShowWindow = SW_HIDE;
         }
         else
         {
@@ -249,10 +249,10 @@ BasepInitConsole(VOID)
 
     /* Initialize the Console Ctrl Handler */
     InitConsoleCtrlHandling();
-    ConnectInfo.CtrlDispatcher = ConsoleControlDispatcher;
+    ConnectInfo.ConsoleStartInfo.CtrlDispatcher = ConsoleControlDispatcher;
 
     /* Initialize the Property Dialog Handler */
-    ConnectInfo.PropDispatcher = PropDialogHandler;
+    ConnectInfo.ConsoleStartInfo.PropDispatcher = PropDialogHandler;
 
     /* Setup the right Object Directory path */
     if (!SessionId)
@@ -287,7 +287,7 @@ BasepInitConsole(VOID)
     if (InServer) return TRUE;
 
     /* Nothing to do if not a console app */
-    if (!ConnectInfo.ConsoleNeeded) return TRUE;
+    if (!ConnectInfo.ConsoleStartInfo.ConsoleNeeded) return TRUE;
 
     /* We got the handles, let's set them */
     if ((Parameters->ConsoleHandle = ConnectInfo.ConsoleHandle))
index bebd8ec..d817b52 100644 (file)
@@ -110,38 +110,84 @@ typedef enum _CONSRV_API_NUMBER
     ConsolepMaxApiNumber
 } CONSRV_API_NUMBER, *PCONSRV_API_NUMBER;
 
-
+//
+// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb773359(v=vs.85).aspx
+//
+typedef struct _CONSOLE_PROPERTIES
+{
+    WORD wFillAttribute;
+    WORD wPopupFillAttribute;
+
+    //
+    // Not on MSDN, but show up in binary
+    //
+    WORD wShowWindow;
+    WORD wUnknown;
+
+    COORD dwScreenBufferSize;
+    COORD dwWindowSize;
+    COORD dwWindowOrigin;
+    DWORD nFont;
+    DWORD nInputBufferSize;
+    COORD dwFontSize;
+    UINT uFontFamily;
+    UINT uFontWeight;
+    WCHAR FaceName[LF_FACESIZE];
+    UINT uCursorSize;
+    BOOL bFullScreen;
+    BOOL bQuickEdit;
+    BOOL bInsertMode;
+    BOOL bAutoPosition;
+    UINT uHistoryBufferSize;
+    UINT uNumberOfHistoryBuffers;
+    BOOL bHistoryNoDup;
+    COLORREF ColorTable[16];
+
+    //NT_FE_CONSOLE_PROPS
+    UINT uCodePage;
+} CONSOLE_PROPERTIES;
+
+//
+// To minimize code changes, some fields were put here even though they really only belong in
+// CONSRV_API_CONNECTINFO. Do not change the ordering however, as it's required for Windows
+// compatibility.
+//
 typedef struct _CONSOLE_START_INFO
 {
+    INT IconIndex;
+    HICON IconHandle1;
+    HICON IconHandle2;
+    DWORD dwHotKey;
     DWORD dwStartupFlags;
-    DWORD FillAttribute;
-    COORD ScreenBufferSize;
-    WORD  ShowWindow;
-    POINT ConsoleWindowOrigin;
-    SIZE  ConsoleWindowSize;
-    // UNICODE_STRING ConsoleTitle;
+    CONSOLE_PROPERTIES;
+    BOOL ConsoleNeeded; // Used for GUI apps only.
+    LPTHREAD_START_ROUTINE CtrlDispatcher;
+    LPTHREAD_START_ROUTINE ImeDispatcher;
+    LPTHREAD_START_ROUTINE PropDispatcher;
+    ULONG TitleLength;
     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
+    ULONG DesktopLength;
+    PWCHAR DesktopPath;
+    ULONG AppNameLength;
+    WCHAR AppPath[128];        // Full path of the launched app
+    ULONG IconPathLength;
     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 _CONSRV_API_CONNECTINFO
 {
-    BOOL ConsoleNeeded; // Used for GUI apps only.
-
-    /* Adapted from CONSOLE_ALLOCCONSOLE */
-    CONSOLE_START_INFO ConsoleStartInfo;
-
     HANDLE ConsoleHandle;
+    HANDLE InputWaitHandle;
     HANDLE InputHandle;
     HANDLE OutputHandle;
     HANDLE ErrorHandle;
-    HANDLE InputWaitHandle;
-    LPTHREAD_START_ROUTINE CtrlDispatcher;
-    LPTHREAD_START_ROUTINE PropDispatcher;
+    HANDLE Event1;
+    HANDLE Event2;
+    /* Adapted from CONSOLE_ALLOCCONSOLE */
+    CONSOLE_START_INFO ConsoleStartInfo;
 } CONSRV_API_CONNECTINFO, *PCONSRV_API_CONNECTINFO;
 
+//C_ASSERT(sizeof(CONSRV_API_CONNECTINFO) == 0x638);
 
 typedef struct
 {
index 932d623..d904d1a 100644 (file)
@@ -249,17 +249,15 @@ ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
          */
         if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE)
         {
-            ConsoleInfo.ScreenAttrib = (USHORT)ConsoleStartInfo->FillAttribute;
+            ConsoleInfo.ScreenAttrib = (USHORT)ConsoleStartInfo->wFillAttribute;
         }
         if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS)
         {
-            ConsoleInfo.ScreenBufferSize = ConsoleStartInfo->ScreenBufferSize;
+            ConsoleInfo.ScreenBufferSize = ConsoleStartInfo->dwScreenBufferSize;
         }
         if (ConsoleStartInfo->dwStartupFlags & STARTF_USESIZE)
         {
-            // ConsoleInfo.ConsoleSize = ConsoleStartInfo->ConsoleWindowSize;
-            ConsoleInfo.ConsoleSize.X = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cx;
-            ConsoleInfo.ConsoleSize.Y = (SHORT)ConsoleStartInfo->ConsoleWindowSize.cy;
+            ConsoleInfo.ConsoleSize = ConsoleStartInfo->dwWindowSize;
         }
     }
 
index 34fe68f..33727eb 100644 (file)
@@ -2279,12 +2279,13 @@ GuiInitFrontEnd(IN OUT PFRONTEND This,
          */
         if (ConsoleStartInfo->dwStartupFlags & STARTF_USESHOWWINDOW)
         {
-            TermInfo.ShowWindow = ConsoleStartInfo->ShowWindow;
+            TermInfo.ShowWindow = ConsoleStartInfo->wShowWindow;
         }
         if (ConsoleStartInfo->dwStartupFlags & STARTF_USEPOSITION)
         {
             TermInfo.AutoPosition = FALSE;
-            TermInfo.WindowOrigin = ConsoleStartInfo->ConsoleWindowOrigin;
+            TermInfo.WindowOrigin.x = ConsoleStartInfo->dwWindowOrigin.X;
+            TermInfo.WindowOrigin.y = ConsoleStartInfo->dwWindowOrigin.Y;
         }
         if (ConsoleStartInfo->dwStartupFlags & STARTF_RUNFULLSCREEN)
         {
@@ -2868,7 +2869,7 @@ LoadShellLinkConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
 
                     /* Get the window showing command */
                     hRes = IShellLinkW_GetShowCmd(pshl, &ShowCmd);
-                    if (SUCCEEDED(hRes)) ConsoleStartInfo->ShowWindow = (WORD)ShowCmd;
+                    if (SUCCEEDED(hRes)) ConsoleStartInfo->wShowWindow = (WORD)ShowCmd;
 
                     /* Get the hotkey */
                     // hRes = pshl->GetHotkey(&ShowCmd);
index e33a0aa..09b2685 100644 (file)
@@ -413,7 +413,7 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
     }
 
     /* If we don't need a console, then get out of here */
-    if (!ConnectInfo->ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps.
+    if (!ConnectInfo->ConsoleStartInfo.ConsoleNeeded || !ProcessData->ConsoleApp) // In fact, it is for GUI apps.
     {
         return STATUS_SUCCESS;
     }
@@ -470,8 +470,8 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
     ConnectInfo->InputWaitHandle = ProcessData->ConsoleEvent;
 
     /* Set the Property-Dialog and Control-Dispatcher handlers */
-    ProcessData->PropDispatcher = ConnectInfo->PropDispatcher;
-    ProcessData->CtrlDispatcher = ConnectInfo->CtrlDispatcher;
+    ProcessData->PropDispatcher = ConnectInfo->ConsoleStartInfo.PropDispatcher;
+    ProcessData->CtrlDispatcher = ConnectInfo->ConsoleStartInfo.CtrlDispatcher;
 
     return STATUS_SUCCESS;
 }