3 * init.c - ReactOS/Win32 Console+User Enviroment Subsystem Server - Initialization
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * --------------------------------------------------------------------
30 HANDLE WinSrvApiPort
= NULL
;
32 /**********************************************************************
34 * ConStaticServerThread/1
36 VOID WINAPI
ConStaticServerThread (PVOID x
)
38 NTSTATUS Status
= STATUS_SUCCESS
;
39 PPORT_MESSAGE Request
= (PPORT_MESSAGE
) x
;
40 PPORT_MESSAGE Reply
= NULL
;
41 ULONG MessageType
= 0;
43 DPRINT("WINSRV: %s(%08lx) called\n", __FUNCTION__
, x
);
45 MessageType
= Request
->u2
.s2
.Type
;
46 DPRINT("WINSRV: %s(%08lx) received a message (Type=%d)\n",
47 __FUNCTION__
, x
, MessageType
);
52 Status
= NtReplyPort (WinSrvApiPort
, Reply
);
57 /**********************************************************************
59 * UserStaticServerThread/1
61 VOID WINAPI
UserStaticServerThread (PVOID x
)
63 NTSTATUS Status
= STATUS_SUCCESS
;
64 PPORT_MESSAGE Request
= (PPORT_MESSAGE
) x
;
65 PPORT_MESSAGE Reply
= NULL
;
66 ULONG MessageType
= 0;
68 DPRINT("WINSRV: %s(%08lx) called\n", __FUNCTION__
, x
);
70 MessageType
= Request
->u2
.s2
.Type
;
71 DPRINT("WINSRV: %s(%08lx) received a message (Type=%d)\n",
72 __FUNCTION__
, x
, MessageType
);
77 Status
= NtReplyPort (WinSrvApiPort
, Reply
);
82 /*=====================================================================
84 *===================================================================*/
86 NTSTATUS WINAPI
ConServerDllInitialization (ULONG ArgumentCount
,
89 NTSTATUS Status
= STATUS_SUCCESS
;
91 DPRINT("WINSRV: %s called\n", __FUNCTION__
);
93 // Get the listening port from csrsrv.dll
94 WinSrvApiPort
= CsrQueryApiPort ();
95 if (NULL
== WinSrvApiPort
)
97 return STATUS_UNSUCCESSFUL
;
99 // Register our message dispatcher
100 Status
= CsrAddStaticServerThread (ConStaticServerThread
);
101 if (NT_SUCCESS(Status
))
103 //TODO: perform the real console server internal initialization here
108 NTSTATUS WINAPI
UserServerDllInitialization (ULONG ArgumentCount
,
111 NTSTATUS Status
= STATUS_SUCCESS
;
113 DPRINT("WINSRV: %s called\n", __FUNCTION__
);
115 // Get the listening port from csrsrv.dll
116 WinSrvApiPort
= CsrQueryApiPort ();
117 if (NULL
== WinSrvApiPort
)
119 return STATUS_UNSUCCESSFUL
;
121 // Register our message dispatcher
122 Status
= CsrAddStaticServerThread (UserStaticServerThread
);
123 if (NT_SUCCESS(Status
))
125 //TODO: perform the real user server internal initialization here