[CONSRV]
[reactos.git] / win32ss / user / consrv / console.c
index 39dd4bd..4eabc9d 100644 (file)
@@ -33,9 +33,9 @@ DtbgIsDesktopVisible(VOID)
 
 NTSTATUS FASTCALL
 ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
-                            PCSRSS_CONSOLE *Console)
+                            PCONSOLE *Console)
 {
-    PCSRSS_CONSOLE ProcessConsole;
+    PCONSOLE ProcessConsole;
 
     RtlEnterCriticalSection(&ProcessData->HandleTableLock);
     ProcessConsole = ProcessData->Console;
@@ -88,12 +88,12 @@ ConioConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData)
 }
 
 NTSTATUS WINAPI
-CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess)
+CsrInitConsole(PCONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLeaderProcess)
 {
     NTSTATUS Status;
     SECURITY_ATTRIBUTES SecurityAttributes;
-    PCSRSS_CONSOLE Console;
-    PCSRSS_SCREEN_BUFFER NewBuffer;
+    PCONSOLE Console;
+    PCONSOLE_SCREEN_BUFFER NewBuffer;
     BOOL GuiMode;
     WCHAR Title[255];
 
@@ -102,7 +102,7 @@ CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLead
     *NewConsole = NULL;
 
     /* Allocate a console structure */
-    Console = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_CONSOLE));
+    Console = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE));
     if (NULL == Console)
     {
         DPRINT1("Not enough memory for console creation.\n");
@@ -155,7 +155,7 @@ CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLead
     GuiMode = DtbgIsDesktopVisible();
 
     /* allocate console screen buffer */
-    NewBuffer = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CSRSS_SCREEN_BUFFER));
+    NewBuffer = HeapAlloc(ConSrvHeap, HEAP_ZERO_MEMORY, sizeof(CONSOLE_SCREEN_BUFFER));
     if (NULL == NewBuffer)
     {
         RtlFreeUnicodeString(&Console->Title);
@@ -168,7 +168,7 @@ CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLead
     NewBuffer->CursorInfo.bVisible = TRUE;
     NewBuffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE;
     /* make console active, and insert into console list */
-    Console->ActiveBuffer = (PCSRSS_SCREEN_BUFFER) NewBuffer;
+    Console->ActiveBuffer = (PCONSOLE_SCREEN_BUFFER) NewBuffer;
 
     /*
      * If we are not in GUI-mode, start the text-mode console. If we fail,
@@ -234,12 +234,12 @@ CsrInitConsole(PCSRSS_CONSOLE* NewConsole, int ShowCmd, PCSR_PROCESS ConsoleLead
 CSR_API(SrvOpenConsole)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    PCSRSS_OPEN_CONSOLE OpenConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
+    PCONSOLE_OPENCONSOLE OpenConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
 
     DPRINT("SrvOpenConsole\n");
 
-    OpenConsoleRequest->Handle = INVALID_HANDLE_VALUE;
+    OpenConsoleRequest->ConsoleHandle = INVALID_HANDLE_VALUE;
 
     RtlEnterCriticalSection(&ProcessData->HandleTableLock);
 
@@ -251,7 +251,7 @@ CSR_API(SrvOpenConsole)
         DWORD DesiredAccess = OpenConsoleRequest->Access;
         DWORD ShareMode = OpenConsoleRequest->ShareMode;
 
-        PCSRSS_CONSOLE Console = ProcessData->Console;
+        PCONSOLE Console = ProcessData->Console;
         Object_t *Object;
 
         DPRINT1("SrvOpenConsole - Checkpoint 2\n");
@@ -274,7 +274,7 @@ CSR_API(SrvOpenConsole)
         else
         {
             Status = Win32CsrInsertObject(ProcessData,
-                                          &OpenConsoleRequest->Handle,
+                                          &OpenConsoleRequest->ConsoleHandle,
                                           Object,
                                           DesiredAccess,
                                           OpenConsoleRequest->Inheritable,
@@ -292,7 +292,7 @@ CSR_API(SrvOpenConsole)
 CSR_API(SrvAllocConsole)
 {
     NTSTATUS Status = STATUS_SUCCESS;
-    PCSRSS_ALLOC_CONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest;
+    PCONSOLE_ALLOCCONSOLE AllocConsoleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.AllocConsoleRequest;
     PCSR_PROCESS ConsoleLeader = CsrGetClientThread()->Process;
     PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(ConsoleLeader);
 
@@ -435,7 +435,7 @@ CSR_API(SrvAllocConsole)
 
     /* Set the Ctrl Dispatcher */
     ProcessData->CtrlDispatcher = AllocConsoleRequest->CtrlDispatcher;
-    DPRINT("CSRSS:CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
+    DPRINT("CONSRV: CtrlDispatcher address: %x\n", ProcessData->CtrlDispatcher);
 
     RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
     return STATUS_SUCCESS;
@@ -449,7 +449,7 @@ CSR_API(SrvFreeConsole)
 }
 
 VOID WINAPI
-ConioDeleteConsole(PCSRSS_CONSOLE Console)
+ConioDeleteConsole(PCONSOLE Console)
 {
     ConsoleInput *Event;
 
@@ -468,7 +468,7 @@ ConioDeleteConsole(PCSRSS_CONSOLE Console)
     if (Console->LineBuffer)
         RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer);
     while (!IsListEmpty(&Console->HistoryBuffers))
-        HistoryDeleteBuffer((struct tagHISTORY_BUFFER *)Console->HistoryBuffers.Flink);
+        HistoryDeleteBuffer((struct _HISTORY_BUFFER *)Console->HistoryBuffers.Flink);
 
     ConioDeleteScreenBuffer(Console->ActiveBuffer);
     if (!IsListEmpty(&Console->BufferList))
@@ -493,7 +493,7 @@ CsrInitConsoleSupport(VOID)
 }
 
 VOID FASTCALL
-ConioPause(PCSRSS_CONSOLE Console, UINT Flags)
+ConioPause(PCONSOLE Console, UINT Flags)
 {
     Console->PauseFlags |= Flags;
     if (!Console->UnpauseEvent)
@@ -501,7 +501,7 @@ ConioPause(PCSRSS_CONSOLE Console, UINT Flags)
 }
 
 VOID FASTCALL
-ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
+ConioUnpause(PCONSOLE Console, UINT Flags)
 {
     Console->PauseFlags &= ~Flags;
 
@@ -522,9 +522,9 @@ ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags)
 CSR_API(SrvSetConsoleMode)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_MODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
-    PCSRSS_CONSOLE Console;
-    PCSRSS_SCREEN_BUFFER Buff;
+    PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
+    PCONSOLE Console;
+    PCONSOLE_SCREEN_BUFFER Buff;
 
     DPRINT("SrvSetConsoleMode\n");
 
@@ -533,7 +533,7 @@ CSR_API(SrvSetConsoleMode)
                                 (Object_t **) &Console, GENERIC_WRITE, 0);
     if (!NT_SUCCESS(Status)) return Status;
 
-    Buff = (PCSRSS_SCREEN_BUFFER)Console;
+    Buff = (PCONSOLE_SCREEN_BUFFER)Console;
 
     if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
     {
@@ -556,9 +556,9 @@ CSR_API(SrvSetConsoleMode)
 CSR_API(SrvGetConsoleMode)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_MODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
-    PCSRSS_CONSOLE Console;
-    PCSRSS_SCREEN_BUFFER Buff;
+    PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
+    PCONSOLE Console;
+    PCONSOLE_SCREEN_BUFFER Buff;
 
     DPRINT("SrvGetConsoleMode\n");
 
@@ -568,7 +568,7 @@ CSR_API(SrvGetConsoleMode)
     if (!NT_SUCCESS(Status)) return Status;
 
     Status = STATUS_SUCCESS;
-    Buff = (PCSRSS_SCREEN_BUFFER) Console;
+    Buff = (PCONSOLE_SCREEN_BUFFER) Console;
 
     if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
     {
@@ -590,9 +590,9 @@ CSR_API(SrvGetConsoleMode)
 CSR_API(SrvSetConsoleTitle)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_TITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
+    PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
     // PCSR_PROCESS Process = CsrGetClientThread()->Process;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE Console;
     PWCHAR Buffer;
 
     DPRINT("SrvSetConsoleTitle\n");
@@ -640,9 +640,9 @@ CSR_API(SrvSetConsoleTitle)
 CSR_API(SrvGetConsoleTitle)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_TITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
+    PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
     // PCSR_PROCESS Process = CsrGetClientThread()->Process;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE Console;
     DWORD Length;
 
     DPRINT("SrvGetConsoleTitle\n");
@@ -684,14 +684,14 @@ CSR_API(SrvGetConsoleTitle)
  *      between direct video buffer ouput and GDI windowed
  *      output.
  *  ARGUMENTS
- *      Client hands us a CSRSS_CONSOLE_HARDWARE_STATE
- *      object. We use the same object to Request.
+ *      Client hands us a CONSOLE_GETSETHWSTATE object.
+ *      We use the same object to Request.
  *  NOTE
  *      ConsoleHwState has the correct size to be compatible
  *      with NT's, but values are not.
  */
 static NTSTATUS FASTCALL
-SetConsoleHardwareState(PCSRSS_CONSOLE Console, DWORD ConsoleHwState)
+SetConsoleHardwareState(PCONSOLE Console, DWORD ConsoleHwState)
 {
     DPRINT1("Console Hardware State: %d\n", ConsoleHwState);
 
@@ -714,13 +714,13 @@ SetConsoleHardwareState(PCSRSS_CONSOLE Console, DWORD ConsoleHwState)
 CSR_API(SrvGetConsoleHardwareState)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvGetConsoleHardwareState\n");
 
     Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
-                              ConsoleHardwareStateRequest->ConsoleHandle,
+                              HardwareStateRequest->OutputHandle,
                               &Console,
                               GENERIC_READ);
     if (!NT_SUCCESS(Status))
@@ -729,7 +729,7 @@ CSR_API(SrvGetConsoleHardwareState)
         return Status;
     }
 
-    ConsoleHardwareStateRequest->State = Console->HardwareState;
+    HardwareStateRequest->State = Console->HardwareState;
 
     ConioUnlockConsole(Console);
 
@@ -739,13 +739,13 @@ CSR_API(SrvGetConsoleHardwareState)
 CSR_API(SrvSetConsoleHardwareState)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETSETHWSTATE HardwareStateRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.HardwareStateRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvSetConsoleHardwareState\n");
 
     Status = ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
-                              ConsoleHardwareStateRequest->ConsoleHandle,
+                              HardwareStateRequest->OutputHandle,
                               &Console,
                               GENERIC_READ);
     if (!NT_SUCCESS(Status))
@@ -755,7 +755,7 @@ CSR_API(SrvSetConsoleHardwareState)
     }
 
     DPRINT("Setting console hardware state.\n");
-    Status = SetConsoleHardwareState(Console, ConsoleHardwareStateRequest->State);
+    Status = SetConsoleHardwareState(Console, HardwareStateRequest->State);
 
     ConioUnlockConsole(Console);
 
@@ -765,15 +765,15 @@ CSR_API(SrvSetConsoleHardwareState)
 CSR_API(SrvGetConsoleWindow)
 {
     NTSTATUS Status;
-    PCSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleWindowRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETWINDOW GetWindowRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetWindowRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvGetConsoleWindow\n");
 
     Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
     if (!NT_SUCCESS(Status)) return Status;
 
-    GetConsoleWindowRequest->WindowHandle = Console->hWindow;
+    GetWindowRequest->WindowHandle = Console->hWindow;
     ConioUnlockConsole(Console);
 
     return STATUS_SUCCESS;
@@ -782,15 +782,15 @@ CSR_API(SrvGetConsoleWindow)
 CSR_API(SrvSetConsoleIcon)
 {
     NTSTATUS Status;
-    PCSRSS_SET_CONSOLE_ICON SetConsoleIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleIconRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_SETICON SetIconRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetIconRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvSetConsoleIcon\n");
 
     Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
     if (!NT_SUCCESS(Status)) return Status;
 
-    Status = (ConioChangeIcon(Console, SetConsoleIconRequest->WindowIcon)
+    Status = (ConioChangeIcon(Console, SetIconRequest->WindowIcon)
                 ? STATUS_SUCCESS
                 : STATUS_UNSUCCESSFUL);
 
@@ -802,8 +802,8 @@ CSR_API(SrvSetConsoleIcon)
 CSR_API(SrvGetConsoleCP)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_CP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvGetConsoleCP, getting %s Code Page\n",
             ConsoleCPRequest->InputCP ? "Input" : "Output");
@@ -820,8 +820,8 @@ CSR_API(SrvGetConsoleCP)
 CSR_API(SrvSetConsoleCP)
 {
     NTSTATUS Status;
-    PCSRSS_CONSOLE_CP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETSETINPUTOUTPUTCP ConsoleCPRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleCPRequest;
+    PCONSOLE Console;
 
     DPRINT("SrvSetConsoleCP, setting %s Code Page\n",
             ConsoleCPRequest->InputCP ? "Input" : "Output");
@@ -847,10 +847,10 @@ CSR_API(SrvSetConsoleCP)
 CSR_API(SrvGetConsoleProcessList)
 {
     NTSTATUS Status;
-    PCSRSS_GET_PROCESS_LIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
+    PCONSOLE_GETPROCESSLIST GetProcessListRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetProcessListRequest;
     PDWORD Buffer;
     // PCSR_PROCESS Process = CsrGetClientThread()->Process;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE Console;
     PCONSOLE_PROCESS_DATA current;
     PLIST_ENTRY current_entry;
     ULONG nItems = 0;
@@ -890,8 +890,8 @@ CSR_API(SrvGetConsoleProcessList)
 CSR_API(SrvGenerateConsoleCtrlEvent)
 {
     NTSTATUS Status;
-    PCSRSS_GENERATE_CTRL_EVENT GenerateCtrlEvent = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEvent;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GENERATECTRLEVENT GenerateCtrlEventRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GenerateCtrlEventRequest;
+    PCONSOLE Console;
     PCONSOLE_PROCESS_DATA current;
     PLIST_ENTRY current_entry;
     DWORD Group;
@@ -899,7 +899,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
     Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
     if (!NT_SUCCESS(Status)) return Status;
 
-    Group = GenerateCtrlEvent->ProcessGroup;
+    Group = GenerateCtrlEventRequest->ProcessGroup;
     Status = STATUS_INVALID_PARAMETER;
     for (current_entry  = Console->ProcessList.Flink;
          current_entry != &Console->ProcessList;
@@ -908,7 +908,7 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
         current = CONTAINING_RECORD(current_entry, CONSOLE_PROCESS_DATA, ConsoleLink);
         if (Group == 0 || current->Process->ProcessGroupId == Group)
         {
-            ConioConsoleCtrlEvent(GenerateCtrlEvent->Event, current);
+            ConioConsoleCtrlEvent(GenerateCtrlEventRequest->Event, current);
             Status = STATUS_SUCCESS;
         }
     }
@@ -921,15 +921,15 @@ CSR_API(SrvGenerateConsoleCtrlEvent)
 CSR_API(SrvGetConsoleSelectionInfo)
 {
     NTSTATUS Status;
-    PCSRSS_GET_CONSOLE_SELECTION_INFO GetConsoleSelectionInfo = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleSelectionInfo;
-    PCSRSS_CONSOLE Console;
+    PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
+    PCONSOLE Console;
 
     Status = ConioConsoleFromProcessData(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console);
     if (NT_SUCCESS(Status))
     {
-        memset(&GetConsoleSelectionInfo->Info, 0, sizeof(CONSOLE_SELECTION_INFO));
+        memset(&GetSelectionInfoRequest->Info, 0, sizeof(CONSOLE_SELECTION_INFO));
         if (Console->Selection.dwFlags != 0)
-            GetConsoleSelectionInfo->Info = Console->Selection;
+            GetSelectionInfoRequest->Info = Console->Selection;
         ConioUnlockConsole(Console);
     }