+/* $Id: smss.c 12852 2005-01-06 13:58:04Z mf $\r
+ *\r
+ * client.c - Session Manager client Management\r
+ * \r
+ * ReactOS Operating System\r
+ * \r
+ * --------------------------------------------------------------------\r
+ *\r
+ * This software is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License as\r
+ * published by the Free Software Foundation; either version 2 of the\r
+ * License, or (at your option) any later version.\r
+ *\r
+ * This software is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this software; see the file COPYING.LIB. If not, write\r
+ * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,\r
+ * MA 02139, USA. \r
+ *\r
+ * --------------------------------------------------------------------\r
+ */\r
+#define NTOS_MODE_USER\r
+#include <ntos.h>\r
+#include <sm/api.h>\r
+#include "smss.h"\r
+\r
+/* Private ADT */\r
+\r
+typedef struct _SM_CLIENT_DATA\r
+{\r
+ USHORT SubsystemId;\r
+ BOOL Initialized;\r
+ HANDLE ServerProcess;\r
+ HANDLE ApiPort;\r
+ HANDLE SbApiPort;\r
+ struct _SM_CLIENT_DATA * Next;\r
+ \r
+} SM_CLIENT_DATA, *PSM_CLIENT_DATA;\r
+\r
+\r
+struct _SM_CLIENT_DIRECTORY\r
+{\r
+ RTL_CRITICAL_SECTION Lock;\r
+ ULONG Count;\r
+ PSM_CLIENT_DATA Client;\r
+\r
+} SmpClientDirectory;\r
+\r
+/**********************************************************************\r
+ * SmpInitializeClientManagement/0\r
+ */\r
+VOID STDCALL\r
+SmpInitializeClientManagement (VOID)\r
+{\r
+ RtlInitializeCriticalSection(& SmpClientDirectory.Lock);\r
+ SmpClientDirectory.Count = 0;\r
+ SmpClientDirectory.Client = NULL;\r
+}\r
+\r
+/**********************************************************************\r
+ * SmpCreateClient/1\r
+ */\r
+NTSTATUS STDCALL\r
+SmpCreateClient(SM_PORT_MESSAGE Request)\r
+{\r
+ PSM_CLIENT_DATA pClient = NULL;\r
+\r
+ /*\r
+ * Allocate the storage for client data\r
+ */\r
+ pClient = RtlAllocateHeap (SmpHeap,\r
+ HEAP_ZERO_MEMORY,\r
+ sizeof (SM_CLIENT_DATA));\r
+ if (NULL == pClient) return STATUS_NO_MEMORY;\r
+ /*\r
+ * Initialize the client data\r
+ */\r
+ // TODO\r
+ /*\r
+ * Insert the new descriptor in the\r
+ * client directory.\r
+ */\r
+ RtlEnterCriticalSection (& SmpClientDirectory.Lock);\r
+ if (NULL == SmpClientDirectory.Client)\r
+ {\r
+ SmpClientDirectory.Client = pClient;\r
+ } else {\r
+ PSM_CLIENT_DATA pCD = NULL;\r
+\r
+ for (pCD=SmpClientDirectory.Client;\r
+ (NULL != pCD->Next);\r
+ pCD = pCD->Next);\r
+ pCD->Next = pClient;\r
+ }\r
+ ++ SmpClientDirectory.Count;\r
+ RtlLeaveCriticalSection (& SmpClientDirectory.Lock);\r
+ return STATUS_SUCCESS;\r
+}\r
+\r
+/**********************************************************************\r
+ * SmpDestroyClient/1\r
+ */\r
+NTSTATUS STDCALL\r
+SmpDestroyClient (ULONG SubsystemId)\r
+{\r
+ RtlEnterCriticalSection (& SmpClientDirectory.Lock);\r
+ /* TODO */\r
+ RtlLeaveCriticalSection (& SmpClientDirectory.Lock);\r
+ return STATUS_SUCCESS;\r
+}\r
+\r
+/* EOF */\r