[BASESRV-CONSRV-WINSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 7 Apr 2013 23:39:39 +0000 (23:39 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 7 Apr 2013 23:39:39 +0000 (23:39 +0000)
Code reorganization only: put public server apis definitions in a dedicated include to be included in the respective init.c files.

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

13 files changed:
include/reactos/subsys/win/console.h
subsystems/win/basesrv/api.h [new file with mode: 0644]
subsystems/win/basesrv/basesrv.h
subsystems/win/basesrv/dosdev.c
subsystems/win/basesrv/init.c
subsystems/win/basesrv/proc.c
subsystems/win/basesrv/sndsntry.c
win32ss/user/consrv/api.h
win32ss/user/consrv/console.c
win32ss/user/consrv/lineinput.c
win32ss/user/winsrv/api.h [new file with mode: 0644]
win32ss/user/winsrv/init.c
win32ss/user/winsrv/winsrv.h

index 3b01810..1153ef9 100644 (file)
@@ -14,7 +14,7 @@
 #define IsConsoleHandle(h)  \
     (((ULONG_PTR)(h) & 0x10000003) == 0x3)
 
-/* Console reserved "file" names */
+/* Console-reserved device "file" names */
 #define CONSOLE_FILE_NAME           L"CON"
 #define CONSOLE_INPUT_FILE_NAME     L"CONIN$"
 #define CONSOLE_OUTPUT_FILE_NAME    L"CONOUT$"
diff --git a/subsystems/win/basesrv/api.h b/subsystems/win/basesrv/api.h
new file mode 100644 (file)
index 0000000..3e7d43c
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Base API Server DLL
+ * FILE:            subsystems/win/basesrv/api.h
+ * PURPOSE:         Public server APIs definitions
+ * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
+ */
+
+#pragma once
+
+/* dosdev.c */
+VOID BaseInitDefineDosDevice(VOID);
+VOID BaseCleanupDefineDosDevice(VOID);
+
+CSR_API(BaseSrvDefineDosDevice);
+
+/* proc.c */
+CSR_API(BaseSrvGetTempFile);
+CSR_API(BaseSrvCreateProcess);
+CSR_API(BaseSrvCreateThread);
+CSR_API(BaseSrvExitProcess);
+CSR_API(BaseSrvGetProcessShutdownParam);
+CSR_API(BaseSrvSetProcessShutdownParam);
+
+/* sndsntry.c */
+CSR_API(BaseSrvSoundSentryNotification);
+
+/* EOF */
index 69d9398..c44b9ae 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS/Win32 Base enviroment Subsystem Server
+ * PROJECT:         ReactOS Base API Server DLL
  * FILE:            subsystems/win/basesrv/basesrv.h
  * PURPOSE:         Main header - Definitions
  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
 #include <win/base.h>
 
 
+/* Globals */
 extern HANDLE BaseSrvHeap;
 extern HANDLE BaseSrvSharedHeap;
 extern PBASE_STATIC_SERVER_DATA BaseStaticServerData;
 
-/* dosdev.c */
-VOID BaseInitDefineDosDevice(VOID);
-VOID BaseCleanupDefineDosDevice(VOID);
-
-CSR_API(BaseSrvDefineDosDevice);
-
-/* proc.c */
-CSR_API(BaseSrvGetTempFile);
-CSR_API(BaseSrvCreateProcess);
-CSR_API(BaseSrvCreateThread);
-CSR_API(BaseSrvExitProcess);
-CSR_API(BaseSrvGetProcessShutdownParam);
-CSR_API(BaseSrvSetProcessShutdownParam);
-
-/* sndsntry.c */
-CSR_API(BaseSrvSoundSentryNotification);
-
 #endif // __BASESRV_H__
 
 /* EOF */
index 8766ebf..9444ad9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS/Win32 Base enviroment Subsystem Server
+ * PROJECT:         ReactOS Base API Server DLL
  * FILE:            subsystems/win/basesrv/dosdev.c
  * PURPOSE:         DOS Devices Management
  * PROGRAMMERS:     Pierre Schweitzer (pierre.schweitzer@reactos.org)
index edda67e..007b6bd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS/Win32 Base enviroment Subsystem Server
+ * PROJECT:         ReactOS Base API Server DLL
  * FILE:            subsystems/win/basesrv/init.c
  * PURPOSE:         Initialization
  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
@@ -9,6 +9,7 @@
 /* INCLUDES *******************************************************************/
 
 #include "basesrv.h"
+#include "api.h"
 
 #define NDEBUG
 #include <debug.h>
index b302260..ac99dc8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS/Win32 Base enviroment Subsystem Server
+ * PROJECT:         ReactOS Base API Server DLL
  * FILE:            subsystems/win/basesrv/proc.c
  * PURPOSE:         Process and Thread Management
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
index 2e22b48..f38ca07 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS/Win32 Base enviroment Subsystem Server
+ * PROJECT:         ReactOS Base API Server DLL
  * FILE:            subsystems/win/basesrv/sndsntry.c
  * PURPOSE:         Sound Sentry Notifications
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
index f562ae2..dc3142a 100644 (file)
@@ -17,22 +17,22 @@ CSR_API(SrvGetConsoleAliasExes);
 CSR_API(SrvGetConsoleAliasExesLength);
 
 /* coninput.c */
+CSR_API(SrvReadConsole);
 CSR_API(SrvGetConsoleInput);
 CSR_API(SrvWriteConsoleInput);
-CSR_API(SrvReadConsole);
 CSR_API(SrvFlushConsoleInputBuffer);
 CSR_API(SrvGetConsoleNumberOfInputEvents);
 
 /* conoutput.c */
 CSR_API(SrvReadConsoleOutput);
+CSR_API(SrvWriteConsole);
 CSR_API(SrvWriteConsoleOutput);
 CSR_API(SrvReadConsoleOutputString);
 CSR_API(SrvWriteConsoleOutputString);
 CSR_API(SrvFillConsoleOutput);
-CSR_API(SrvWriteConsole);
-CSR_API(SrvSetConsoleCursorPosition);
 CSR_API(SrvGetConsoleCursorInfo);
 CSR_API(SrvSetConsoleCursorInfo);
+CSR_API(SrvSetConsoleCursorPosition);
 CSR_API(SrvSetConsoleTextAttribute);
 CSR_API(SrvCreateConsoleScreenBuffer);
 CSR_API(SrvGetConsoleScreenBufferInfo);
@@ -41,14 +41,13 @@ CSR_API(SrvScrollConsoleScreenBuffer);
 CSR_API(SrvSetConsoleScreenBufferSize);
 
 /* console.c */
-CSR_API(SrvOpenConsole);
 CSR_API(SrvAllocConsole);
 CSR_API(SrvAttachConsole);
 CSR_API(SrvFreeConsole);
-CSR_API(SrvSetConsoleMode);
 CSR_API(SrvGetConsoleMode);
-CSR_API(SrvSetConsoleTitle);
+CSR_API(SrvSetConsoleMode);
 CSR_API(SrvGetConsoleTitle);
+CSR_API(SrvSetConsoleTitle);
 CSR_API(SrvGetConsoleHardwareState);
 CSR_API(SrvSetConsoleHardwareState);
 CSR_API(SrvGetConsoleDisplayMode);
@@ -62,13 +61,14 @@ CSR_API(SrvGenerateConsoleCtrlEvent);
 CSR_API(SrvGetConsoleSelectionInfo);
 
 /* handle.c */
+CSR_API(SrvOpenConsole);
 CSR_API(SrvCloseHandle);
 CSR_API(SrvVerifyConsoleIoHandle);
 CSR_API(SrvDuplicateHandle);
 
 /* lineinput.c */
-CSR_API(SrvGetConsoleCommandHistoryLength);
 CSR_API(SrvGetConsoleCommandHistory);
+CSR_API(SrvGetConsoleCommandHistoryLength);
 CSR_API(SrvExpungeConsoleCommandHistory);
 CSR_API(SrvSetConsoleNumberOfCommands);
 CSR_API(SrvGetConsoleHistory);
index 6845bd1..870432c 100644 (file)
@@ -1003,6 +1003,50 @@ CSR_API(SrvFreeConsole)
     return STATUS_SUCCESS;
 }
 
+CSR_API(SrvGetConsoleMode)
+{
+    NTSTATUS Status;
+    PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
+    PCONSOLE_IO_OBJECT Object = NULL;
+
+    Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+                             ConsoleModeRequest->ConsoleHandle,
+                             &Object, NULL, GENERIC_READ, TRUE, 0);
+    if (!NT_SUCCESS(Status)) return Status;
+
+    Status = STATUS_SUCCESS;
+
+    if (INPUT_BUFFER == Object->Type)
+    {
+        PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
+        PCONSOLE Console  = InputBuffer->Header.Console;
+        DWORD ConsoleMode = InputBuffer->Mode;
+
+        if (Console->QuickEdit || Console->InsertMode)
+        {
+            // Windows does this, even if it's not documented on MSDN
+            ConsoleMode |= ENABLE_EXTENDED_FLAGS;
+
+            if (Console->QuickEdit ) ConsoleMode |= ENABLE_QUICK_EDIT_MODE;
+            if (Console->InsertMode) ConsoleMode |= ENABLE_INSERT_MODE;
+        }
+
+        ConsoleModeRequest->ConsoleMode = ConsoleMode;
+    }
+    else if (SCREEN_BUFFER == Object->Type)
+    {
+        PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object;
+        ConsoleModeRequest->ConsoleMode = Buffer->Mode;
+    }
+    else
+    {
+        Status = STATUS_INVALID_HANDLE;
+    }
+
+    ConSrvReleaseObject(Object, TRUE);
+    return Status;
+}
+
 CSR_API(SrvSetConsoleMode)
 {
 #define CONSOLE_VALID_CONTROL_MODES ( ENABLE_EXTENDED_FLAGS   | ENABLE_INSERT_MODE  | ENABLE_QUICK_EDIT_MODE )
@@ -1086,48 +1130,41 @@ Quit:
     return Status;
 }
 
-CSR_API(SrvGetConsoleMode)
+CSR_API(SrvGetConsoleTitle)
 {
     NTSTATUS Status;
-    PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
-    PCONSOLE_IO_OBJECT Object = NULL;
-
-    Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
-                             ConsoleModeRequest->ConsoleHandle,
-                             &Object, NULL, GENERIC_READ, TRUE, 0);
-    if (!NT_SUCCESS(Status)) return Status;
-
-    Status = STATUS_SUCCESS;
+    PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
+    // PCSR_PROCESS Process = CsrGetClientThread()->Process;
+    PCONSOLE Console;
+    DWORD Length;
 
-    if (INPUT_BUFFER == Object->Type)
+    if (!CsrValidateMessageBuffer(ApiMessage,
+                                  (PVOID)&TitleRequest->Title,
+                                  TitleRequest->Length,
+                                  sizeof(BYTE)))
     {
-        PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
-        PCONSOLE Console  = InputBuffer->Header.Console;
-        DWORD ConsoleMode = InputBuffer->Mode;
-
-        if (Console->QuickEdit || Console->InsertMode)
-        {
-            // Windows does this, even if it's not documented on MSDN
-            ConsoleMode |= ENABLE_EXTENDED_FLAGS;
-
-            if (Console->QuickEdit ) ConsoleMode |= ENABLE_QUICK_EDIT_MODE;
-            if (Console->InsertMode) ConsoleMode |= ENABLE_INSERT_MODE;
-        }
-
-        ConsoleModeRequest->ConsoleMode = ConsoleMode;
+        return STATUS_INVALID_PARAMETER;
     }
-    else if (SCREEN_BUFFER == Object->Type)
+
+    Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
+    if (!NT_SUCCESS(Status))
     {
-        PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object;
-        ConsoleModeRequest->ConsoleMode = Buffer->Mode;
+        DPRINT1("Can't get console\n");
+        return Status;
     }
-    else
+
+    /* Copy title of the console to the user title buffer */
+    if (TitleRequest->Length >= sizeof(WCHAR))
     {
-        Status = STATUS_INVALID_HANDLE;
+        Length = min(TitleRequest->Length - sizeof(WCHAR), Console->Title.Length);
+        memcpy(TitleRequest->Title, Console->Title.Buffer, Length);
+        TitleRequest->Title[Length / sizeof(WCHAR)] = L'\0';
     }
 
-    ConSrvReleaseObject(Object, TRUE);
-    return Status;
+    TitleRequest->Length = Console->Title.Length;
+
+    ConSrvReleaseConsole(Console, TRUE);
+    return STATUS_SUCCESS;
 }
 
 CSR_API(SrvSetConsoleTitle)
@@ -1181,43 +1218,6 @@ CSR_API(SrvSetConsoleTitle)
     return Status;
 }
 
-CSR_API(SrvGetConsoleTitle)
-{
-    NTSTATUS Status;
-    PCONSOLE_GETSETCONSOLETITLE TitleRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.TitleRequest;
-    // PCSR_PROCESS Process = CsrGetClientThread()->Process;
-    PCONSOLE Console;
-    DWORD Length;
-
-    if (!CsrValidateMessageBuffer(ApiMessage,
-                                  (PVOID)&TitleRequest->Title,
-                                  TitleRequest->Length,
-                                  sizeof(BYTE)))
-    {
-        return STATUS_INVALID_PARAMETER;
-    }
-
-    Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process), &Console, TRUE);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Can't get console\n");
-        return Status;
-    }
-
-    /* Copy title of the console to the user title buffer */
-    if (TitleRequest->Length >= sizeof(WCHAR))
-    {
-        Length = min(TitleRequest->Length - sizeof(WCHAR), Console->Title.Length);
-        memcpy(TitleRequest->Title, Console->Title.Buffer, Length);
-        TitleRequest->Title[Length / sizeof(WCHAR)] = L'\0';
-    }
-
-    TitleRequest->Length = Console->Title.Length;
-
-    ConSrvReleaseConsole(Console, TRUE);
-    return STATUS_SUCCESS;
-}
-
 /**********************************************************************
  *  HardwareStateProperty
  *
index fbfdd47..e778489 100644 (file)
@@ -446,39 +446,6 @@ LineInputKeyDown(PCONSOLE Console, KEY_EVENT_RECORD *KeyEvent)
 
 /* PUBLIC SERVER APIS *********************************************************/
 
-CSR_API(SrvGetConsoleCommandHistoryLength)
-{
-    PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLengthRequest;
-    PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
-    PCONSOLE Console;
-    NTSTATUS Status;
-    PHISTORY_BUFFER Hist;
-    ULONG Length = 0;
-    INT i;
-
-    if (!CsrValidateMessageBuffer(ApiMessage,
-                                  (PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer,
-                                  GetCommandHistoryLengthRequest->ExeName.Length,
-                                  sizeof(BYTE)))
-    {
-        return STATUS_INVALID_PARAMETER;
-    }
-
-    Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
-    if (NT_SUCCESS(Status))
-    {
-        Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName);
-        if (Hist)
-        {
-            for (i = 0; i < Hist->NumEntries; i++)
-                Length += Hist->Entries[i].Length + sizeof(WCHAR);
-        }
-        GetCommandHistoryLengthRequest->Length = Length;
-        ConSrvReleaseConsole(Console, TRUE);
-    }
-    return Status;
-}
-
 CSR_API(SrvGetConsoleCommandHistory)
 {
     PCONSOLE_GETCOMMANDHISTORY GetCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryRequest;
@@ -527,6 +494,39 @@ CSR_API(SrvGetConsoleCommandHistory)
     return Status;
 }
 
+CSR_API(SrvGetConsoleCommandHistoryLength)
+{
+    PCONSOLE_GETCOMMANDHISTORYLENGTH GetCommandHistoryLengthRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetCommandHistoryLengthRequest;
+    PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrGetClientThread()->Process);
+    PCONSOLE Console;
+    NTSTATUS Status;
+    PHISTORY_BUFFER Hist;
+    ULONG Length = 0;
+    INT i;
+
+    if (!CsrValidateMessageBuffer(ApiMessage,
+                                  (PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer,
+                                  GetCommandHistoryLengthRequest->ExeName.Length,
+                                  sizeof(BYTE)))
+    {
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
+    if (NT_SUCCESS(Status))
+    {
+        Hist = HistoryFindBuffer(Console, &GetCommandHistoryLengthRequest->ExeName);
+        if (Hist)
+        {
+            for (i = 0; i < Hist->NumEntries; i++)
+                Length += Hist->Entries[i].Length + sizeof(WCHAR);
+        }
+        GetCommandHistoryLengthRequest->Length = Length;
+        ConSrvReleaseConsole(Console, TRUE);
+    }
+    return Status;
+}
+
 CSR_API(SrvExpungeConsoleCommandHistory)
 {
     PCONSOLE_EXPUNGECOMMANDHISTORY ExpungeCommandHistoryRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ExpungeCommandHistoryRequest;
diff --git a/win32ss/user/winsrv/api.h b/win32ss/user/winsrv/api.h
new file mode 100644 (file)
index 0000000..b3a826d
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS User API Server DLL
+ * FILE:            win32ss/user/winsrv/api.h
+ * PURPOSE:         Public server APIs definitions
+ * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
+ */
+
+#pragma once
+
+/* init.c */
+BOOL WINAPI _UserSoundSentry(VOID);
+
+/* harderror.c */
+VOID WINAPI UserServerHardError(IN PCSR_THREAD ThreadData,
+                                IN PHARDERROR_MSG Message);
+
+/* register.c */
+CSR_API(SrvRegisterServicesProcess);
+CSR_API(SrvRegisterLogonProcess);
+
+/* shutdown.c */
+CSR_API(SrvExitWindowsEx);
+
+/* EOF */
index 074fb40..52328e4 100644 (file)
@@ -10,6 +10,7 @@
 /* INCLUDES *******************************************************************/
 
 #include "winsrv.h"
+#include "api.h"
 
 #define NDEBUG
 #include <debug.h>
index e6a91b6..a3f642c 100644 (file)
 #include "resource.h"
 
 
+/* Globals */
 extern HINSTANCE UserServerDllInstance;
 extern HANDLE UserServerHeap;
-
 extern ULONG_PTR LogonProcessId;
 
-/* init.c */
-BOOL WINAPI _UserSoundSentry(VOID);
-
-/* harderror.c */
-VOID WINAPI UserServerHardError(IN PCSR_THREAD ThreadData,
-                                IN PHARDERROR_MSG Message);
-
-/* register.c */
-CSR_API(SrvRegisterServicesProcess);
-CSR_API(SrvRegisterLogonProcess);
-
-/* shutdown.c */
-CSR_API(SrvExitWindowsEx);
-
 #endif // __WINSRV_H__
 
 /* EOF */