[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 23 Oct 2012 22:31:36 +0000 (22:31 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 23 Oct 2012 22:31:36 +0000 (22:31 +0000)
- Add consrv to compilation. It compiles now \o/
- Convert the used console-csrss structures to the new ones.

[CSR]
- Continue to move some structures, and temporary activate a symbol.

[WIN32CSR]
- Clean a header.

svn path=/branches/ros-csrss/; revision=57602

20 files changed:
include/reactos/subsys/csr/csrmsg.h
include/reactos/subsys/win/conmsg.h
subsystems/win32/csrsrv/srv.h
win32ss/CMakeLists.txt
win32ss/user/consrv/CMakeLists.txt
win32ss/user/consrv/alias.c
win32ss/user/consrv/coninput.c
win32ss/user/consrv/conio.h
win32ss/user/consrv/conoutput.c
win32ss/user/consrv/console.c
win32ss/user/consrv/consrv.h
win32ss/user/consrv/guiconsole.c
win32ss/user/consrv/guiconsole.h
win32ss/user/consrv/handle.c
win32ss/user/consrv/init.c
win32ss/user/consrv/lineinput.c
win32ss/user/consrv/resource.h [new file with mode: 0644]
win32ss/user/consrv/tuiconsole.c
win32ss/user/consrv/tuiconsole.h
win32ss/user/win32csr/win32csr.h

index 8fd5748..eae1060 100644 (file)
@@ -122,11 +122,6 @@ typedef struct _CSR_API_MESSAGE
                 CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest;
                 CSRSS_EXIT_REACTOS ExitReactosRequest;
 
-                CSRSS_CLOSE_HANDLE CloseHandleRequest;
-                CSRSS_VERIFY_HANDLE VerifyHandleRequest;
-                CSRSS_DUPLICATE_HANDLE DuplicateHandleRequest;
-                CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle;
-
                 CSRSS_CREATE_DESKTOP CreateDesktopRequest;
                 CSRSS_SHOW_DESKTOP ShowDesktopRequest;
                 CSRSS_HIDE_DESKTOP HideDesktopRequest;
index 0eaded5..b0a16e1 100644 (file)
@@ -4,9 +4,6 @@
 
 #pragma once
 
-// Remove it.
-#include <drivers/blue/ntddblue.h>
-
 #define CONSRV_SERVERDLL_INDEX      2
 #define CONSRV_FIRST_API_NUMBER     512
 
@@ -47,7 +44,7 @@ typedef enum _CONSRV_API_NUMBER
     ConsolepReadConsole,
     ConsolepWriteConsole,
     ConsolepDuplicateHandle,
-    // ConsolepGetHandleInformation,
+    /**/ ConsolepGetHandleInformation /**/,
     // ConsolepSetHandleInformation,
     ConsolepCloseHandle,
     ConsolepVerifyIoHandle,
@@ -397,7 +394,7 @@ typedef struct
     DWORD BytesWritten;
     DWORD AliasBufferLength;
     LPWSTR AliasBuffer;
-} CSRSS_GET_ALL_CONSOLE_ALIASES, *PCSRSS_GET_ALL_CONSOLE_ALIAS;
+} CSRSS_GET_ALL_CONSOLE_ALIASES, *PCSRSS_GET_ALL_CONSOLE_ALIASES;
 
 typedef struct
 {
@@ -472,7 +469,6 @@ typedef struct
 } CSRSS_GET_HISTORY_INFO, *PCSRSS_GET_HISTORY_INFO,
   CSRSS_SET_HISTORY_INFO, *PCSRSS_SET_HISTORY_INFO;;
 
-  
 typedef struct
 {
     UINT CodePage;
@@ -533,6 +529,10 @@ typedef struct _CONSOLE_API_MESSAGE
         CSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest;
         CSRSS_GET_INPUT_HANDLE GetInputHandleRequest;
         CSRSS_GET_OUTPUT_HANDLE GetOutputHandleRequest;
+        CSRSS_CLOSE_HANDLE CloseHandleRequest;
+        CSRSS_VERIFY_HANDLE VerifyHandleRequest;
+        CSRSS_DUPLICATE_HANDLE DuplicateHandleRequest;
+        CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle;
         CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest;
         CSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest;
         CSRSS_SET_CONSOLE_ICON SetConsoleIconRequest;
index f74588c..e6ed810 100644 (file)
@@ -19,9 +19,8 @@
 #include <sm/helper.h>
 #include <sm/smmsg.h>
 
-/* Internal CSRSS Headers */
+/* Internal CSRSS Header */
 #include "include/api.h"
-#include "include/csrplugin.h"
 
 /* Defines */
 #define SM_REG_KEY \
index 0cbe6b1..ef2042f 100644 (file)
@@ -12,6 +12,7 @@ endif()
 
 add_subdirectory(gdi/gdi32)
 add_subdirectory(reactx)
+add_subdirectory(user/consrv)
 add_subdirectory(user/user32)
 add_subdirectory(user/win32csr)
 
index 6443b94..06d5fa6 100644 (file)
@@ -1,6 +1,7 @@
 
 include_directories(
     ${REACTOS_SOURCE_DIR}/include/reactos/subsys
+    ${REACTOS_SOURCE_DIR}/win32ss/include
     ${REACTOS_SOURCE_DIR}/dll/cpl/console)
 
 spec2def(consrv.dll consrv.spec)
@@ -21,11 +22,12 @@ list(APPEND SOURCE
 
 add_library(consrv SHARED ${SOURCE})
 
-target_link_libraries(consrv ${PSEH_LIB})
+target_link_libraries(consrv win32ksys ${PSEH_LIB}) # win32ksys because of NtUser...()
 
-set_module_type(consrv nativedll) # win32dll
+set_module_type(consrv win32dll)
 
-add_importlibs(consrv ntdll csrsrv)
+add_importlibs(consrv psapi msvcrt kernel32 ntdll csrsrv)
+add_delay_importlibs(consrv user32 gdi32 advapi32)
 
 add_dependencies(consrv bugcodes)
 add_cd_file(TARGET consrv DESTINATION reactos/system32 FOR all)
index e00439b..ec4e3ed 100644 (file)
@@ -1,20 +1,21 @@
-/* $Id: init.c 31400 2007-12-22 17:18:32Z fireball $
+/*
  * PROJECT:     ReactOS CSRSS
  * LICENSE:     GPL - See COPYING in the top level directory
  * FILE:        subsystems/win32/csrss/api/alias.c
  * PURPOSE:     CSRSS alias support functions
  * COPYRIGHT:   Christoph Wittich
  *              Johannes Anderwald
- *
  */
 
-
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "conio.h"
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
+
 typedef struct tagALIAS_ENTRY
 {
     LPCWSTR lpSource;
@@ -22,7 +23,6 @@ typedef struct tagALIAS_ENTRY
     struct tagALIAS_ENTRY * Next;
 } ALIAS_ENTRY, *PALIAS_ENTRY;
 
-
 typedef struct tagALIAS_HEADER
 {
     LPCWSTR lpExeName;
@@ -31,6 +31,7 @@ typedef struct tagALIAS_HEADER
 
 } ALIAS_HEADER, *PALIAS_HEADER;
 
+
 static
 PALIAS_HEADER
 IntFindAliasHeader(PALIAS_HEADER RootHeader, LPCWSTR lpExeName)
@@ -279,6 +280,7 @@ IntDeleteAllAliases(PALIAS_HEADER RootHeader)
 
 CSR_API(SrvAddConsoleAlias)
 {
+    PCSRSS_ADD_CONSOLE_ALIAS AddConsoleAlias = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AddConsoleAlias;
     PCSRSS_CONSOLE Console;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
@@ -288,12 +290,12 @@ CSR_API(SrvAddConsoleAlias)
     //ULONG TotalLength;
     //WCHAR * Ptr;
 
-    //TotalLength = ApiMessage->Data.AddConsoleAlias.SourceLength + ApiMessage->Data.AddConsoleAlias.ExeLength + ApiMessage->Data.AddConsoleAlias.TargetLength;
+    //TotalLength = AddConsoleAlias->SourceLength + AddConsoleAlias->ExeLength + AddConsoleAlias->TargetLength;
     //Ptr = (WCHAR*)((ULONG_PTR)ApiMessage + sizeof(CSR_API_MESSAGE));
 
     lpSource = (WCHAR*)((ULONG_PTR)ApiMessage + sizeof(CSR_API_MESSAGE));
-    lpExeName = (WCHAR*)((ULONG_PTR)ApiMessage + sizeof(CSR_API_MESSAGE) + ApiMessage->Data.AddConsoleAlias.SourceLength * sizeof(WCHAR));
-    lpTarget = (ApiMessage->Data.AddConsoleAlias.TargetLength != 0 ? lpExeName + ApiMessage->Data.AddConsoleAlias.ExeLength : NULL);
+    lpExeName = (WCHAR*)((ULONG_PTR)ApiMessage + sizeof(CSR_API_MESSAGE) + AddConsoleAlias->SourceLength * sizeof(WCHAR));
+    lpTarget = (AddConsoleAlias->TargetLength != 0 ? lpExeName + AddConsoleAlias->ExeLength : NULL);
 
     DPRINT("SrvAddConsoleAlias entered ApiMessage %p lpSource %p lpExeName %p lpTarget %p\n", ApiMessage, lpSource, lpExeName, lpTarget);
 
@@ -351,6 +353,7 @@ CSR_API(SrvAddConsoleAlias)
 
 CSR_API(SrvGetConsoleAlias)
 {
+    PCSRSS_GET_CONSOLE_ALIAS GetConsoleAlias = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleAlias;
     PCSRSS_CONSOLE Console;
     PALIAS_HEADER Header;
     PALIAS_ENTRY Entry;
@@ -360,15 +363,15 @@ CSR_API(SrvGetConsoleAlias)
     WCHAR * lpTarget;
 
     lpSource = (LPWSTR)((ULONG_PTR)ApiMessage + sizeof(CSR_API_MESSAGE));
-    lpExeName = lpSource + ApiMessage->Data.GetConsoleAlias.SourceLength;
-    lpTarget = ApiMessage->Data.GetConsoleAlias.TargetBuffer;
+    lpExeName = lpSource + GetConsoleAlias->SourceLength;
+    lpTarget = GetConsoleAlias->TargetBuffer;
 
 
     DPRINT("SrvGetConsoleAlias entered lpExeName %p lpSource %p TargetBuffer %p TargetBufferLength %u\n",
-           lpExeName, lpSource, lpTarget, ApiMessage->Data.GetConsoleAlias.TargetBufferLength);
+           lpExeName, lpSource, lpTarget, GetConsoleAlias->TargetBufferLength);
 
-    if (ApiMessage->Data.GetConsoleAlias.ExeLength == 0 || lpTarget == NULL ||
-            ApiMessage->Data.GetConsoleAlias.TargetBufferLength == 0 || ApiMessage->Data.GetConsoleAlias.SourceLength == 0)
+    if (GetConsoleAlias->ExeLength == 0 || lpTarget == NULL ||
+            GetConsoleAlias->TargetBufferLength == 0 || GetConsoleAlias->SourceLength == 0)
     {
         return STATUS_INVALID_PARAMETER;
     }
@@ -394,32 +397,33 @@ CSR_API(SrvGetConsoleAlias)
     }
 
     Length = (wcslen(Entry->lpTarget)+1) * sizeof(WCHAR);
-    if (Length > ApiMessage->Data.GetConsoleAlias.TargetBufferLength)
+    if (Length > GetConsoleAlias->TargetBufferLength)
     {
         ConioUnlockConsole(Console);
         return STATUS_BUFFER_TOO_SMALL;
     }
 
     if (!Win32CsrValidateBuffer(CsrGetClientThread()->Process, lpTarget,
-                                ApiMessage->Data.GetConsoleAlias.TargetBufferLength, 1))
+                                GetConsoleAlias->TargetBufferLength, 1))
     {
         ConioUnlockConsole(Console);
         return STATUS_ACCESS_VIOLATION;
     }
 
     wcscpy(lpTarget, Entry->lpTarget);
-    ApiMessage->Data.GetConsoleAlias.BytesWritten = Length;
+    GetConsoleAlias->BytesWritten = Length;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvGetConsoleAliases)
 {
+    PCSRSS_GET_ALL_CONSOLE_ALIASES GetAllConsoleAlias = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllConsoleAlias;
     PCSRSS_CONSOLE Console;
     ULONG BytesWritten;
     PALIAS_HEADER Header;
 
-    if (ApiMessage->Data.GetAllConsoleAlias.lpExeName == NULL)
+    if (GetAllConsoleAlias->lpExeName == NULL)
     {
         return STATUS_INVALID_PARAMETER;
     }
@@ -430,22 +434,22 @@ CSR_API(SrvGetConsoleAliases)
         return ApiMessage->Status;
     }
 
-    Header = IntFindAliasHeader(Console->Aliases, ApiMessage->Data.GetAllConsoleAlias.lpExeName);
+    Header = IntFindAliasHeader(Console->Aliases, GetAllConsoleAlias->lpExeName);
     if (!Header)
     {
         ConioUnlockConsole(Console);
         return STATUS_INVALID_PARAMETER;
     }
 
-    if (IntGetAllConsoleAliasesLength(Header) > ApiMessage->Data.GetAllConsoleAlias.AliasBufferLength)
+    if (IntGetAllConsoleAliasesLength(Header) > GetAllConsoleAlias->AliasBufferLength)
     {
         ConioUnlockConsole(Console);
         return STATUS_BUFFER_OVERFLOW;
     }
 
     if (!Win32CsrValidateBuffer(CsrGetClientThread()->Process,
-                                ApiMessage->Data.GetAllConsoleAlias.AliasBuffer,
-                                ApiMessage->Data.GetAllConsoleAlias.AliasBufferLength,
+                                GetAllConsoleAlias->AliasBuffer,
+                                GetAllConsoleAlias->AliasBufferLength,
                                 1))
     {
         ConioUnlockConsole(Console);
@@ -453,21 +457,22 @@ CSR_API(SrvGetConsoleAliases)
     }
 
     BytesWritten = IntGetAllConsoleAliases(Header,
-                                           ApiMessage->Data.GetAllConsoleAlias.AliasBuffer,
-                                           ApiMessage->Data.GetAllConsoleAlias.AliasBufferLength);
+                                           GetAllConsoleAlias->AliasBuffer,
+                                           GetAllConsoleAlias->AliasBufferLength);
 
-    ApiMessage->Data.GetAllConsoleAlias.BytesWritten = BytesWritten;
+    GetAllConsoleAlias->BytesWritten = BytesWritten;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvGetConsoleAliasesLength)
 {
+    PCSRSS_GET_ALL_CONSOLE_ALIASES_LENGTH GetAllConsoleAliasesLength = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetAllConsoleAliasesLength;
     PCSRSS_CONSOLE Console;
     PALIAS_HEADER Header;
     UINT Length;
 
-    if (ApiMessage->Data.GetAllConsoleAliasesLength.lpExeName == NULL)
+    if (GetAllConsoleAliasesLength->lpExeName == NULL)
     {
         return STATUS_INVALID_PARAMETER;
     }
@@ -478,7 +483,7 @@ CSR_API(SrvGetConsoleAliasesLength)
         return ApiMessage->Status;
     }
 
-    Header = IntFindAliasHeader(Console->Aliases, ApiMessage->Data.GetAllConsoleAliasesLength.lpExeName);
+    Header = IntFindAliasHeader(Console->Aliases, GetAllConsoleAliasesLength->lpExeName);
     if (!Header)
     {
         ConioUnlockConsole(Console);
@@ -486,13 +491,14 @@ CSR_API(SrvGetConsoleAliasesLength)
     }
 
     Length = IntGetAllConsoleAliasesLength(Header);
-    ApiMessage->Data.GetAllConsoleAliasesLength.Length = Length;
+    GetAllConsoleAliasesLength->Length = Length;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvGetConsoleAliasExes)
 {
+    PCSRSS_GET_CONSOLE_ALIASES_EXES GetConsoleAliasesExes = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleAliasesExes;
     PCSRSS_CONSOLE Console;
     UINT BytesWritten;
     UINT ExesLength;
@@ -507,21 +513,21 @@ CSR_API(SrvGetConsoleAliasExes)
 
     ExesLength = IntGetConsoleAliasesExesLength(Console->Aliases);
 
-    if (ExesLength > ApiMessage->Data.GetConsoleAliasesExes.Length)
+    if (ExesLength > GetConsoleAliasesExes->Length)
     {
         ConioUnlockConsole(Console);
         return STATUS_BUFFER_OVERFLOW;
     }
 
-    if (ApiMessage->Data.GetConsoleAliasesExes.ExeNames == NULL)
+    if (GetConsoleAliasesExes->ExeNames == NULL)
     {
         ConioUnlockConsole(Console);
         return STATUS_INVALID_PARAMETER;
     }
 
     if (!Win32CsrValidateBuffer(CsrGetClientThread()->Process,
-                                ApiMessage->Data.GetConsoleAliasesExes.ExeNames,
-                                ApiMessage->Data.GetConsoleAliasesExes.Length,
+                                GetConsoleAliasesExes->ExeNames,
+                                GetConsoleAliasesExes->Length,
                                 1))
     {
         ConioUnlockConsole(Console);
@@ -529,23 +535,24 @@ CSR_API(SrvGetConsoleAliasExes)
     }
 
     BytesWritten = IntGetConsoleAliasesExes(Console->Aliases,
-                                            ApiMessage->Data.GetConsoleAliasesExes.ExeNames,
-                                            ApiMessage->Data.GetConsoleAliasesExes.Length);
+                                            GetConsoleAliasesExes->ExeNames,
+                                            GetConsoleAliasesExes->Length);
 
-    ApiMessage->Data.GetConsoleAliasesExes.BytesWritten = BytesWritten;
+    GetConsoleAliasesExes->BytesWritten = BytesWritten;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvGetConsoleAliasExesLength)
 {
+    PCSRSS_GET_CONSOLE_ALIASES_EXES_LENGTH GetConsoleAliasesExesLength = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleAliasesExesLength;
     PCSRSS_CONSOLE Console;
     DPRINT("SrvGetConsoleAliasExesLength entered\n");
 
     ApiMessage->Status = ConioConsoleFromProcessData(CsrGetClientThread()->Process, &Console);
     if (NT_SUCCESS(ApiMessage->Status))
     {
-        ApiMessage->Data.GetConsoleAliasesExesLength.Length = IntGetConsoleAliasesExesLength(Console->Aliases);
+        GetConsoleAliasesExesLength->Length = IntGetConsoleAliasesExesLength(Console->Aliases);
         ConioUnlockConsole(Console);
     }
     return ApiMessage->Status;
index fa9e6e8..cbdc36d 100644 (file)
@@ -8,8 +8,11 @@
 
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "conio.h"
+#include "tuiconsole.h"
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 /* GLOBALS *******************************************************************/
@@ -24,6 +27,7 @@
 
 CSR_API(SrvReadConsole)
 {
+    PCSRSS_READ_CONSOLE ReadConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest;
     PLIST_ENTRY CurrentEntry;
     ConsoleInput *Input;
     PCHAR Buffer;
@@ -36,25 +40,25 @@ CSR_API(SrvReadConsole)
 
     DPRINT("SrvReadConsole\n");
 
-    CharSize = (ApiMessage->Data.ReadConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
+    CharSize = (ReadConsoleRequest->Unicode ? sizeof(WCHAR) : sizeof(CHAR));
 
-    nNumberOfCharsToRead = ApiMessage->Data.ReadConsoleRequest.NrCharactersToRead;
+    nNumberOfCharsToRead = ReadConsoleRequest->NrCharactersToRead;
 
-    Buffer = (PCHAR)ApiMessage->Data.ReadConsoleRequest.Buffer;
+    Buffer = (PCHAR)ReadConsoleRequest->Buffer;
     UnicodeBuffer = (PWCHAR)Buffer;
     if (!Win32CsrValidateBuffer(ProcessData, Buffer, nNumberOfCharsToRead, CharSize))
         return STATUS_ACCESS_VIOLATION;
 
-    if (ApiMessage->Data.ReadConsoleRequest.NrCharactersRead * sizeof(WCHAR) > nNumberOfCharsToRead * CharSize)
+    if (ReadConsoleRequest->NrCharactersRead * sizeof(WCHAR) > nNumberOfCharsToRead * CharSize)
         return STATUS_INVALID_PARAMETER;
 
-    Status = ConioLockConsole(ProcessData, ApiMessage->Data.ReadConsoleRequest.ConsoleHandle,
+    Status = ConioLockConsole(ProcessData, ReadConsoleRequest->ConsoleHandle,
                               &Console, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
-    ApiMessage->Data.ReadConsoleRequest.EventHandle = ProcessData->ConsoleEvent;
+    ReadConsoleRequest->EventHandle = ProcessData->ConsoleEvent;
 
     Status = STATUS_PENDING; /* we haven't read anything (yet) */
     if (Console->Mode & ENABLE_LINE_INPUT)
@@ -72,8 +76,8 @@ CSR_API(SrvReadConsole)
             Console->LineComplete = FALSE;
             Console->LineUpPressed = FALSE;
             Console->LineInsertToggle = 0;
-            Console->LineWakeupMask = ApiMessage->Data.ReadConsoleRequest.CtrlWakeupMask;
-            Console->LineSize = ApiMessage->Data.ReadConsoleRequest.NrCharactersRead;
+            Console->LineWakeupMask = ReadConsoleRequest->CtrlWakeupMask;
+            Console->LineSize = ReadConsoleRequest->NrCharactersRead;
             Console->LinePos = Console->LineSize;
             /* pre-filling the buffer is only allowed in the Unicode API,
              * so we don't need to worry about conversion */
@@ -101,7 +105,7 @@ CSR_API(SrvReadConsole)
                     && Input->InputEvent.Event.KeyEvent.bKeyDown)
             {
                 LineInputKeyDown(Console, &Input->InputEvent.Event.KeyEvent);
-                ApiMessage->Data.ReadConsoleRequest.ControlKeyState = Input->InputEvent.Event.KeyEvent.dwControlKeyState;
+                ReadConsoleRequest->ControlKeyState = Input->InputEvent.Event.KeyEvent.dwControlKeyState;
             }
             HeapFree(ConSrvHeap, 0, Input);
         }
@@ -112,7 +116,7 @@ CSR_API(SrvReadConsole)
             while (i < nNumberOfCharsToRead && Console->LinePos != Console->LineSize)
             {
                 WCHAR Char = Console->LineBuffer[Console->LinePos++];
-                if (ApiMessage->Data.ReadConsoleRequest.Unicode)
+                if (ReadConsoleRequest->Unicode)
                     UnicodeBuffer[i++] = Char;
                 else
                     ConsoleInputUnicodeCharToAnsiChar(Console, &Buffer[i++], &Char);
@@ -145,7 +149,7 @@ CSR_API(SrvReadConsole)
                     && Input->InputEvent.Event.KeyEvent.uChar.UnicodeChar != L'\0')
             {
                 WCHAR Char = Input->InputEvent.Event.KeyEvent.uChar.UnicodeChar;
-                if (ApiMessage->Data.ReadConsoleRequest.Unicode)
+                if (ReadConsoleRequest->Unicode)
                     UnicodeBuffer[i++] = Char;
                 else
                     ConsoleInputUnicodeCharToAnsiChar(Console, &Buffer[i++], &Char);
@@ -155,7 +159,7 @@ CSR_API(SrvReadConsole)
         }
     }
 done:
-    ApiMessage->Data.ReadConsoleRequest.NrCharactersRead = i;
+    ReadConsoleRequest->NrCharactersRead = i;
     ConioUnlockConsole(Console);
 
     return Status;
@@ -423,6 +427,7 @@ ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode)
 
 CSR_API(CsrReadInputEvent)
 {
+    PCSRSS_READ_INPUT ReadInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadInputRequest;
     PLIST_ENTRY CurrentEntry;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
@@ -432,9 +437,9 @@ CSR_API(CsrReadInputEvent)
 
     DPRINT("CsrReadInputEvent\n");
 
-    ApiMessage->Data.ReadInputRequest.Event = ProcessData->ConsoleEvent;
+    ReadInputRequest->Event = ProcessData->ConsoleEvent;
 
-    Status = ConioLockConsole(ProcessData, ApiMessage->Data.ReadInputRequest.ConsoleHandle, &Console, GENERIC_READ);
+    Status = ConioLockConsole(ProcessData, ReadInputRequest->ConsoleHandle, &Console, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
@@ -449,7 +454,7 @@ CSR_API(CsrReadInputEvent)
 
         if (Done)
         {
-            ApiMessage->Data.ReadInputRequest.MoreEvents = TRUE;
+            ReadInputRequest->MoreEvents = TRUE;
             break;
         }
 
@@ -457,10 +462,10 @@ CSR_API(CsrReadInputEvent)
 
         if (!Done)
         {
-            ApiMessage->Data.ReadInputRequest.Input = Input->InputEvent;
-            if (ApiMessage->Data.ReadInputRequest.Unicode == FALSE)
+            ReadInputRequest->Input = Input->InputEvent;
+            if (ReadInputRequest->Unicode == FALSE)
             {
-                ConioInputEventToAnsi(Console, &ApiMessage->Data.ReadInputRequest.Input);
+                ConioInputEventToAnsi(Console, &ReadInputRequest->Input);
             }
             Done = TRUE;
         }
@@ -485,6 +490,7 @@ CSR_API(CsrReadInputEvent)
 
 CSR_API(SrvFlushConsoleInputBuffer)
 {
+    PCSRSS_FLUSH_INPUT_BUFFER FlushInputBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FlushInputBufferRequest;
     PLIST_ENTRY CurrentEntry;
     PCSRSS_CONSOLE Console;
     ConsoleInput* Input;
@@ -493,7 +499,7 @@ CSR_API(SrvFlushConsoleInputBuffer)
     DPRINT("SrvFlushConsoleInputBuffer\n");
 
     Status = ConioLockConsole(CsrGetClientThread()->Process,
-                              ApiMessage->Data.FlushInputBufferRequest.ConsoleInput,
+                              FlushInputBufferRequest->ConsoleInput,
                               &Console,
                               GENERIC_WRITE);
     if(! NT_SUCCESS(Status))
@@ -519,13 +525,14 @@ CSR_API(SrvFlushConsoleInputBuffer)
 CSR_API(SrvGetConsoleNumberOfInputEvents)
 {
     NTSTATUS Status;
+    PCSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetNumInputEventsRequest;
     PCSRSS_CONSOLE Console;
     PLIST_ENTRY CurrentItem;
     DWORD NumEvents;
 
     DPRINT("SrvGetConsoleNumberOfInputEvents\n");
 
-    Status = ConioLockConsole(CsrGetClientThread()->Process, ApiMessage->Data.GetNumInputEventsRequest.ConsoleHandle, &Console, GENERIC_READ);
+    Status = ConioLockConsole(CsrGetClientThread()->Process, GetNumInputEventsRequest->ConsoleHandle, &Console, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
@@ -543,7 +550,7 @@ CSR_API(SrvGetConsoleNumberOfInputEvents)
 
     ConioUnlockConsole(Console);
 
-    ApiMessage->Data.GetNumInputEventsRequest.NumInputEvents = NumEvents;
+    GetNumInputEventsRequest->NumInputEvents = NumEvents;
 
     return STATUS_SUCCESS;
 }
@@ -551,6 +558,7 @@ CSR_API(SrvGetConsoleNumberOfInputEvents)
 CSR_API(SrvGetConsoleInput)
 {
     NTSTATUS Status;
+    PCSRSS_PEEK_CONSOLE_INPUT PeekConsoleInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.PeekConsoleInputRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     DWORD Length;
@@ -561,14 +569,14 @@ CSR_API(SrvGetConsoleInput)
 
     DPRINT("SrvGetConsoleInput\n");
 
-    Status = ConioLockConsole(ProcessData, ApiMessage->Data.GetNumInputEventsRequest.ConsoleHandle, &Console, GENERIC_READ);
+    Status = ConioLockConsole(ProcessData, PeekConsoleInputRequest->ConsoleHandle, &Console, GENERIC_READ);
     if(! NT_SUCCESS(Status))
     {
         return Status;
     }
 
-    InputRecord = ApiMessage->Data.PeekConsoleInputRequest.InputRecord;
-    Length = ApiMessage->Data.PeekConsoleInputRequest.Length;
+    InputRecord = PeekConsoleInputRequest->InputRecord;
+    Length = PeekConsoleInputRequest->Length;
 
     if (!Win32CsrValidateBuffer(ProcessData, InputRecord, Length, sizeof(INPUT_RECORD)))
     {
@@ -589,7 +597,7 @@ CSR_API(SrvGetConsoleInput)
             ++NumItems;
             *InputRecord = Item->InputEvent;
 
-            if (ApiMessage->Data.PeekConsoleInputRequest.Unicode == FALSE)
+            if (PeekConsoleInputRequest->Unicode == FALSE)
             {
                 ConioInputEventToAnsi(Console, InputRecord);
             }
@@ -601,13 +609,14 @@ CSR_API(SrvGetConsoleInput)
 
     ConioUnlockConsole(Console);
 
-    ApiMessage->Data.PeekConsoleInputRequest.Length = NumItems;
+    PeekConsoleInputRequest->Length = NumItems;
 
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvWriteConsoleInput)
 {
+    PCSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleInputRequest;
     PINPUT_RECORD InputRecord;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
@@ -617,14 +626,14 @@ CSR_API(SrvWriteConsoleInput)
 
     DPRINT("SrvWriteConsoleInput\n");
 
-    Status = ConioLockConsole(ProcessData, ApiMessage->Data.WriteConsoleInputRequest.ConsoleHandle, &Console, GENERIC_WRITE);
+    Status = ConioLockConsole(ProcessData, WriteConsoleInputRequest->ConsoleHandle, &Console, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
 
-    InputRecord = ApiMessage->Data.WriteConsoleInputRequest.InputRecord;
-    Length = ApiMessage->Data.WriteConsoleInputRequest.Length;
+    InputRecord = WriteConsoleInputRequest->InputRecord;
+    Length = WriteConsoleInputRequest->Length;
 
     if (!Win32CsrValidateBuffer(ProcessData, InputRecord, Length, sizeof(INPUT_RECORD)))
     {
@@ -634,7 +643,7 @@ CSR_API(SrvWriteConsoleInput)
 
     for (i = 0; i < Length && NT_SUCCESS(Status); i++)
     {
-        if (!ApiMessage->Data.WriteConsoleInputRequest.Unicode &&
+        if (!WriteConsoleInputRequest->Unicode &&
             InputRecord->EventType == KEY_EVENT)
         {
             CHAR AsciiChar = InputRecord->Event.KeyEvent.uChar.AsciiChar;
@@ -647,7 +656,7 @@ CSR_API(SrvWriteConsoleInput)
 
     ConioUnlockConsole(Console);
 
-    ApiMessage->Data.WriteConsoleInputRequest.Length = i;
+    WriteConsoleInputRequest->Length = i;
 
     return Status;
 }
index 79cc7cf..4242778 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id: conio.h 55617 2012-02-15 20:29:08Z ion $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            subsys/csrss/include/conio.h
@@ -8,8 +7,7 @@
 
 #pragma once
 
-#include "api.h"
-#include "win32csr.h"
+// #include "api.h"
 
 #define CSR_DEFAULT_CURSOR_SIZE 25
 
 
 typedef struct tagCSRSS_SCREEN_BUFFER
 {
-  Object_t Header;                 /* Object header */
-  BYTE *Buffer;                    /* pointer to screen buffer */
-  USHORT MaxX, MaxY;               /* size of the entire scrollback buffer */
-  USHORT ShowX, ShowY;             /* beginning offset for the actual display area */
-  ULONG CurrentX;                  /* Current X cursor position */
-  ULONG CurrentY;                  /* Current Y cursor position */
-  WORD DefaultAttrib;              /* default char attribute */
-  USHORT VirtualY;                 /* top row of buffer being displayed, reported to callers */
-  CONSOLE_CURSOR_INFO CursorInfo;
-  USHORT Mode;
-  LIST_ENTRY ListEntry;            /* entry in console's list of buffers */
+    Object_t Header;                 /* Object header */
+    BYTE *Buffer;                    /* pointer to screen buffer */
+    USHORT MaxX, MaxY;               /* size of the entire scrollback buffer */
+    USHORT ShowX, ShowY;             /* beginning offset for the actual display area */
+    ULONG CurrentX;                  /* Current X cursor position */
+    ULONG CurrentY;                  /* Current Y cursor position */
+    WORD DefaultAttrib;              /* default char attribute */
+    USHORT VirtualY;                 /* top row of buffer being displayed, reported to callers */
+    CONSOLE_CURSOR_INFO CursorInfo;
+    USHORT Mode;
+    LIST_ENTRY ListEntry;            /* entry in console's list of buffers */
 } CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER;
 
-typedef struct tagCSRSS_CONSOLE *PCSRSS_CONSOLE;
+typedef struct tagCSRSS_CONSOLE
+{
+    Object_t Header;                      /* Object header */
+    LONG ReferenceCount;
+    CRITICAL_SECTION Lock;
+    struct tagCSRSS_CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */
+    HANDLE ActiveEvent;
+    LIST_ENTRY InputEvents;               /* List head for input event queue */
+    PWCHAR LineBuffer;                    /* current line being input, in line buffered mode */
+    WORD LineMaxSize;                     /* maximum size of line in characters (including CR+LF) */
+    WORD LineSize;                        /* current size of line */
+    WORD LinePos;                         /* current position within line */
+    BOOLEAN LineComplete;                 /* user pressed enter, ready to send back to client */
+    BOOLEAN LineUpPressed;
+    BOOLEAN LineInsertToggle;             /* replace character over cursor instead of inserting */
+    ULONG LineWakeupMask;                 /* bitmap of which control characters will end line input */
+    LIST_ENTRY HistoryBuffers;
+    WORD HistoryBufferSize;               /* size for newly created history buffers */
+    WORD NumberOfHistoryBuffers;          /* maximum number of history buffers allowed */
+    BOOLEAN HistoryNoDup;                 /* remove old duplicate history entries */
+    LIST_ENTRY BufferList;                /* List of all screen buffers for this console */
+    PCSRSS_SCREEN_BUFFER ActiveBuffer;    /* Pointer to currently active screen buffer */
+    WORD Mode;                            /* Console mode flags */
+    UNICODE_STRING Title;                 /* Title of console */
+    DWORD HardwareState;                  /* _GDI_MANAGED, _DIRECT */
+    HWND hWindow;
+    COORD Size;
+    PVOID PrivateData;
+    UINT CodePage;
+    UINT OutputCodePage;
+    struct tagCSRSS_CONSOLE_VTBL *Vtbl;
+    LIST_ENTRY ProcessList;
+    struct tagALIAS_HEADER *Aliases;
+    CONSOLE_SELECTION_INFO Selection;
+    BYTE PauseFlags;
+    HANDLE UnpauseEvent;
+} CSRSS_CONSOLE, *PCSRSS_CONSOLE;
 
 typedef struct tagCSRSS_CONSOLE_VTBL
 {
-  VOID (WINAPI *InitScreenBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
-  VOID (WINAPI *WriteStream)(PCSRSS_CONSOLE Console, SMALL_RECT *Block, LONG CursorStartX, LONG CursorStartY,
-                              UINT ScrolledLines, CHAR *Buffer, UINT Length);
-  VOID (WINAPI *DrawRegion)(PCSRSS_CONSOLE Console, SMALL_RECT *Region);
-  BOOL (WINAPI *SetCursorInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
-  BOOL (WINAPI *SetScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer,
-                                UINT OldCursorX, UINT OldCursorY);
-  BOOL (WINAPI *UpdateScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
-  BOOL (WINAPI *ChangeTitle)(PCSRSS_CONSOLE Console);
-  VOID (WINAPI *CleanupConsole)(PCSRSS_CONSOLE Console);
-  BOOL (WINAPI *ChangeIcon)(PCSRSS_CONSOLE Console, HICON hWindowIcon);
-  NTSTATUS (WINAPI *ResizeBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size);
+    VOID (WINAPI *InitScreenBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
+    VOID (WINAPI *WriteStream)(PCSRSS_CONSOLE Console, SMALL_RECT *Block, LONG CursorStartX, LONG CursorStartY,
+                               UINT ScrolledLines, CHAR *Buffer, UINT Length);
+    VOID (WINAPI *DrawRegion)(PCSRSS_CONSOLE Console, SMALL_RECT *Region);
+    BOOL (WINAPI *SetCursorInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
+    BOOL (WINAPI *SetScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer,
+                                 UINT OldCursorX, UINT OldCursorY);
+    BOOL (WINAPI *UpdateScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
+    BOOL (WINAPI *ChangeTitle)(PCSRSS_CONSOLE Console);
+    VOID (WINAPI *CleanupConsole)(PCSRSS_CONSOLE Console);
+    BOOL (WINAPI *ChangeIcon)(PCSRSS_CONSOLE Console, HICON hWindowIcon);
+    NTSTATUS (WINAPI *ResizeBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size);
 } CSRSS_CONSOLE_VTBL, *PCSRSS_CONSOLE_VTBL;
 
-typedef struct tagCSRSS_CONSOLE
-{
-  Object_t Header;                      /* Object header */
-  LONG ReferenceCount;
-  CRITICAL_SECTION Lock;
-  PCSRSS_CONSOLE Prev, Next;            /* Next and Prev consoles in console wheel */
-  HANDLE ActiveEvent;
-  LIST_ENTRY InputEvents;               /* List head for input event queue */
-  PWCHAR LineBuffer;                    /* current line being input, in line buffered mode */
-  WORD LineMaxSize;                     /* maximum size of line in characters (including CR+LF) */
-  WORD LineSize;                        /* current size of line */
-  WORD LinePos;                         /* current position within line */
-  BOOLEAN LineComplete;                 /* user pressed enter, ready to send back to client */
-  BOOLEAN LineUpPressed;
-  BOOLEAN LineInsertToggle;             /* replace character over cursor instead of inserting */
-  ULONG LineWakeupMask;                 /* bitmap of which control characters will end line input */
-  LIST_ENTRY HistoryBuffers;
-  WORD HistoryBufferSize;               /* size for newly created history buffers */
-  WORD NumberOfHistoryBuffers;          /* maximum number of history buffers allowed */
-  BOOLEAN HistoryNoDup;                 /* remove old duplicate history entries */
-  LIST_ENTRY BufferList;                /* List of all screen buffers for this console */
-  PCSRSS_SCREEN_BUFFER ActiveBuffer;    /* Pointer to currently active screen buffer */
-  WORD Mode;                            /* Console mode flags */
-  UNICODE_STRING Title;                 /* Title of console */
-  DWORD HardwareState;                  /* _GDI_MANAGED, _DIRECT */
-  HWND hWindow;
-  COORD Size;
-  PVOID PrivateData;
-  UINT CodePage;
-  UINT OutputCodePage;
-  PCSRSS_CONSOLE_VTBL Vtbl;
-  LIST_ENTRY ProcessList;
-  struct tagALIAS_HEADER *Aliases;
-  CONSOLE_SELECTION_INFO Selection;
-  BYTE PauseFlags;
-  HANDLE UnpauseEvent;
-} CSRSS_CONSOLE;
-
 typedef struct ConsoleInput_t
 {
-  LIST_ENTRY ListEntry;
-  INPUT_RECORD InputEvent;
+    LIST_ENTRY ListEntry;
+    INPUT_RECORD InputEvent;
 } ConsoleInput;
 
 /* CONSOLE_SELECTION_INFO dwFlags values */
index 768a59b..a81e7e3 100644 (file)
@@ -8,8 +8,10 @@
 
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "conio.h"
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 /* GLOBALS *******************************************************************/
@@ -357,25 +359,26 @@ ConioMoveRegion(PCSRSS_SCREEN_BUFFER ScreenBuffer,
 CSR_API(SrvWriteConsole)
 {
     NTSTATUS Status;
+    PCSRSS_WRITE_CONSOLE WriteConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleRequest;
     PCHAR Buffer;
     PCSRSS_SCREEN_BUFFER Buff;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     DWORD Written = 0;
     ULONG Length;
-    ULONG CharSize = (ApiMessage->Data.WriteConsoleRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
+    ULONG CharSize = (WriteConsoleRequest->Unicode ? sizeof(WCHAR) : sizeof(CHAR));
 
     DPRINT("SrvWriteConsole\n");
 
     if (ApiMessage->Header.u1.s1.TotalLength
             < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE)
-            + (ApiMessage->Data.WriteConsoleRequest.NrCharactersToWrite * CharSize))
+            + (WriteConsoleRequest->NrCharactersToWrite * CharSize))
     {
         DPRINT1("Invalid ApiMessage size\n");
         return STATUS_INVALID_PARAMETER;
     }
 
-    Status = ConioLockScreenBuffer(ProcessData, ApiMessage->Data.WriteConsoleRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(ProcessData, WriteConsoleRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
@@ -385,24 +388,24 @@ CSR_API(SrvWriteConsole)
     if (Console->UnpauseEvent)
     {
         Status = NtDuplicateObject(GetCurrentProcess(), Console->UnpauseEvent,
-                                   ProcessData->ProcessHandle, &ApiMessage->Data.WriteConsoleRequest.UnpauseEvent,
+                                   ProcessData->ProcessHandle, &WriteConsoleRequest->UnpauseEvent,
                                    SYNCHRONIZE, 0, 0);
         ConioUnlockScreenBuffer(Buff);
         return NT_SUCCESS(Status) ? STATUS_PENDING : Status;
     }
 
-    if(ApiMessage->Data.WriteConsoleRequest.Unicode)
+    if(WriteConsoleRequest->Unicode)
     {
         Length = WideCharToMultiByte(Console->OutputCodePage, 0,
-                                     (PWCHAR)ApiMessage->Data.WriteConsoleRequest.Buffer,
-                                     ApiMessage->Data.WriteConsoleRequest.NrCharactersToWrite,
+                                     (PWCHAR)WriteConsoleRequest->Buffer,
+                                     WriteConsoleRequest->NrCharactersToWrite,
                                      NULL, 0, NULL, NULL);
         Buffer = RtlAllocateHeap(GetProcessHeap(), 0, Length);
         if (Buffer)
         {
             WideCharToMultiByte(Console->OutputCodePage, 0,
-                                (PWCHAR)ApiMessage->Data.WriteConsoleRequest.Buffer,
-                                ApiMessage->Data.WriteConsoleRequest.NrCharactersToWrite,
+                                (PWCHAR)WriteConsoleRequest->Buffer,
+                                WriteConsoleRequest->NrCharactersToWrite,
                                 Buffer, Length, NULL, NULL);
         }
         else
@@ -412,7 +415,7 @@ CSR_API(SrvWriteConsole)
     }
     else
     {
-        Buffer = (PCHAR)ApiMessage->Data.WriteConsoleRequest.Buffer;
+        Buffer = (PCHAR)WriteConsoleRequest->Buffer;
     }
 
     if (Buffer)
@@ -420,20 +423,20 @@ CSR_API(SrvWriteConsole)
         if (NT_SUCCESS(Status))
         {
             Status = ConioWriteConsole(Console, Buff, Buffer,
-                                       ApiMessage->Data.WriteConsoleRequest.NrCharactersToWrite, TRUE);
+                                       WriteConsoleRequest->NrCharactersToWrite, TRUE);
             if (NT_SUCCESS(Status))
             {
-                Written = ApiMessage->Data.WriteConsoleRequest.NrCharactersToWrite;
+                Written = WriteConsoleRequest->NrCharactersToWrite;
             }
         }
-        if (ApiMessage->Data.WriteConsoleRequest.Unicode)
+        if (WriteConsoleRequest->Unicode)
         {
             RtlFreeHeap(GetProcessHeap(), 0, Buffer);
         }
     }
     ConioUnlockScreenBuffer(Buff);
 
-    ApiMessage->Data.WriteConsoleRequest.NrCharactersWritten = Written;
+    WriteConsoleRequest->NrCharactersWritten = Written;
 
     return Status;
 }
@@ -472,19 +475,20 @@ ConioDrawConsole(PCSRSS_CONSOLE Console)
 CSR_API(SrvGetConsoleScreenBufferInfo) // CsrGetScreenBufferInfo
 {
     NTSTATUS Status;
+    PCSRSS_SCREEN_BUFFER_INFO ScreenBufferInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScreenBufferInfoRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     PCONSOLE_SCREEN_BUFFER_INFO pInfo;
 
     DPRINT("SrvGetConsoleScreenBufferInfo\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.ScreenBufferInfoRequest.ConsoleHandle, &Buff, GENERIC_READ);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ScreenBufferInfoRequest->ConsoleHandle, &Buff, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
-    pInfo = &ApiMessage->Data.ScreenBufferInfoRequest.Info;
+    pInfo = &ScreenBufferInfoRequest->Info;
     pInfo->dwSize.X = Buff->MaxX;
     pInfo->dwSize.Y = Buff->MaxY;
     pInfo->dwCursorPosition.X = Buff->CurrentX;
@@ -504,6 +508,7 @@ CSR_API(SrvGetConsoleScreenBufferInfo) // CsrGetScreenBufferInfo
 CSR_API(SrvSetConsoleCursor)
 {
     NTSTATUS Status;
+    PCSRSS_SET_CURSOR SetCursorRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     LONG OldCursorX, OldCursorY;
@@ -511,15 +516,15 @@ CSR_API(SrvSetConsoleCursor)
 
     DPRINT("SrvSetConsoleCursor\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.SetCursorRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, SetCursorRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    NewCursorX = ApiMessage->Data.SetCursorRequest.Position.X;
-    NewCursorY = ApiMessage->Data.SetCursorRequest.Position.Y;
+    NewCursorX = SetCursorRequest->Position.X;
+    NewCursorY = SetCursorRequest->Position.Y;
     if (NewCursorX < 0 || NewCursorX >= Buff->MaxX ||
             NewCursorY < 0 || NewCursorY >= Buff->MaxY)
     {
@@ -574,6 +579,7 @@ ConioComputeUpdateRect(PCSRSS_SCREEN_BUFFER Buff, SMALL_RECT *UpdateRect, COORD
 CSR_API(CsrWriteConsoleOutputChar)
 {
     NTSTATUS Status;
+    PCSRSS_WRITE_CONSOLE_OUTPUT_CHAR WriteConsoleOutputCharRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleOutputCharRequest;
     PCHAR String, tmpString = NULL;
     PBYTE Buffer;
     PCSRSS_CONSOLE Console;
@@ -583,35 +589,35 @@ CSR_API(CsrWriteConsoleOutputChar)
 
     DPRINT("CsrWriteConsoleOutputChar\n");
 
-    CharSize = (ApiMessage->Data.WriteConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
+    CharSize = (WriteConsoleOutputCharRequest->Unicode ? sizeof(WCHAR) : sizeof(CHAR));
 
     if (ApiMessage->Header.u1.s1.TotalLength
             < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR)
-            + (ApiMessage->Data.WriteConsoleOutputCharRequest.Length * CharSize))
+            + (WriteConsoleOutputCharRequest->Length * CharSize))
     {
         DPRINT1("Invalid ApiMessage size\n");
         return STATUS_INVALID_PARAMETER;
     }
 
     Status = ConioLockScreenBuffer(CsrGetClientThread()->Process,
-                                    ApiMessage->Data.WriteConsoleOutputCharRequest.ConsoleHandle,
+                                    WriteConsoleOutputCharRequest->ConsoleHandle,
                                     &Buff,
                                     GENERIC_WRITE);
     if (NT_SUCCESS(Status))
     {
         Console = Buff->Header.Console;
-        if(ApiMessage->Data.WriteConsoleOutputCharRequest.Unicode)
+        if(WriteConsoleOutputCharRequest->Unicode)
         {
             Length = WideCharToMultiByte(Console->OutputCodePage, 0,
-                                         (PWCHAR)ApiMessage->Data.WriteConsoleOutputCharRequest.String,
-                                         ApiMessage->Data.WriteConsoleOutputCharRequest.Length,
+                                         (PWCHAR)WriteConsoleOutputCharRequest->String,
+                                         WriteConsoleOutputCharRequest->Length,
                                          NULL, 0, NULL, NULL);
             tmpString = String = RtlAllocateHeap(GetProcessHeap(), 0, Length);
             if (String)
             {
                 WideCharToMultiByte(Console->OutputCodePage, 0,
-                                    (PWCHAR)ApiMessage->Data.WriteConsoleOutputCharRequest.String,
-                                    ApiMessage->Data.WriteConsoleOutputCharRequest.Length,
+                                    (PWCHAR)WriteConsoleOutputCharRequest->String,
+                                    WriteConsoleOutputCharRequest->Length,
                                     String, Length, NULL, NULL);
             }
             else
@@ -621,16 +627,16 @@ CSR_API(CsrWriteConsoleOutputChar)
         }
         else
         {
-            String = (PCHAR)ApiMessage->Data.WriteConsoleOutputCharRequest.String;
+            String = (PCHAR)WriteConsoleOutputCharRequest->String;
         }
 
         if (String)
         {
             if (NT_SUCCESS(Status))
             {
-                X = ApiMessage->Data.WriteConsoleOutputCharRequest.Coord.X;
-                Y = (ApiMessage->Data.WriteConsoleOutputCharRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
-                Length = ApiMessage->Data.WriteConsoleOutputCharRequest.Length;
+                X = WriteConsoleOutputCharRequest->Coord.X;
+                Y = (WriteConsoleOutputCharRequest->Coord.Y + Buff->VirtualY) % Buff->MaxY;
+                Length = WriteConsoleOutputCharRequest->Length;
                 Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X)];
                 while (Length--)
                 {
@@ -649,29 +655,30 @@ CSR_API(CsrWriteConsoleOutputChar)
                 }
                 if (Buff == Console->ActiveBuffer)
                 {
-                    ConioComputeUpdateRect(Buff, &UpdateRect, &ApiMessage->Data.WriteConsoleOutputCharRequest.Coord,
-                                           ApiMessage->Data.WriteConsoleOutputCharRequest.Length);
+                    ConioComputeUpdateRect(Buff, &UpdateRect, &WriteConsoleOutputCharRequest->Coord,
+                                           WriteConsoleOutputCharRequest->Length);
                     ConioDrawRegion(Console, &UpdateRect);
                 }
 
-                ApiMessage->Data.WriteConsoleOutputCharRequest.EndCoord.X = X;
-                ApiMessage->Data.WriteConsoleOutputCharRequest.EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
+                WriteConsoleOutputCharRequest->EndCoord.X = X;
+                WriteConsoleOutputCharRequest->EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
 
             }
-            if (ApiMessage->Data.WriteConsoleRequest.Unicode)
+            if (WriteConsoleOutputCharRequest->Unicode)
             {
                 RtlFreeHeap(GetProcessHeap(), 0, tmpString);
             }
         }
         ConioUnlockScreenBuffer(Buff);
     }
-    ApiMessage->Data.WriteConsoleOutputCharRequest.NrCharactersWritten = Written;
+    WriteConsoleOutputCharRequest->NrCharactersWritten = Written;
     return Status;
 }
 
 CSR_API(CsrFillOutputChar)
 {
     NTSTATUS Status;
+    PCSRSS_FILL_OUTPUT FillOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     DWORD X, Y, Length, Written = 0;
@@ -681,21 +688,21 @@ CSR_API(CsrFillOutputChar)
 
     DPRINT("CsrFillOutputChar\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.FillOutputRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, FillOutputRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    X = ApiMessage->Data.FillOutputRequest.Position.X;
-    Y = (ApiMessage->Data.FillOutputRequest.Position.Y + Buff->VirtualY) % Buff->MaxY;
+    X = FillOutputRequest->Position.X;
+    Y = (FillOutputRequest->Position.Y + Buff->VirtualY) % Buff->MaxY;
     Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X)];
-    if(ApiMessage->Data.FillOutputRequest.Unicode)
-        ConsoleUnicodeCharToAnsiChar(Console, &Char, &ApiMessage->Data.FillOutputRequest.Char.UnicodeChar);
+    if(FillOutputRequest->Unicode)
+        ConsoleUnicodeCharToAnsiChar(Console, &Char, &FillOutputRequest->Char.UnicodeChar);
     else
-        Char = ApiMessage->Data.FillOutputRequest.Char.AsciiChar;
-    Length = ApiMessage->Data.FillOutputRequest.Length;
+        Char = FillOutputRequest->Char.AsciiChar;
+    Length = FillOutputRequest->Length;
     while (Length--)
     {
         *Buffer = Char;
@@ -714,19 +721,20 @@ CSR_API(CsrFillOutputChar)
 
     if (Buff == Console->ActiveBuffer)
     {
-        ConioComputeUpdateRect(Buff, &UpdateRect, &ApiMessage->Data.FillOutputRequest.Position,
-                               ApiMessage->Data.FillOutputRequest.Length);
+        ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputRequest->Position,
+                               FillOutputRequest->Length);
         ConioDrawRegion(Console, &UpdateRect);
     }
 
     ConioUnlockScreenBuffer(Buff);
-    Length = ApiMessage->Data.FillOutputRequest.Length;
-    ApiMessage->Data.FillOutputRequest.NrCharactersWritten = Length;
+    Length = FillOutputRequest->Length;
+    FillOutputRequest->NrCharactersWritten = Length;
     return STATUS_SUCCESS;
 }
 
 CSR_API(CsrWriteConsoleOutputAttrib)
 {
+    PCSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB WriteConsoleOutputAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleOutputAttribRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     PUCHAR Buffer;
@@ -739,14 +747,14 @@ CSR_API(CsrWriteConsoleOutputAttrib)
 
     if (ApiMessage->Header.u1.s1.TotalLength
             < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB)
-            + ApiMessage->Data.WriteConsoleOutputAttribRequest.Length * sizeof(WORD))
+            + WriteConsoleOutputAttribRequest->Length * sizeof(WORD))
     {
         DPRINT1("Invalid ApiMessage size\n");
         return STATUS_INVALID_PARAMETER;
     }
 
     Status = ConioLockScreenBuffer(CsrGetClientThread()->Process,
-                                   ApiMessage->Data.WriteConsoleOutputAttribRequest.ConsoleHandle,
+                                   WriteConsoleOutputAttribRequest->ConsoleHandle,
                                    &Buff,
                                    GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
@@ -755,11 +763,11 @@ CSR_API(CsrWriteConsoleOutputAttrib)
     }
     Console = Buff->Header.Console;
 
-    X = ApiMessage->Data.WriteConsoleOutputAttribRequest.Coord.X;
-    Y = (ApiMessage->Data.WriteConsoleOutputAttribRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
-    Length = ApiMessage->Data.WriteConsoleOutputAttribRequest.Length;
+    X = WriteConsoleOutputAttribRequest->Coord.X;
+    Y = (WriteConsoleOutputAttribRequest->Coord.Y + Buff->VirtualY) % Buff->MaxY;
+    Length = WriteConsoleOutputAttribRequest->Length;
     Buffer = &Buff->Buffer[2 * (Y * Buff->MaxX + X) + 1];
-    Attribute = ApiMessage->Data.WriteConsoleOutputAttribRequest.Attribute;
+    Attribute = WriteConsoleOutputAttribRequest->Attribute;
     while (Length--)
     {
         *Buffer = (UCHAR)(*Attribute++);
@@ -777,13 +785,13 @@ CSR_API(CsrWriteConsoleOutputAttrib)
 
     if (Buff == Console->ActiveBuffer)
     {
-        ConioComputeUpdateRect(Buff, &UpdateRect, &ApiMessage->Data.WriteConsoleOutputAttribRequest.Coord,
-                               ApiMessage->Data.WriteConsoleOutputAttribRequest.Length);
+        ConioComputeUpdateRect(Buff, &UpdateRect, &WriteConsoleOutputAttribRequest->Coord,
+                               WriteConsoleOutputAttribRequest->Length);
         ConioDrawRegion(Console, &UpdateRect);
     }
 
-    ApiMessage->Data.WriteConsoleOutputAttribRequest.EndCoord.X = X;
-    ApiMessage->Data.WriteConsoleOutputAttribRequest.EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
+    WriteConsoleOutputAttribRequest->EndCoord.X = X;
+    WriteConsoleOutputAttribRequest->EndCoord.Y = (Y + Buff->MaxY - Buff->VirtualY) % Buff->MaxY;
 
     ConioUnlockScreenBuffer(Buff);
 
@@ -792,6 +800,7 @@ CSR_API(CsrWriteConsoleOutputAttrib)
 
 CSR_API(CsrFillOutputAttrib)
 {
+    PCSRSS_FILL_OUTPUT_ATTRIB FillOutputAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.FillOutputAttribRequest;
     PCSRSS_SCREEN_BUFFER Buff;
     PUCHAR Buffer;
     NTSTATUS Status;
@@ -802,17 +811,17 @@ CSR_API(CsrFillOutputAttrib)
 
     DPRINT("CsrFillOutputAttrib\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.FillOutputAttribRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, FillOutputAttribRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    X = ApiMessage->Data.FillOutputAttribRequest.Coord.X;
-    Y = (ApiMessage->Data.FillOutputAttribRequest.Coord.Y + Buff->VirtualY) % Buff->MaxY;
-    Length = ApiMessage->Data.FillOutputAttribRequest.Length;
-    Attr = ApiMessage->Data.FillOutputAttribRequest.Attribute;
+    X = FillOutputAttribRequest->Coord.X;
+    Y = (FillOutputAttribRequest->Coord.Y + Buff->VirtualY) % Buff->MaxY;
+    Length = FillOutputAttribRequest->Length;
+    Attr = FillOutputAttribRequest->Attribute;
     Buffer = &Buff->Buffer[(Y * Buff->MaxX * 2) + (X * 2) + 1];
     while (Length--)
     {
@@ -831,8 +840,8 @@ CSR_API(CsrFillOutputAttrib)
 
     if (Buff == Console->ActiveBuffer)
     {
-        ConioComputeUpdateRect(Buff, &UpdateRect, &ApiMessage->Data.FillOutputAttribRequest.Coord,
-                               ApiMessage->Data.FillOutputAttribRequest.Length);
+        ConioComputeUpdateRect(Buff, &UpdateRect, &FillOutputAttribRequest->Coord,
+                               FillOutputAttribRequest->Length);
         ConioDrawRegion(Console, &UpdateRect);
     }
 
@@ -853,18 +862,19 @@ ConioEffectiveCursorSize(PCSRSS_CONSOLE Console, DWORD Scale)
 
 CSR_API(SrvGetConsoleCursorInfo)
 {
-    PCSRSS_SCREEN_BUFFER Buff;
     NTSTATUS Status;
+    PCSRSS_GET_CURSOR_INFO GetCursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCursorInfoRequest;
+    PCSRSS_SCREEN_BUFFER Buff;
 
     DPRINT("SrvGetConsoleCursorInfo\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.GetCursorInfoRequest.ConsoleHandle, &Buff, GENERIC_READ);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, GetCursorInfoRequest->ConsoleHandle, &Buff, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
-    ApiMessage->Data.GetCursorInfoRequest.Info.bVisible = Buff->CursorInfo.bVisible;
-    ApiMessage->Data.GetCursorInfoRequest.Info.dwSize = Buff->CursorInfo.dwSize;
+    GetCursorInfoRequest->Info.bVisible = Buff->CursorInfo.bVisible;
+    GetCursorInfoRequest->Info.dwSize = Buff->CursorInfo.dwSize;
     ConioUnlockScreenBuffer(Buff);
 
     return STATUS_SUCCESS;
@@ -872,6 +882,7 @@ CSR_API(SrvGetConsoleCursorInfo)
 
 CSR_API(SrvSetConsoleCursorInfo)
 {
+    PCSRSS_SET_CURSOR_INFO SetCursorInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorInfoRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     DWORD Size;
@@ -880,15 +891,15 @@ CSR_API(SrvSetConsoleCursorInfo)
 
     DPRINT("SrvSetConsoleCursorInfo\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.SetCursorInfoRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, SetCursorInfoRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    Size = ApiMessage->Data.SetCursorInfoRequest.Info.dwSize;
-    Visible = ApiMessage->Data.SetCursorInfoRequest.Info.bVisible;
+    Size = SetCursorInfoRequest->Info.dwSize;
+    Visible = SetCursorInfoRequest->Info.bVisible;
     if (Size < 1)
     {
         Size = 1;
@@ -919,19 +930,20 @@ CSR_API(SrvSetConsoleCursorInfo)
 CSR_API(CsrSetTextAttrib)
 {
     NTSTATUS Status;
+    PCSRSS_SET_ATTRIB SetAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetAttribRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
 
     DPRINT("CsrSetTextAttrib\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.SetCursorRequest.ConsoleHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, SetAttribRequest->ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    Buff->DefaultAttrib = ApiMessage->Data.SetAttribRequest.Attrib;
+    Buff->DefaultAttrib = SetAttribRequest->Attrib;
     if (Buff == Console->ActiveBuffer)
     {
         if (! ConioUpdateScreenInfo(Console, Buff))
@@ -948,6 +960,7 @@ CSR_API(CsrSetTextAttrib)
 
 CSR_API(SrvCreateConsoleScreenBuffer)
 {
+    PCSRSS_CREATE_SCREEN_BUFFER CreateScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
@@ -993,11 +1006,11 @@ CSR_API(SrvCreateConsoleScreenBuffer)
         if (NT_SUCCESS(Status))
         {
             Status = Win32CsrInsertObject(ProcessData,
-                                          &ApiMessage->Data.CreateScreenBufferRequest.OutputHandle,
+                                          &CreateScreenBufferRequest->OutputHandle,
                                           &Buff->Header,
-                                          ApiMessage->Data.CreateScreenBufferRequest.Access,
-                                          ApiMessage->Data.CreateScreenBufferRequest.Inheritable,
-                                          ApiMessage->Data.CreateScreenBufferRequest.ShareMode);
+                                          CreateScreenBufferRequest->Access,
+                                          CreateScreenBufferRequest->Inheritable,
+                                          CreateScreenBufferRequest->ShareMode);
         }
     }
     else
@@ -1013,12 +1026,13 @@ CSR_API(SrvCreateConsoleScreenBuffer)
 CSR_API(SrvSetConsoleActiveScreenBuffer)
 {
     NTSTATUS Status;
+    PCSRSS_SET_SCREEN_BUFFER SetScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
 
     DPRINT("SrvSetConsoleActiveScreenBuffer\n");
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.SetScreenBufferRequest.OutputHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, SetScreenBufferRequest->OutputHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
     {
         return Status;
@@ -1048,6 +1062,7 @@ CSR_API(SrvSetConsoleActiveScreenBuffer)
 
 CSR_API(SrvWriteConsoleOutput)
 {
+    PCSRSS_WRITE_CONSOLE_OUTPUT WriteConsoleOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.WriteConsoleOutputRequest;
     SHORT i, X, Y, SizeX, SizeY;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
@@ -1064,7 +1079,7 @@ CSR_API(SrvWriteConsoleOutput)
     DPRINT("SrvWriteConsoleOutput\n");
 
     Status = ConioLockScreenBuffer(ProcessData,
-                                   ApiMessage->Data.WriteConsoleOutputRequest.ConsoleHandle,
+                                   WriteConsoleOutputRequest->ConsoleHandle,
                                    &Buff,
                                    GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
@@ -1073,16 +1088,16 @@ CSR_API(SrvWriteConsoleOutput)
     }
     Console = Buff->Header.Console;
 
-    BufferSize = ApiMessage->Data.WriteConsoleOutputRequest.BufferSize;
-    BufferCoord = ApiMessage->Data.WriteConsoleOutputRequest.BufferCoord;
-    CharInfo = ApiMessage->Data.WriteConsoleOutputRequest.CharInfo;
+    BufferSize = WriteConsoleOutputRequest->BufferSize;
+    BufferCoord = WriteConsoleOutputRequest->BufferCoord;
+    CharInfo = WriteConsoleOutputRequest->CharInfo;
     if (!Win32CsrValidateBuffer(ProcessData, CharInfo,
                                 BufferSize.X * BufferSize.Y, sizeof(CHAR_INFO)))
     {
         ConioUnlockScreenBuffer(Buff);
         return STATUS_ACCESS_VIOLATION;
     }
-    WriteRegion = ApiMessage->Data.WriteConsoleOutputRequest.WriteRegion;
+    WriteRegion = WriteConsoleOutputRequest->WriteRegion;
 
     SizeY = min(BufferSize.Y - BufferCoord.Y, ConioRectHeight(&WriteRegion));
     SizeX = min(BufferSize.X - BufferCoord.X, ConioRectWidth(&WriteRegion));
@@ -1107,7 +1122,7 @@ CSR_API(SrvWriteConsoleOutput)
         for (X = WriteRegion.Left; X <= WriteRegion.Right; X++)
         {
             CHAR AsciiChar;
-            if (ApiMessage->Data.WriteConsoleOutputRequest.Unicode)
+            if (WriteConsoleOutputRequest->Unicode)
             {
                 ConsoleUnicodeCharToAnsiChar(Console, &AsciiChar, &CurCharInfo->Char.UnicodeChar);
             }
@@ -1125,16 +1140,17 @@ CSR_API(SrvWriteConsoleOutput)
 
     ConioUnlockScreenBuffer(Buff);
 
-    ApiMessage->Data.WriteConsoleOutputRequest.WriteRegion.Right = WriteRegion.Left + SizeX - 1;
-    ApiMessage->Data.WriteConsoleOutputRequest.WriteRegion.Bottom = WriteRegion.Top + SizeY - 1;
-    ApiMessage->Data.WriteConsoleOutputRequest.WriteRegion.Left = WriteRegion.Left;
-    ApiMessage->Data.WriteConsoleOutputRequest.WriteRegion.Top = WriteRegion.Top;
+    WriteConsoleOutputRequest->WriteRegion.Right = WriteRegion.Left + SizeX - 1;
+    WriteConsoleOutputRequest->WriteRegion.Bottom = WriteRegion.Top + SizeY - 1;
+    WriteConsoleOutputRequest->WriteRegion.Left = WriteRegion.Left;
+    WriteConsoleOutputRequest->WriteRegion.Top = WriteRegion.Top;
 
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvScrollConsoleScreenBuffer)
 {
+    PCSRSS_SCROLL_CONSOLE_SCREEN_BUFFER ScrollConsoleScreenBufferRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ScrollConsoleScreenBufferRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     SMALL_RECT ScreenBuffer;
@@ -1152,10 +1168,10 @@ CSR_API(SrvScrollConsoleScreenBuffer)
 
     DPRINT("SrvScrollConsoleScreenBuffer\n");
 
-    ConsoleHandle = ApiMessage->Data.ScrollConsoleScreenBufferRequest.ConsoleHandle;
-    UseClipRectangle = ApiMessage->Data.ScrollConsoleScreenBufferRequest.UseClipRectangle;
-    DestinationOrigin = ApiMessage->Data.ScrollConsoleScreenBufferRequest.DestinationOrigin;
-    Fill = ApiMessage->Data.ScrollConsoleScreenBufferRequest.Fill;
+    ConsoleHandle = ScrollConsoleScreenBufferRequest->ConsoleHandle;
+    UseClipRectangle = ScrollConsoleScreenBufferRequest->UseClipRectangle;
+    DestinationOrigin = ScrollConsoleScreenBufferRequest->DestinationOrigin;
+    Fill = ScrollConsoleScreenBufferRequest->Fill;
 
     Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ConsoleHandle, &Buff, GENERIC_WRITE);
     if (! NT_SUCCESS(Status))
@@ -1164,7 +1180,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
     }
     Console = Buff->Header.Console;
 
-    ScrollRectangle = ApiMessage->Data.ScrollConsoleScreenBufferRequest.ScrollRectangle;
+    ScrollRectangle = ScrollConsoleScreenBufferRequest->ScrollRectangle;
 
     /* Make sure source rectangle is inside the screen buffer */
     ConioInitRect(&ScreenBuffer, 0, 0, Buff->MaxY - 1, Buff->MaxX - 1);
@@ -1186,7 +1202,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
 
     if (UseClipRectangle)
     {
-        ClipRectangle = ApiMessage->Data.ScrollConsoleScreenBufferRequest.ClipRectangle;
+        ClipRectangle = ScrollConsoleScreenBufferRequest->ClipRectangle;
         if (!ConioGetIntersection(&ClipRectangle, &ClipRectangle, &ScreenBuffer))
         {
             ConioUnlockScreenBuffer(Buff);
@@ -1204,7 +1220,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
                   DestinationOrigin.Y + ConioRectHeight(&SrcRegion) - 1,
                   DestinationOrigin.X + ConioRectWidth(&SrcRegion) - 1);
 
-    if (ApiMessage->Data.ScrollConsoleScreenBufferRequest.Unicode)
+    if (ScrollConsoleScreenBufferRequest->Unicode)
         ConsoleUnicodeCharToAnsiChar(Console, &FillChar, &Fill.Char.UnicodeChar);
     else
         FillChar = Fill.Char.AsciiChar;
@@ -1229,6 +1245,7 @@ CSR_API(SrvScrollConsoleScreenBuffer)
 CSR_API(CsrReadConsoleOutputChar)
 {
     NTSTATUS Status;
+    PCSRSS_READ_CONSOLE_OUTPUT_CHAR ReadConsoleOutputCharRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleOutputCharRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
     DWORD Xpos, Ypos;
@@ -1239,25 +1256,25 @@ CSR_API(CsrReadConsoleOutputChar)
 
     DPRINT("CsrReadConsoleOutputChar\n");
 
-    ReadBuffer = ApiMessage->Data.ReadConsoleOutputCharRequest.String;
+    ReadBuffer = ReadConsoleOutputCharRequest->String;
 
-    CharSize = (ApiMessage->Data.ReadConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR));
+    CharSize = (ReadConsoleOutputCharRequest->Unicode ? sizeof(WCHAR) : sizeof(CHAR));
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.ReadConsoleOutputCharRequest.ConsoleHandle, &Buff, GENERIC_READ);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ReadConsoleOutputCharRequest->ConsoleHandle, &Buff, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    Xpos = ApiMessage->Data.ReadConsoleOutputCharRequest.ReadCoord.X;
-    Ypos = (ApiMessage->Data.ReadConsoleOutputCharRequest.ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
+    Xpos = ReadConsoleOutputCharRequest->ReadCoord.X;
+    Ypos = (ReadConsoleOutputCharRequest->ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
 
-    for (i = 0; i < ApiMessage->Data.ReadConsoleOutputCharRequest.NumCharsToRead; ++i)
+    for (i = 0; i < ReadConsoleOutputCharRequest->NumCharsToRead; ++i)
     {
         Char = Buff->Buffer[(Xpos * 2) + (Ypos * 2 * Buff->MaxX)];
 
-        if(ApiMessage->Data.ReadConsoleOutputCharRequest.Unicode)
+        if(ReadConsoleOutputCharRequest->Unicode)
         {
             ConsoleAnsiCharToUnicodeChar(Console, (WCHAR*)ReadBuffer, &Char);
             ReadBuffer += sizeof(WCHAR);
@@ -1280,13 +1297,13 @@ CSR_API(CsrReadConsoleOutputChar)
     }
 
     *ReadBuffer = 0;
-    ApiMessage->Data.ReadConsoleOutputCharRequest.EndCoord.X = Xpos;
-    ApiMessage->Data.ReadConsoleOutputCharRequest.EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
+    ReadConsoleOutputCharRequest->EndCoord.X = Xpos;
+    ReadConsoleOutputCharRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
 
     ConioUnlockScreenBuffer(Buff);
 
-    ApiMessage->Data.ReadConsoleOutputCharRequest.CharsRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ApiMessage->Data.ReadConsoleOutputCharRequest.String) / CharSize;
-    if (ApiMessage->Data.ReadConsoleOutputCharRequest.CharsRead * CharSize + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) > sizeof(CSR_API_MESSAGE))
+    ReadConsoleOutputCharRequest->CharsRead = (DWORD)((ULONG_PTR)ReadBuffer - (ULONG_PTR)ReadConsoleOutputCharRequest->String) / CharSize;
+    if (ReadConsoleOutputCharRequest->CharsRead * CharSize + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) > sizeof(CSR_API_MESSAGE))
     {
         DPRINT1("Length won't fit in message\n");
         return STATUS_BUFFER_TOO_SMALL;
@@ -1298,6 +1315,7 @@ CSR_API(CsrReadConsoleOutputChar)
 CSR_API(CsrReadConsoleOutputAttrib)
 {
     NTSTATUS Status;
+    PCSRSS_READ_CONSOLE_OUTPUT_ATTRIB ReadConsoleOutputAttribRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleOutputAttribRequest;
     PCSRSS_SCREEN_BUFFER Buff;
     DWORD Xpos, Ypos;
     PWORD ReadBuffer;
@@ -1306,18 +1324,18 @@ CSR_API(CsrReadConsoleOutputAttrib)
 
     DPRINT("CsrReadConsoleOutputAttrib\n");
 
-    ReadBuffer = ApiMessage->Data.ReadConsoleOutputAttribRequest.Attribute;
+    ReadBuffer = ReadConsoleOutputAttribRequest->Attribute;
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.ReadConsoleOutputAttribRequest.ConsoleHandle, &Buff, GENERIC_READ);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ReadConsoleOutputAttribRequest->ConsoleHandle, &Buff, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
 
-    Xpos = ApiMessage->Data.ReadConsoleOutputAttribRequest.ReadCoord.X;
-    Ypos = (ApiMessage->Data.ReadConsoleOutputAttribRequest.ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
+    Xpos = ReadConsoleOutputAttribRequest->ReadCoord.X;
+    Ypos = (ReadConsoleOutputAttribRequest->ReadCoord.Y + Buff->VirtualY) % Buff->MaxY;
 
-    for (i = 0; i < ApiMessage->Data.ReadConsoleOutputAttribRequest.NumAttrsToRead; ++i)
+    for (i = 0; i < ReadConsoleOutputAttribRequest->NumAttrsToRead; ++i)
     {
         *ReadBuffer = Buff->Buffer[(Xpos * 2) + (Ypos * 2 * Buff->MaxX) + 1];
 
@@ -1338,13 +1356,13 @@ CSR_API(CsrReadConsoleOutputAttrib)
 
     *ReadBuffer = 0;
 
-    ApiMessage->Data.ReadConsoleOutputAttribRequest.EndCoord.X = Xpos;
-    ApiMessage->Data.ReadConsoleOutputAttribRequest.EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
+    ReadConsoleOutputAttribRequest->EndCoord.X = Xpos;
+    ReadConsoleOutputAttribRequest->EndCoord.Y = (Ypos - Buff->VirtualY + Buff->MaxY) % Buff->MaxY;
 
     ConioUnlockScreenBuffer(Buff);
 
     CurrentLength = CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB)
-                    + ApiMessage->Data.ReadConsoleOutputAttribRequest.NumAttrsToRead * sizeof(WORD);
+                    + ReadConsoleOutputAttribRequest->NumAttrsToRead * sizeof(WORD);
     if (CurrentLength > sizeof(CSR_API_MESSAGE))
     {
         DPRINT1("Length won't fit in message\n");
@@ -1356,6 +1374,7 @@ CSR_API(CsrReadConsoleOutputAttrib)
 
 CSR_API(SrvReadConsoleOutput)
 {
+    PCSRSS_READ_CONSOLE_OUTPUT ReadConsoleOutputRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleOutputRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCHAR_INFO CharInfo;
     PCHAR_INFO CurCharInfo;
@@ -1373,16 +1392,16 @@ CSR_API(SrvReadConsoleOutput)
 
     DPRINT("SrvReadConsoleOutput\n");
 
-    Status = ConioLockScreenBuffer(ProcessData, ApiMessage->Data.ReadConsoleOutputRequest.ConsoleHandle, &Buff, GENERIC_READ);
+    Status = ConioLockScreenBuffer(ProcessData, ReadConsoleOutputRequest->ConsoleHandle, &Buff, GENERIC_READ);
     if (! NT_SUCCESS(Status))
     {
         return Status;
     }
 
-    CharInfo = ApiMessage->Data.ReadConsoleOutputRequest.CharInfo;
-    ReadRegion = ApiMessage->Data.ReadConsoleOutputRequest.ReadRegion;
-    BufferSize = ApiMessage->Data.ReadConsoleOutputRequest.BufferSize;
-    BufferCoord = ApiMessage->Data.ReadConsoleOutputRequest.BufferCoord;
+    CharInfo = ReadConsoleOutputRequest->CharInfo;
+    ReadRegion = ReadConsoleOutputRequest->ReadRegion;
+    BufferSize = ReadConsoleOutputRequest->BufferSize;
+    BufferCoord = ReadConsoleOutputRequest->BufferCoord;
 
     /* FIXME: Is this correct? */
     CodePage = ProcessData->Console->OutputCodePage;
@@ -1413,7 +1432,7 @@ CSR_API(SrvReadConsoleOutput)
         Ptr = ConioCoordToPointer(Buff, ReadRegion.Left, Y);
         for (X = ReadRegion.Left; X < ReadRegion.Right; ++X)
         {
-            if (ApiMessage->Data.ReadConsoleOutputRequest.Unicode)
+            if (ReadConsoleOutputRequest->Unicode)
             {
                 MultiByteToWideChar(CodePage, 0,
                                     (PCHAR)Ptr++, 1,
@@ -1430,10 +1449,10 @@ CSR_API(SrvReadConsoleOutput)
 
     ConioUnlockScreenBuffer(Buff);
 
-    ApiMessage->Data.ReadConsoleOutputRequest.ReadRegion.Right = ReadRegion.Left + SizeX - 1;
-    ApiMessage->Data.ReadConsoleOutputRequest.ReadRegion.Bottom = ReadRegion.Top + SizeY - 1;
-    ApiMessage->Data.ReadConsoleOutputRequest.ReadRegion.Left = ReadRegion.Left;
-    ApiMessage->Data.ReadConsoleOutputRequest.ReadRegion.Top = ReadRegion.Top;
+    ReadConsoleOutputRequest->ReadRegion.Right = ReadRegion.Left + SizeX - 1;
+    ReadConsoleOutputRequest->ReadRegion.Bottom = ReadRegion.Top + SizeY - 1;
+    ReadConsoleOutputRequest->ReadRegion.Left = ReadRegion.Left;
+    ReadConsoleOutputRequest->ReadRegion.Top = ReadRegion.Top;
 
     return STATUS_SUCCESS;
 }
@@ -1441,17 +1460,18 @@ CSR_API(SrvReadConsoleOutput)
 CSR_API(SrvSetConsoleScreenBufferSize)
 {
     NTSTATUS Status;
+    PCSRSS_SET_SCREEN_BUFFER_SIZE SetScreenBufferSize = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetScreenBufferSize;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
 
-    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, ApiMessage->Data.SetScreenBufferSize.OutputHandle, &Buff, GENERIC_WRITE);
+    Status = ConioLockScreenBuffer(CsrGetClientThread()->Process, SetScreenBufferSize->OutputHandle, &Buff, GENERIC_WRITE);
     if (!NT_SUCCESS(Status))
     {
         return Status;
     }
     Console = Buff->Header.Console;
 
-    Status = ConioResizeBuffer(Console, Buff, ApiMessage->Data.SetScreenBufferSize.Size);
+    Status = ConioResizeBuffer(Console, Buff, SetScreenBufferSize->Size);
     ConioUnlockScreenBuffer(Buff);
 
     return Status;
index d522c11..15d9c4f 100644 (file)
@@ -8,12 +8,31 @@
 
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "guiconsole.h"
+#include "tuiconsole.h"
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 /* FUNCTIONS *****************************************************************/
 
+/*** Taken from win32ss/user/win32csr/desktopbg.c ***/
+BOOL FASTCALL
+DtbgIsDesktopVisible(VOID)
+{
+    HWND VisibleDesktopWindow = GetDesktopWindow(); // DESKTOPWNDPROC
+
+    if (VisibleDesktopWindow != NULL &&
+            !IsWindowVisible(VisibleDesktopWindow))
+    {
+        VisibleDesktopWindow = NULL;
+    }
+
+    return VisibleDesktopWindow != NULL;
+}
+/****************************************************/
+
 NTSTATUS FASTCALL
 ConioConsoleFromProcessData(PCSR_PROCESS ProcessData, PCSRSS_CONSOLE *Console)
 {
@@ -82,11 +101,11 @@ CsrInitConsole(PCSRSS_CONSOLE Console, int ShowCmd)
     hInst = GetModuleHandleW(L"win32csr");
     if (LoadStringW(hInst,IDS_COMMAND_PROMPT,Title,sizeof(Title)/sizeof(Title[0])))
     {
-       RtlCreateUnicodeString(&Console->Title, Title);
+        RtlCreateUnicodeString(&Console->Title, Title);
     }
     else
     {
-       RtlCreateUnicodeString(&Console->Title, L"Command Prompt");
+        RtlCreateUnicodeString(&Console->Title, L"Command Prompt");
     }
 
     Console->ReferenceCount = 0;
@@ -174,6 +193,7 @@ CsrInitConsole(PCSRSS_CONSOLE Console, int ShowCmd)
 
 CSR_API(SrvAllocConsole)
 {
+    PCSRSS_ALLOC_CONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status = STATUS_SUCCESS;
@@ -190,7 +210,7 @@ CSR_API(SrvAllocConsole)
     }
 
     /* If we don't need a console, then get out of here */
-    if (!ApiMessage->Data.AllocConsoleRequest.ConsoleNeeded)
+    if (!AllocConsoleRequest->ConsoleNeeded)
     {
         DPRINT("No console needed\n");
         RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
@@ -198,8 +218,8 @@ CSR_API(SrvAllocConsole)
     }
 
     /* If we already have one, then don't create a new one... */
-    if (!ApiMessage->Data.AllocConsoleRequest.Console ||
-            ApiMessage->Data.AllocConsoleRequest.Console != ProcessData->ParentConsole)
+    if (!AllocConsoleRequest->Console ||
+            AllocConsoleRequest->Console != ProcessData->ParentConsole)
     {
         /* Allocate a console structure */
         NewConsole = TRUE;
@@ -215,7 +235,7 @@ CSR_API(SrvAllocConsole)
         /* insert process data required for GUI initialization */
         InsertHeadList(&Console->ProcessList, &ProcessData->ConsoleLink);
         /* Initialize the Console */
-        Status = CsrInitConsole(Console, ApiMessage->Data.AllocConsoleRequest.ShowCmd);
+        Status = CsrInitConsole(Console, AllocConsoleRequest->ShowCmd);
         if (!NT_SUCCESS(Status))
         {
             DPRINT1("Console init failed\n");
@@ -227,14 +247,14 @@ CSR_API(SrvAllocConsole)
     else
     {
         /* Reuse our current console */
-        Console = ApiMessage->Data.AllocConsoleRequest.Console;
+        Console = AllocConsoleRequest->Console;
     }
 
     /* Set the Process Console */
     ProcessData->Console = Console;
 
     /* Return it to the caller */
-    ApiMessage->Data.AllocConsoleRequest.Console = Console;
+    AllocConsoleRequest->Console = Console;
 
     /* Add a reference count because the process is tied to the console */
     _InterlockedIncrement(&Console->ReferenceCount);
@@ -243,7 +263,7 @@ CSR_API(SrvAllocConsole)
     {
         /* Insert the Objects */
         Status = Win32CsrInsertObject(ProcessData,
-                                      &ApiMessage->Data.AllocConsoleRequest.InputHandle,
+                                      &AllocConsoleRequest->InputHandle,
                                       &Console->Header,
                                       GENERIC_READ | GENERIC_WRITE,
                                       TRUE,
@@ -258,7 +278,7 @@ CSR_API(SrvAllocConsole)
         }
 
         Status = Win32CsrInsertObject(ProcessData,
-                                      &ApiMessage->Data.AllocConsoleRequest.OutputHandle,
+                                      &AllocConsoleRequest->OutputHandle,
                                       &Console->ActiveBuffer->Header,
                                       GENERIC_READ | GENERIC_WRITE,
                                       TRUE,
@@ -268,7 +288,7 @@ CSR_API(SrvAllocConsole)
             DPRINT1("Failed to insert object\n");
             ConioDeleteConsole((Object_t *) Console);
             Win32CsrReleaseObject(ProcessData,
-                                  ApiMessage->Data.AllocConsoleRequest.InputHandle);
+                                  AllocConsoleRequest->InputHandle);
             ProcessData->Console = 0;
             RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
             return Status;
@@ -289,9 +309,9 @@ CSR_API(SrvAllocConsole)
         if (NewConsole || !ProcessData->bInheritHandles)
         {
             Win32CsrReleaseObject(ProcessData,
-                                  ApiMessage->Data.AllocConsoleRequest.OutputHandle);
+                                  AllocConsoleRequest->OutputHandle);
             Win32CsrReleaseObject(ProcessData,
-                                  ApiMessage->Data.AllocConsoleRequest.InputHandle);
+                                  AllocConsoleRequest->InputHandle);
         }
         ProcessData->Console = 0;
         RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
@@ -299,7 +319,7 @@ CSR_API(SrvAllocConsole)
     }
 
     /* Set the Ctrl Dispatcher */
-    ProcessData->CtrlDispatcher = ApiMessage->Data.AllocConsoleRequest.CtrlDispatcher;
+    ProcessData->CtrlDispatcher = AllocConsoleRequest->CtrlDispatcher;
     DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
 
     if (!NewConsole)
@@ -386,13 +406,14 @@ ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
 CSR_API(SrvSetConsoleMode)
 {
     NTSTATUS Status;
+    PCSRSS_SET_CONSOLE_MODE SetConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleModeRequest;
     PCSRSS_CONSOLE Console;
     PCSRSS_SCREEN_BUFFER Buff;
 
     DPRINT("SrvSetConsoleMode\n");
 
     Status = Win32CsrLockObject(CsrGetClientThread()->Process,
-                                ApiMessage->Data.SetConsoleModeRequest.ConsoleHandle,
+                                SetConsoleModeRequest->ConsoleHandle,
                                 (Object_t **) &Console, GENERIC_WRITE, 0);
     if (! NT_SUCCESS(Status))
     {
@@ -402,11 +423,11 @@ CSR_API(SrvSetConsoleMode)
     Buff = (PCSRSS_SCREEN_BUFFER)Console;
     if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
     {
-        Console->Mode = ApiMessage->Data.SetConsoleModeRequest.Mode & CONSOLE_INPUT_MODE_VALID;
+        Console->Mode = SetConsoleModeRequest->Mode & CONSOLE_INPUT_MODE_VALID;
     }
     else if (CONIO_SCREEN_BUFFER_MAGIC == Console->Header.Type)
     {
-        Buff->Mode = ApiMessage->Data.SetConsoleModeRequest.Mode & CONSOLE_OUTPUT_MODE_VALID;
+        Buff->Mode = SetConsoleModeRequest->Mode & CONSOLE_OUTPUT_MODE_VALID;
     }
     else
     {
@@ -421,12 +442,13 @@ CSR_API(SrvSetConsoleMode)
 CSR_API(SrvGetConsoleMode)
 {
     NTSTATUS Status;
+    PCSRSS_GET_CONSOLE_MODE GetConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleModeRequest;
     PCSRSS_CONSOLE Console;
-    PCSRSS_SCREEN_BUFFER Buff;   /* gee, I really wish I could use an anonymous union here */
+    PCSRSS_SCREEN_BUFFER Buff;
 
     DPRINT("SrvGetConsoleMode\n");
 
-    Status = Win32CsrLockObject(CsrGetClientThread()->Process, ApiMessage->Data.GetConsoleModeRequest.ConsoleHandle,
+    Status = Win32CsrLockObject(CsrGetClientThread()->Process, GetConsoleModeRequest->ConsoleHandle,
                                 (Object_t **) &Console, GENERIC_READ, 0);
     if (! NT_SUCCESS(Status))
     {
@@ -436,11 +458,11 @@ CSR_API(SrvGetConsoleMode)
     Buff = (PCSRSS_SCREEN_BUFFER) Console;
     if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
     {
-        ApiMessage->Data.GetConsoleModeRequest.ConsoleMode = Console->Mode;
+        GetConsoleModeRequest->ConsoleMode = Console->Mode;
     }
     else if (CONIO_SCREEN_BUFFER_MAGIC == Buff->Header.Type)
     {
-        ApiMessage->Data.GetConsoleModeRequest.ConsoleMode = Buff->Mode;
+        GetConsoleModeRequest->ConsoleMode = Buff->Mode;
     }
     else
     {
@@ -454,14 +476,15 @@ CSR_API(SrvGetConsoleMode)
 CSR_API(SrvSetConsoleTitle)
 {
     NTSTATUS Status;
+    PCSRSS_SET_TITLE SetTitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetTitleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     PWCHAR Buffer;
 
     DPRINT("SrvSetConsoleTitle\n");
 
-    if (!Win32CsrValidateBuffer(ProcessData, ApiMessage->Data.SetTitleRequest.Title,
-                                ApiMessage->Data.SetTitleRequest.Length, 1))
+    if (!Win32CsrValidateBuffer(ProcessData, SetTitleRequest->Title,
+                                SetTitleRequest->Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -469,14 +492,14 @@ CSR_API(SrvSetConsoleTitle)
     Status = ConioConsoleFromProcessData(ProcessData, &Console);
     if(NT_SUCCESS(Status))
     {
-        Buffer =  RtlAllocateHeap(RtlGetProcessHeap(), 0, ApiMessage->Data.SetTitleRequest.Length);
+        Buffer =  RtlAllocateHeap(RtlGetProcessHeap(), 0, SetTitleRequest->Length);
         if (Buffer)
         {
             /* copy title to console */
             RtlFreeUnicodeString(&Console->Title);
             Console->Title.Buffer = Buffer;
-            Console->Title.Length = Console->Title.MaximumLength = ApiMessage->Data.SetTitleRequest.Length;
-            memcpy(Console->Title.Buffer, ApiMessage->Data.SetTitleRequest.Title, Console->Title.Length);
+            Console->Title.Length = Console->Title.MaximumLength = SetTitleRequest->Length;
+            memcpy(Console->Title.Buffer, SetTitleRequest->Title, Console->Title.Length);
             if (! ConioChangeTitle(Console))
             {
                 Status = STATUS_UNSUCCESSFUL;
@@ -499,15 +522,15 @@ CSR_API(SrvSetConsoleTitle)
 CSR_API(SrvGetConsoleTitle)
 {
     NTSTATUS Status;
+    PCSRSS_GET_TITLE GetTitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetTitleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     DWORD Length;
 
     DPRINT("SrvGetConsoleTitle\n");
 
-
-    if (!Win32CsrValidateBuffer(ProcessData, ApiMessage->Data.GetTitleRequest.Title,
-                                ApiMessage->Data.GetTitleRequest.Length, 1))
+    if (!Win32CsrValidateBuffer(ProcessData, GetTitleRequest->Title,
+                                GetTitleRequest->Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -520,14 +543,14 @@ CSR_API(SrvGetConsoleTitle)
     }
 
     /* Copy title of the console to the user title buffer */
-    if (ApiMessage->Data.GetTitleRequest.Length >= sizeof(WCHAR))
+    if (GetTitleRequest->Length >= sizeof(WCHAR))
     {
-        Length = min(ApiMessage->Data.GetTitleRequest.Length - sizeof(WCHAR), Console->Title.Length);
-        memcpy(ApiMessage->Data.GetTitleRequest.Title, Console->Title.Buffer, Length);
-        ApiMessage->Data.GetTitleRequest.Title[Length / sizeof(WCHAR)] = L'\0';
+        Length = min(GetTitleRequest->Length - sizeof(WCHAR), Console->Title.Length);
+        memcpy(GetTitleRequest->Title, Console->Title.Buffer, Length);
+        GetTitleRequest->Title[Length / sizeof(WCHAR)] = L'\0';
     }
 
-    ApiMessage->Data.GetTitleRequest.Length = Console->Title.Length;
+    GetTitleRequest->Length = Console->Title.Length;
 
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
@@ -570,13 +593,14 @@ SetConsoleHardwareState(PCSRSS_CONSOLE Console, DWORD ConsoleHwState)
 
 CSR_API(SrvGetConsoleHardwareState)
 {
+    PCSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
     DPRINT("SrvGetConsoleHardwareState\n");
 
     Status = ConioLockConsole(CsrGetClientThread()->Process,
-                              ApiMessage->Data.ConsoleHardwareStateRequest.ConsoleHandle,
+                              ConsoleHardwareStateRequest->ConsoleHandle,
                               &Console,
                               GENERIC_READ);
     if (! NT_SUCCESS(Status))
@@ -585,15 +609,15 @@ CSR_API(SrvGetConsoleHardwareState)
         return Status;
     }
 
-    switch (ApiMessage->Data.ConsoleHardwareStateRequest.SetGet)
+    switch (ConsoleHardwareStateRequest->SetGet)
     {
     case CONSOLE_HARDWARE_STATE_GET:
-        ApiMessage->Data.ConsoleHardwareStateRequest.State = Console->HardwareState;
+        ConsoleHardwareStateRequest->State = Console->HardwareState;
         break;
 
     case CONSOLE_HARDWARE_STATE_SET:
         DPRINT("Setting console hardware state.\n");
-        Status = SetConsoleHardwareState(Console, ApiMessage->Data.ConsoleHardwareStateRequest.State);
+        Status = SetConsoleHardwareState(Console, ConsoleHardwareStateRequest->State);
         break;
 
     default:
@@ -608,13 +632,14 @@ CSR_API(SrvGetConsoleHardwareState)
 
 CSR_API(SrvSetConsoleHardwareState)
 {
+    PCSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
     DPRINT("SrvSetConsoleHardwareState\n");
 
     Status = ConioLockConsole(CsrGetClientThread()->Process,
-                              ApiMessage->Data.ConsoleHardwareStateRequest.ConsoleHandle,
+                              ConsoleHardwareStateRequest->ConsoleHandle,
                               &Console,
                               GENERIC_READ);
     if (! NT_SUCCESS(Status))
@@ -623,15 +648,15 @@ CSR_API(SrvSetConsoleHardwareState)
         return Status;
     }
 
-    switch (ApiMessage->Data.ConsoleHardwareStateRequest.SetGet)
+    switch (ConsoleHardwareStateRequest->SetGet)
     {
     case CONSOLE_HARDWARE_STATE_GET:
-        ApiMessage->Data.ConsoleHardwareStateRequest.State = Console->HardwareState;
+        ConsoleHardwareStateRequest->State = Console->HardwareState;
         break;
 
     case CONSOLE_HARDWARE_STATE_SET:
         DPRINT("Setting console hardware state.\n");
-        Status = SetConsoleHardwareState(Console, ApiMessage->Data.ConsoleHardwareStateRequest.State);
+        Status = SetConsoleHardwareState(Console, ConsoleHardwareStateRequest->State);
         break;
 
     default:
@@ -646,6 +671,7 @@ CSR_API(SrvSetConsoleHardwareState)
 
 CSR_API(SrvGetConsoleWindow)
 {
+    PCSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleWindowRequest;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -657,7 +683,7 @@ CSR_API(SrvGetConsoleWindow)
         return Status;
     }
 
-    ApiMessage->Data.GetConsoleWindowRequest.WindowHandle = Console->hWindow;
+    GetConsoleWindowRequest->WindowHandle = Console->hWindow;
     ConioUnlockConsole(Console);
 
     return STATUS_SUCCESS;
@@ -665,6 +691,7 @@ CSR_API(SrvGetConsoleWindow)
 
 CSR_API(SrvSetConsoleIcon)
 {
+    PCSRSS_SET_CONSOLE_ICON SetConsoleIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleIconRequest;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -676,7 +703,7 @@ CSR_API(SrvSetConsoleIcon)
         return Status;
     }
 
-    Status = (ConioChangeIcon(Console, ApiMessage->Data.SetConsoleIconRequest.WindowIcon)
+    Status = (ConioChangeIcon(Console, SetConsoleIconRequest->WindowIcon)
               ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
     ConioUnlockConsole(Console);
 
@@ -685,6 +712,7 @@ CSR_API(SrvSetConsoleIcon)
 
 CSR_API(SrvGetConsoleCP)
 {
+    PCSRSS_GET_CONSOLE_CP GetConsoleCodePage = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleCodePage;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -696,13 +724,14 @@ CSR_API(SrvGetConsoleCP)
         return Status;
     }
 
-    ApiMessage->Data.GetConsoleCodePage.CodePage = Console->CodePage;
+    GetConsoleCodePage->CodePage = Console->CodePage;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(CsrGetConsoleOutputCodePage) // TODO: Merge this function with the other one.
 {
+    PCSRSS_GET_CONSOLE_OUTPUT_CP GetConsoleOutputCodePage = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleOutputCodePage;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -714,13 +743,14 @@ CSR_API(CsrGetConsoleOutputCodePage) // TODO: Merge this function with the other
         return Status;
     }
 
-    ApiMessage->Data.GetConsoleOutputCodePage.CodePage = Console->OutputCodePage;
+    GetConsoleOutputCodePage->CodePage = Console->OutputCodePage;
     ConioUnlockConsole(Console);
     return STATUS_SUCCESS;
 }
 
 CSR_API(SrvSetConsoleCP)
 {
+    PCSRSS_SET_CONSOLE_CP SetConsoleCodePage = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleCodePage;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -732,9 +762,9 @@ CSR_API(SrvSetConsoleCP)
         return Status;
     }
 
-    if (IsValidCodePage(ApiMessage->Data.SetConsoleCodePage.CodePage))
+    if (IsValidCodePage(SetConsoleCodePage->CodePage))
     {
-        Console->CodePage = ApiMessage->Data.SetConsoleCodePage.CodePage;
+        Console->CodePage = SetConsoleCodePage->CodePage;
         ConioUnlockConsole(Console);
         return STATUS_SUCCESS;
     }
@@ -745,6 +775,7 @@ CSR_API(SrvSetConsoleCP)
 
 CSR_API(CsrSetConsoleOutputCodePage) // TODO: Merge this function with the other one.
 {
+    PCSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleOutputCodePage;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
 
@@ -756,9 +787,9 @@ CSR_API(CsrSetConsoleOutputCodePage) // TODO: Merge this function with the other
         return Status;
     }
 
-    if (IsValidCodePage(ApiMessage->Data.SetConsoleOutputCodePage.CodePage))
+    if (IsValidCodePage(SetConsoleOutputCodePage->CodePage))
     {
-        Console->OutputCodePage = ApiMessage->Data.SetConsoleOutputCodePage.CodePage;
+        Console->OutputCodePage = SetConsoleOutputCodePage->CodePage;
         ConioUnlockConsole(Console);
         return STATUS_SUCCESS;
     }
@@ -808,6 +839,7 @@ CSR_API(SrvGetConsoleProcessList)
 
 CSR_API(SrvGenerateConsoleCtrlEvent)
 {
+    PCSRSS_GENERATE_CTRL_EVENT GenerateCtrlEvent = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEvent;
     PCSRSS_CONSOLE Console;
     PCSR_PROCESS current;
     PLIST_ENTRY current_entry;
@@ -820,7 +852,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
         return Status;
     }
 
-    Group = ApiMessage->Data.GenerateCtrlEvent.ProcessGroup;
+    Group = GenerateCtrlEvent->ProcessGroup;
     Status = STATUS_INVALID_PARAMETER;
     for (current_entry = Console->ProcessList.Flink;
             current_entry != &Console->ProcessList;
@@ -829,7 +861,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
         current = CONTAINING_RECORD(current_entry, CSR_PROCESS, ConsoleLink);
         if (Group == 0 || current->ProcessGroupId == Group)
         {
-            ConioConsoleCtrlEvent(ApiMessage->Data.GenerateCtrlEvent.Event, current);
+            ConioConsoleCtrlEvent(GenerateCtrlEvent->Event, current);
             Status = STATUS_SUCCESS;
         }
     }
@@ -842,14 +874,15 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
 CSR_API(SrvGetConsoleSelectionInfo)
 {
     NTSTATUS Status;
+    PCSRSS_GET_CONSOLE_SELECTION_INFO GetConsoleSelectionInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleSelectionInfo;
     PCSRSS_CONSOLE Console;
 
     Status = ConioConsoleFromProcessData(CsrGetClientThread()->Process, &Console);
     if (NT_SUCCESS(Status))
     {
-        memset(&ApiMessage->Data.GetConsoleSelectionInfo.Info, 0, sizeof(CONSOLE_SELECTION_INFO));
+        memset(&GetConsoleSelectionInfo->Info, 0, sizeof(CONSOLE_SELECTION_INFO));
         if (Console->Selection.dwFlags != 0)
-            ApiMessage->Data.GetConsoleSelectionInfo.Info = Console->Selection;
+            GetConsoleSelectionInfo->Info = Console->Selection;
         ConioUnlockConsole(Console);
     }
     return Status;
index e49fd6a..b53d8f0 100644 (file)
 #include <win/conmsg.h>
 // #include <win/base.h>
 
-#include "guiconsole.h"
-#include "tuiconsole.h"
+//#include "guiconsole.h"
+//#include "tuiconsole.h"
+
+#include "resource.h"
 
 /* Shared header with console.dll */
 #include "console.h"
 
 extern HANDLE ConSrvHeap;
-extern HANDLE BaseSrvSharedHeap;
-extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
+// extern HANDLE BaseSrvSharedHeap;
+// extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
 
+typedef struct Object_tt
+{
+    LONG Type;
+    struct tagCSRSS_CONSOLE *Console;
+    LONG AccessRead, AccessWrite;
+    LONG ExclusiveRead, ExclusiveWrite;
+    LONG HandleCount;
+} Object_t;
 
-/* console.c */
-CSR_API(SrvAllocConsole);
-CSR_API(SrvFreeConsole);
-CSR_API(SrvSetConsoleMode);
-CSR_API(SrvGetConsoleMode);
-CSR_API(SrvSetConsoleTitle);
-CSR_API(SrvGetConsoleTitle);
-CSR_API(SrvGetConsoleHardwareState);
-CSR_API(SrvSetConsoleHardwareState);
-CSR_API(SrvGetConsoleWindow);
-CSR_API(SrvSetConsoleIcon);
-CSR_API(SrvGetConsoleCP);
-CSR_API(SrvSetConsoleCP);
-CSR_API(CsrGetConsoleOutputCodePage);
-CSR_API(CsrSetConsoleOutputCodePage);
-CSR_API(SrvGetConsoleProcessList);
-CSR_API(SrvGenerateConsoleCtrlEvent);
-CSR_API(SrvGetConsoleSelectionInfo);
+
+/* alias.c */
+CSR_API(SrvAddConsoleAlias);
+CSR_API(SrvGetConsoleAlias);
+CSR_API(SrvGetConsoleAliases);
+CSR_API(SrvGetConsoleAliasesLength);
+CSR_API(SrvGetConsoleAliasExes);
+CSR_API(SrvGetConsoleAliasExesLength);
 
 /* coninput.c */
 CSR_API(SrvReadConsole);
@@ -75,13 +75,49 @@ CSR_API(CsrReadConsoleOutputAttrib);
 CSR_API(SrvReadConsoleOutput);
 CSR_API(SrvSetConsoleScreenBufferSize);
 
-/* alias.c */
-CSR_API(SrvAddConsoleAlias);
-CSR_API(SrvGetConsoleAlias);
-CSR_API(SrvGetConsoleAliases);
-CSR_API(SrvGetConsoleAliasesLength);
-CSR_API(SrvGetConsoleAliasExes);
-CSR_API(SrvGetConsoleAliasExesLength);
+/* console.c */
+CSR_API(SrvAllocConsole);
+CSR_API(SrvFreeConsole);
+CSR_API(SrvSetConsoleMode);
+CSR_API(SrvGetConsoleMode);
+CSR_API(SrvSetConsoleTitle);
+CSR_API(SrvGetConsoleTitle);
+CSR_API(SrvGetConsoleHardwareState);
+CSR_API(SrvSetConsoleHardwareState);
+CSR_API(SrvGetConsoleWindow);
+CSR_API(SrvSetConsoleIcon);
+CSR_API(SrvGetConsoleCP);
+CSR_API(SrvSetConsoleCP);
+CSR_API(CsrGetConsoleOutputCodePage);
+CSR_API(CsrSetConsoleOutputCodePage);
+CSR_API(SrvGetConsoleProcessList);
+CSR_API(SrvGenerateConsoleCtrlEvent);
+CSR_API(SrvGetConsoleSelectionInfo);
+
+/* handle.c */
+CSR_API(CsrGetHandle);
+CSR_API(SrvCloseHandle);
+CSR_API(SrvVerifyConsoleIoHandle);
+CSR_API(SrvDuplicateHandle);
+CSR_API(CsrGetInputWaitHandle);
+
+NTSTATUS FASTCALL Win32CsrInsertObject(PCSR_PROCESS ProcessData,
+                                       PHANDLE Handle,
+                                       Object_t *Object,
+                                       DWORD Access,
+                                       BOOL Inheritable,
+                                       DWORD ShareMode);
+NTSTATUS FASTCALL Win32CsrLockObject(PCSR_PROCESS ProcessData,
+                                     HANDLE Handle,
+                                     Object_t **Object,
+                                     DWORD Access,
+                                     long Type);
+VOID FASTCALL Win32CsrUnlockObject(Object_t *Object);
+NTSTATUS FASTCALL Win32CsrReleaseObject(PCSR_PROCESS ProcessData,
+                                        HANDLE Object);
+VOID WINAPI Win32CsrReleaseConsole(PCSR_PROCESS ProcessData);
+NTSTATUS WINAPI Win32CsrDuplicateHandleTable(PCSR_PROCESS SourceProcessData,
+                                             PCSR_PROCESS TargetProcessData);
 
 /* lineinput.c */
 CSR_API(SrvGetConsoleCommandHistoryLength);
@@ -91,6 +127,12 @@ CSR_API(SrvSetConsoleNumberOfCommands);
 CSR_API(SrvGetConsoleHistory);
 CSR_API(SrvSetConsoleHistory);
 
+/* server.c */
+BOOL FASTCALL Win32CsrValidateBuffer(PCSR_PROCESS ProcessData,
+                                     PVOID Buffer,
+                                     SIZE_T NumElements,
+                                     SIZE_T ElementSize);
+
 #endif // __CONSRV_H__
 
 /* EOF */
index bc10c53..72d1cb3 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id: guiconsole.c 57326 2012-09-18 21:45:00Z akhaldi $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            win32ss/user/consrv/guiconsole.c
@@ -8,8 +7,14 @@
 
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "guiconsole.h"
+#include <psapi.h>
+
+/* Public Win32K Headers */
+#include <ntuser.h>
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 /* Not defined in any header file */
index 56e2538..285813c 100644 (file)
@@ -1,12 +1,12 @@
-/* $Id: guiconsole.h 57326 2012-09-18 21:45:00Z akhaldi $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            win32ss/user/consrv/guiconsole.h
  * PURPOSE:         Interface to GUI consoles
  */
 
-#include "api.h"
+// #include "api.h"
+#include "conio.h"
 
 #define CONGUI_MIN_WIDTH      10
 #define CONGUI_MIN_HEIGHT     10
index 703c5bb..a8ad28f 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id: handle.c 57570 2012-10-17 23:10:40Z hbelusca $
- *
+/*
  * reactos/subsys/csrss/api/handle.c
  *
  * CSRSS handle functions
@@ -9,11 +8,22 @@
 
 /* INCLUDES ******************************************************************/
 
-#include <w32csr.h>
+#include "consrv.h"
+#include "conio.h"
 
 #define NDEBUG
 #include <debug.h>
 
+
+typedef struct _CSRSS_HANDLE
+{
+    Object_t *Object;
+    DWORD Access;
+    BOOL Inheritable;
+    DWORD ShareMode;
+} CSRSS_HANDLE, *PCSRSS_HANDLE;
+
+
 /* FUNCTIONS *****************************************************************/
 
 static
@@ -253,21 +263,22 @@ Win32CsrDuplicateHandleTable(PCSR_PROCESS SourceProcessData,
 CSR_API(CsrGetHandle)
 {
     NTSTATUS Status = STATUS_SUCCESS;
+    PCSRSS_GET_INPUT_HANDLE GetInputHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputHandleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
 
-    ApiMessage->Data.GetInputHandleRequest.Handle = INVALID_HANDLE_VALUE;
+    GetInputHandleRequest->Handle = INVALID_HANDLE_VALUE;
 
     RtlEnterCriticalSection(&ProcessData->HandleTableLock);
     if (ProcessData->Console)
     {
-        DWORD DesiredAccess = ApiMessage->Data.GetInputHandleRequest.Access;
-        DWORD ShareMode = ApiMessage->Data.GetInputHandleRequest.ShareMode;
+        DWORD DesiredAccess = GetInputHandleRequest->Access;
+        DWORD ShareMode = GetInputHandleRequest->ShareMode;
 
         PCSRSS_CONSOLE Console = ProcessData->Console;
         Object_t *Object;
 
         EnterCriticalSection(&Console->Lock);
-        if (ApiMessage->ApiNumber == GET_OUTPUT_HANDLE)
+        if (ApiMessage->ApiNumber == ConsolepGetHandleInformation)
             Object = &Console->ActiveBuffer->Header;
         else
             Object = &Console->Header;
@@ -283,10 +294,10 @@ CSR_API(CsrGetHandle)
         else
         {
             Status = Win32CsrInsertObject(ProcessData,
-                                          &ApiMessage->Data.GetInputHandleRequest.Handle,
+                                          &GetInputHandleRequest->Handle,
                                           Object,
                                           DesiredAccess,
-                                          ApiMessage->Data.GetInputHandleRequest.Inheritable,
+                                          GetInputHandleRequest->Inheritable,
                                           ShareMode);
         }
         LeaveCriticalSection(&Console->Lock);
@@ -300,16 +311,19 @@ CSR_API(CsrGetHandle)
 
 CSR_API(SrvCloseHandle)
 {
-    return Win32CsrReleaseObject(CsrGetClientThread()->Process, ApiMessage->Data.CloseHandleRequest.Handle);
+    PCSRSS_CLOSE_HANDLE CloseHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CloseHandleRequest;
+
+    return Win32CsrReleaseObject(CsrGetClientThread()->Process, CloseHandleRequest->Handle);
 }
 
 CSR_API(SrvVerifyConsoleIoHandle)
 {
-    ULONG_PTR Index;
     NTSTATUS Status = STATUS_SUCCESS;
+    PCSRSS_VERIFY_HANDLE VerifyHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.VerifyHandleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
+    ULONG_PTR Index;
 
-    Index = (ULONG_PTR)ApiMessage->Data.VerifyHandleRequest.Handle >> 2;
+    Index = (ULONG_PTR)VerifyHandleRequest->Handle >> 2;
     RtlEnterCriticalSection(&ProcessData->HandleTableLock);
     if (Index >= ProcessData->HandleTableSize ||
         ProcessData->HandleTable[Index].Object == NULL)
@@ -327,43 +341,44 @@ CSR_API(SrvDuplicateHandle)
     ULONG_PTR Index;
     PCSRSS_HANDLE Entry;
     DWORD DesiredAccess;
+    PCSRSS_DUPLICATE_HANDLE DuplicateHandleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.DuplicateHandleRequest;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
 
-    Index = (ULONG_PTR)ApiMessage->Data.DuplicateHandleRequest.Handle >> 2;
+    Index = (ULONG_PTR)DuplicateHandleRequest->Handle >> 2;
     RtlEnterCriticalSection(&ProcessData->HandleTableLock);
     if (Index >= ProcessData->HandleTableSize
         || (Entry = &ProcessData->HandleTable[Index])->Object == NULL)
     {
-        DPRINT1("Couldn't dup invalid handle %p\n", ApiMessage->Data.DuplicateHandleRequest.Handle);
+        DPRINT1("Couldn't dup invalid handle %p\n", DuplicateHandleRequest->Handle);
         RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
         return STATUS_INVALID_HANDLE;
     }
 
-    if (ApiMessage->Data.DuplicateHandleRequest.Options & DUPLICATE_SAME_ACCESS)
+    if (DuplicateHandleRequest->Options & DUPLICATE_SAME_ACCESS)
     {
         DesiredAccess = Entry->Access;
     }
     else
     {
-        DesiredAccess = ApiMessage->Data.DuplicateHandleRequest.Access;
+        DesiredAccess = DuplicateHandleRequest->Access;
         /* Make sure the source handle has all the desired flags */
         if (~Entry->Access & DesiredAccess)
         {
             DPRINT1("Handle %p only has access %X; requested %X\n",
-                ApiMessage->Data.DuplicateHandleRequest.Handle, Entry->Access, DesiredAccess);
+                DuplicateHandleRequest->Handle, Entry->Access, DesiredAccess);
             RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
             return STATUS_INVALID_PARAMETER;
         }
     }
 
     ApiMessage->Status = Win32CsrInsertObject(ProcessData,
-                                           &ApiMessage->Data.DuplicateHandleRequest.Handle,
+                                           &DuplicateHandleRequest->Handle,
                                            Entry->Object,
                                            DesiredAccess,
-                                           ApiMessage->Data.DuplicateHandleRequest.Inheritable,
+                                           DuplicateHandleRequest->Inheritable,
                                            Entry->ShareMode);
     if (NT_SUCCESS(ApiMessage->Status)
-        && ApiMessage->Data.DuplicateHandleRequest.Options & DUPLICATE_CLOSE_SOURCE)
+        && DuplicateHandleRequest->Options & DUPLICATE_CLOSE_SOURCE)
     {
         Win32CsrCloseHandleEntry(Entry);
     }
@@ -374,7 +389,9 @@ CSR_API(SrvDuplicateHandle)
 
 CSR_API(CsrGetInputWaitHandle)
 {
-    ApiMessage->Data.GetConsoleInputWaitHandle.InputWaitHandle = CsrGetClientThread()->Process->ConsoleEvent;
+    PCSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleInputWaitHandle;
+
+    GetConsoleInputWaitHandle->InputWaitHandle = CsrGetClientThread()->Process->ConsoleEvent;
     return STATUS_SUCCESS;
 }
 
index 4472e66..63bcfdb 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "consrv.h"
+#include "conio.h"
 
 #define NDEBUG
 #include <debug.h>
index 22b0792..d3180d6 100644 (file)
@@ -8,8 +8,10 @@
 
 /* INCLUDES ******************************************************************/
 
+#include "consrv.h"
+#include "conio.h"
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 typedef struct tagHISTORY_BUFFER
@@ -149,6 +151,7 @@ HistoryDeleteBuffer(PHISTORY_BUFFER Hist)
 
 CSR_API(SrvGetConsoleCommandHistoryLength)
 {
+    PCSRSS_GET_COMMAND_HISTORY_LENGTH GetCommandHistoryLength = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLength;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
@@ -157,8 +160,8 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
     INT i;
 
     if (!Win32CsrValidateBuffer(ProcessData,
-                                ApiMessage->Data.GetCommandHistoryLength.ExeName.Buffer,
-                                ApiMessage->Data.GetCommandHistoryLength.ExeName.Length, 1))
+                                GetCommandHistoryLength->ExeName.Buffer,
+                                GetCommandHistoryLength->ExeName.Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -166,13 +169,13 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
     Status = ConioConsoleFromProcessData(ProcessData, &Console);
     if (NT_SUCCESS(Status))
     {
-        Hist = HistoryFindBuffer(Console, &ApiMessage->Data.GetCommandHistory.ExeName);
+        Hist = HistoryFindBuffer(Console, &GetCommandHistoryLength->ExeName);
         if (Hist)
         {
             for (i = 0; i < Hist->NumEntries; i++)
                 Length += Hist->Entries[i].Length + sizeof(WCHAR);
         }
-        ApiMessage->Data.GetCommandHistoryLength.Length = Length;
+        GetCommandHistoryLength->Length = Length;
         ConioUnlockConsole(Console);
     }
     return Status;
@@ -180,18 +183,19 @@ CSR_API(SrvGetConsoleCommandHistoryLength)
 
 CSR_API(SrvGetConsoleCommandHistory)
 {
+    PCSRSS_GET_COMMAND_HISTORY GetCommandHistory = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistory;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status;
     PHISTORY_BUFFER Hist;
-    PBYTE Buffer = (PBYTE)ApiMessage->Data.GetCommandHistory.History;
-    ULONG BufferSize = ApiMessage->Data.GetCommandHistory.Length;
+    PBYTE Buffer = (PBYTE)GetCommandHistory->History;
+    ULONG BufferSize = GetCommandHistory->Length;
     INT i;
 
     if (!Win32CsrValidateBuffer(ProcessData, Buffer, BufferSize, 1) ||
         !Win32CsrValidateBuffer(ProcessData,
-                                ApiMessage->Data.GetCommandHistory.ExeName.Buffer,
-                                ApiMessage->Data.GetCommandHistory.ExeName.Length, 1))
+                                GetCommandHistory->ExeName.Buffer,
+                                GetCommandHistory->ExeName.Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -199,7 +203,7 @@ CSR_API(SrvGetConsoleCommandHistory)
     Status = ConioConsoleFromProcessData(ProcessData, &Console);
     if (NT_SUCCESS(Status))
     {
-        Hist = HistoryFindBuffer(Console, &ApiMessage->Data.GetCommandHistory.ExeName);
+        Hist = HistoryFindBuffer(Console, &GetCommandHistory->ExeName);
         if (Hist)
         {
             for (i = 0; i < Hist->NumEntries; i++)
@@ -215,7 +219,7 @@ CSR_API(SrvGetConsoleCommandHistory)
                 Buffer += sizeof(WCHAR);
             }
         }
-        ApiMessage->Data.GetCommandHistory.Length = Buffer - (PBYTE)ApiMessage->Data.GetCommandHistory.History;
+        GetCommandHistory->Length = Buffer - (PBYTE)GetCommandHistory->History;
         ConioUnlockConsole(Console);
     }
     return Status;
@@ -223,14 +227,15 @@ CSR_API(SrvGetConsoleCommandHistory)
 
 CSR_API(SrvExpungeConsoleCommandHistory)
 {
+    PCSRSS_EXPUNGE_COMMAND_HISTORY ExpungeCommandHistory = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ExpungeCommandHistory;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     PHISTORY_BUFFER Hist;
     NTSTATUS Status;
 
     if (!Win32CsrValidateBuffer(ProcessData,
-                                ApiMessage->Data.ExpungeCommandHistory.ExeName.Buffer,
-                                ApiMessage->Data.ExpungeCommandHistory.ExeName.Length, 1))
+                                ExpungeCommandHistory->ExeName.Buffer,
+                                ExpungeCommandHistory->ExeName.Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -238,7 +243,7 @@ CSR_API(SrvExpungeConsoleCommandHistory)
     Status = ConioConsoleFromProcessData(ProcessData, &Console);
     if (NT_SUCCESS(Status))
     {
-        Hist = HistoryFindBuffer(Console, &ApiMessage->Data.ExpungeCommandHistory.ExeName);
+        Hist = HistoryFindBuffer(Console, &ExpungeCommandHistory->ExeName);
         HistoryDeleteBuffer(Hist);
         ConioUnlockConsole(Console);
     }
@@ -247,16 +252,17 @@ CSR_API(SrvExpungeConsoleCommandHistory)
 
 CSR_API(SrvSetConsoleNumberOfCommands)
 {
+    PCSRSS_SET_HISTORY_NUMBER_COMMANDS SetHistoryNumberCommands = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryNumberCommands;
     PCSR_PROCESS ProcessData = CsrGetClientThread()->Process;
     PCSRSS_CONSOLE Console;
     PHISTORY_BUFFER Hist;
     NTSTATUS Status;
-    WORD MaxEntries = ApiMessage->Data.SetHistoryNumberCommands.NumCommands;
+    WORD MaxEntries = SetHistoryNumberCommands->NumCommands;
     PUNICODE_STRING OldEntryList, NewEntryList;
 
     if (!Win32CsrValidateBuffer(ProcessData,
-                                ApiMessage->Data.SetHistoryNumberCommands.ExeName.Buffer,
-                                ApiMessage->Data.SetHistoryNumberCommands.ExeName.Length, 1))
+                                SetHistoryNumberCommands->ExeName.Buffer,
+                                SetHistoryNumberCommands->ExeName.Length, 1))
     {
         return STATUS_ACCESS_VIOLATION;
     }
@@ -264,7 +270,7 @@ CSR_API(SrvSetConsoleNumberOfCommands)
     Status = ConioConsoleFromProcessData(ProcessData, &Console);
     if (NT_SUCCESS(Status))
     {
-        Hist = HistoryFindBuffer(Console, &ApiMessage->Data.SetHistoryNumberCommands.ExeName);
+        Hist = HistoryFindBuffer(Console, &SetHistoryNumberCommands->ExeName);
         if (Hist)
         {
             OldEntryList = Hist->Entries;
@@ -296,13 +302,14 @@ CSR_API(SrvSetConsoleNumberOfCommands)
 
 CSR_API(SrvGetConsoleHistory)
 {
+    PCSRSS_GET_HISTORY_INFO GetHistoryInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetHistoryInfo;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status = ConioConsoleFromProcessData(CsrGetClientThread()->Process, &Console);
     if (NT_SUCCESS(Status))
     {
-        ApiMessage->Data.SetHistoryInfo.HistoryBufferSize      = Console->HistoryBufferSize;
-        ApiMessage->Data.SetHistoryInfo.NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
-        ApiMessage->Data.SetHistoryInfo.dwFlags                = Console->HistoryNoDup;
+        GetHistoryInfo->HistoryBufferSize      = Console->HistoryBufferSize;
+        GetHistoryInfo->NumberOfHistoryBuffers = Console->NumberOfHistoryBuffers;
+        GetHistoryInfo->dwFlags                = Console->HistoryNoDup;
         ConioUnlockConsole(Console);
     }
     return Status;
@@ -310,13 +317,14 @@ CSR_API(SrvGetConsoleHistory)
 
 CSR_API(SrvSetConsoleHistory)
 {
+    PCSRSS_SET_HISTORY_INFO SetHistoryInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetHistoryInfo;
     PCSRSS_CONSOLE Console;
     NTSTATUS Status = ConioConsoleFromProcessData(CsrGetClientThread()->Process, &Console);
     if (NT_SUCCESS(Status))
     {
-        Console->HistoryBufferSize      = (WORD)ApiMessage->Data.SetHistoryInfo.HistoryBufferSize;
-        Console->NumberOfHistoryBuffers = (WORD)ApiMessage->Data.SetHistoryInfo.NumberOfHistoryBuffers;
-        Console->HistoryNoDup           = ApiMessage->Data.SetHistoryInfo.dwFlags & HISTORY_NO_DUP_FLAG;
+        Console->HistoryBufferSize      = (WORD)SetHistoryInfo->HistoryBufferSize;
+        Console->NumberOfHistoryBuffers = (WORD)SetHistoryInfo->NumberOfHistoryBuffers;
+        Console->HistoryNoDup           = SetHistoryInfo->dwFlags & HISTORY_NO_DUP_FLAG;
         ConioUnlockConsole(Console);
     }
     return Status;
diff --git a/win32ss/user/consrv/resource.h b/win32ss/user/consrv/resource.h
new file mode 100644 (file)
index 0000000..4f505bc
--- /dev/null
@@ -0,0 +1,53 @@
+/* $Id: resource.h 51293 2011-04-09 12:01:36Z mkupfer $
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Win32 subsystem
+ * FILE:            subsys/csrss/win32csr/resource.h
+ * PURPOSE:         Resource #defines
+ */
+
+#pragma once
+
+#define IDD_END_NOW  10
+#define IDD_NOT_RESPONDING 11
+#define IDD_SWITCH_APP 12
+
+#define IDC_STATIC   -1
+#define IDC_PROGRESS 101
+#define IDC_END_NOW  102
+#define IDC_STATIC_CUR_APP 103
+
+
+#define ID_SYSTEM_EDIT_MARK 1001
+#define ID_SYSTEM_EDIT_COPY 1002
+#define ID_SYSTEM_EDIT_PASTE    1003
+#define ID_SYSTEM_EDIT_SELECTALL    1004
+#define ID_SYSTEM_EDIT_SCROLL   1005
+#define ID_SYSTEM_EDIT_FIND 1006
+#define ID_SYSTEM_DEFAULTS  1007
+#define ID_SYSTEM_PROPERTIES    1008
+
+#define NCPOPUP_MENU  103
+
+#define IDS_EDIT         204
+#define IDS_MARK      205
+#define IDS_COPY      206
+#define IDS_PASTE     207
+#define IDS_SELECTALL 208
+#define IDS_SCROLL    209
+#define IDS_FIND      210
+#define IDS_DEFAULTS  211
+#define IDS_PROPERTIES 212
+
+//scrollbar resource ids
+#define IDS_SCROLLHERE   304
+#define IDS_SCROLLTOP    305
+#define IDS_SCROLLBOTTOM 306
+#define IDS_SCROLLPAGE_UP 307
+#define IDS_SCROLLPAGE_DOWN 308
+#define IDS_SCROLLUP 309
+#define IDS_SCROLLDOWN 310
+
+#define IDS_COMMAND_PROMPT 500
+
+/* EOF */
index a6252e3..4c3f2f3 100644 (file)
@@ -1,13 +1,15 @@
-/* $Id: tuiconsole.c 47693 2010-06-08 06:38:14Z jmorlan $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            win32ss/user/consrv/tuiconsole.c
  * PURPOSE:         Implementation of text-mode consoles
  */
 
+#include "consrv.h"
+#include "tuiconsole.h"
+#include <drivers/blue/ntddblue.h>
+
 #define NDEBUG
-#include "w32csr.h"
 #include <debug.h>
 
 CRITICAL_SECTION ActiveConsoleLock;
index bcb7313..a519c6d 100644 (file)
@@ -1,12 +1,12 @@
-/* $Id: tuiconsole.h 21947 2006-05-20 10:49:56Z fireball $
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
  * FILE:            win32ss/user/consrv/tuiconsole.h
  * PURPOSE:         Interface to text-mode consoles
  */
 
-#include "api.h"
+// #include "api.h"
+#include "conio.h"
 
 extern NTSTATUS FASTCALL TuiInitConsole(PCSRSS_CONSOLE Console);
 extern PCSRSS_CONSOLE FASTCALL TuiGetFocusConsole(VOID);
index 2f78f4f..887c945 100644 (file)
 extern HANDLE Win32CsrApiHeap;
 extern HINSTANCE Win32CsrDllHandle;
 
-
-
-/********** Move that to consrv ************/
-
-typedef struct Object_tt
-{
-    LONG Type;
-    struct tagCSRSS_CONSOLE *Console;
-    LONG AccessRead, AccessWrite;
-    LONG ExclusiveRead, ExclusiveWrite;
-    LONG HandleCount;
-} Object_t;
-
-typedef struct _CSRSS_HANDLE
-{
-    Object_t *Object;
-    DWORD Access;
-    BOOL Inheritable;
-    DWORD ShareMode;
-} CSRSS_HANDLE, *PCSRSS_HANDLE;
-
-BOOL FASTCALL Win32CsrValidateBuffer(PCSR_PROCESS ProcessData,
-                                     PVOID Buffer,
-                                     SIZE_T NumElements,
-                                     SIZE_T ElementSize);
-
-/* handle.c */
-NTSTATUS FASTCALL Win32CsrInsertObject(PCSR_PROCESS ProcessData,
-                                       PHANDLE Handle,
-                                       Object_t *Object,
-                                       DWORD Access,
-                                       BOOL Inheritable,
-                                       DWORD ShareMode);
-NTSTATUS FASTCALL Win32CsrLockObject(PCSR_PROCESS ProcessData,
-                                     HANDLE Handle,
-                                     Object_t **Object,
-                                     DWORD Access,
-                                     long Type);
-VOID FASTCALL Win32CsrUnlockObject(Object_t *Object);
-
-NTSTATUS FASTCALL Win32CsrReleaseObject(PCSR_PROCESS ProcessData,
-                                        HANDLE Object);
-VOID WINAPI Win32CsrReleaseConsole(PCSR_PROCESS ProcessData);
-
-NTSTATUS WINAPI Win32CsrDuplicateHandleTable(PCSR_PROCESS SourceProcessData,
-                                             PCSR_PROCESS TargetProcessData);
-CSR_API(CsrGetHandle);
-CSR_API(CsrCloseHandle);
-CSR_API(CsrVerifyHandle);
-CSR_API(CsrDuplicateHandle);
-CSR_API(CsrGetInputWaitHandle);
-
-/*******************************************/
-
-
-
-
-
-
-
 /*
 typedef VOID (WINAPI *CSR_CLEANUP_OBJECT_PROC)(Object_t *Object);
 
@@ -88,6 +28,7 @@ NTSTATUS FASTCALL Win32CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
                                         PVOID Context);
 
 /* exitros.c */
+/// Must go to winsrv.dll
 CSR_API(CsrExitReactos);
 CSR_API(CsrSetLogonNotifyWindow);
 CSR_API(CsrRegisterLogonProcess);