Author: ion Date: Fri Aug 30 17:14:41 2013 New Revision: 59904
URL: http://svn.reactos.org/svn/reactos?rev=59904&view=rev Log: [CONSRV]: Reorganize/rename/add some fields to CONSRV_API_CONNECTINFO, partially based on an MSDN page, and a little bit of RE, which makes it closer to the Windows structure. No behavioral change should have happened as a result of these changes.
Modified: trunk/reactos/dll/win32/kernel32/client/console/init.c trunk/reactos/include/reactos/subsys/win/conmsg.h trunk/reactos/win32ss/user/winsrv/consrv/console.c trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c trunk/reactos/win32ss/user/winsrv/consrv/init.c
Modified: trunk/reactos/dll/win32/kernel32/client/console/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/c... ============================================================================== --- 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] Fri Aug 30 17:14:41 2013 @@ -121,26 +121,26 @@ 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 @@ { 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 @@ 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 @@ /* 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 @@ /* 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 @@
/* 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 @@ 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))
Modified: trunk/reactos/include/reactos/subsys/win/conmsg.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win/... ============================================================================== --- trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] Fri Aug 30 17:14:41 2013 @@ -110,38 +110,84 @@ ConsolepMaxApiNumber } CONSRV_API_NUMBER, *PCONSRV_API_NUMBER;
- +// +// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb773359(v=vs.85).as... +// +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. - + HANDLE ConsoleHandle; + HANDLE InputWaitHandle; + HANDLE InputHandle; + HANDLE OutputHandle; + HANDLE ErrorHandle; + HANDLE Event1; + HANDLE Event2; /* Adapted from CONSOLE_ALLOCCONSOLE */ CONSOLE_START_INFO ConsoleStartInfo; - - HANDLE ConsoleHandle; - HANDLE InputHandle; - HANDLE OutputHandle; - HANDLE ErrorHandle; - HANDLE InputWaitHandle; - LPTHREAD_START_ROUTINE CtrlDispatcher; - LPTHREAD_START_ROUTINE PropDispatcher; } CONSRV_API_CONNECTINFO, *PCONSRV_API_CONNECTINFO;
+//C_ASSERT(sizeof(CONSRV_API_CONNECTINFO) == 0x638);
typedef struct {
Modified: trunk/reactos/win32ss/user/winsrv/consrv/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/... ============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] Fri Aug 30 17:14:41 2013 @@ -249,17 +249,15 @@ */ 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; } }
Modified: trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/... ============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c [iso-8859-1] Fri Aug 30 17:14:41 2013 @@ -2279,12 +2279,13 @@ */ 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 @@
/* 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);
Modified: trunk/reactos/win32ss/user/winsrv/consrv/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/... ============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/init.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/init.c [iso-8859-1] Fri Aug 30 17:14:41 2013 @@ -413,7 +413,7 @@ }
/* 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 @@ 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; }