545423805834a501dbd3aa719208680b8a00d224
[reactos.git] / reactos / lib / smlib / compses.c
1 /* $Id: compses.c 13731 2005-02-23 23:37:06Z ea $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/smlib/compses.c
6 * PURPOSE: Call SM API SM_API_COMPLETE_SESSION
7 */
8 #define NTOS_MODE_USER
9 #include <ntos.h>
10 #include <sm/helper.h>
11
12 #define NDEBUG
13 #include <debug.h>
14
15 /**********************************************************************
16 * NAME EXPORTED
17 * SmCompleteSession/3
18 *
19 * DESCRIPTION
20 * This function is called by an environment subsystem server to
21 * tell the SM it finished initialization phase and is ready to
22 * manage processes it registered for (SmConnectApiPort).
23 *
24 * ARGUMENTS
25 * hSmApiPort: port handle returned by SmConnectApiPort;
26 * hSbApiPort: call back API port of the subsystem (handle);
27 * hApiPort : API port of the subsystem (handle).
28 *
29 * RETURN VALUE
30 * Success status as handed by the SM reply; otherwise a failure
31 * status code.
32 */
33 NTSTATUS STDCALL
34 SmCompleteSession (IN HANDLE hSmApiPort,
35 IN HANDLE hSbApiPort,
36 IN HANDLE hApiPort)
37 {
38 NTSTATUS Status;
39 SM_PORT_MESSAGE SmReqMsg;
40
41 DPRINT("SMLIB: %s called\n", __FUNCTION__);
42
43 /* Marshal Ses in the LPC message */
44 SmReqMsg.Request.CompSes.hApiPort = hApiPort;
45 SmReqMsg.Request.CompSes.hSbApiPort = hSbApiPort;
46
47 /* SM API to invoke */
48 SmReqMsg.SmHeader.ApiIndex = SM_API_COMPLETE_SESSION;
49
50 /* Port message */
51 SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE;
52 SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request);
53 SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE;
54 Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg);
55 if (NT_SUCCESS(Status))
56 {
57 return SmReqMsg.SmHeader.Status;
58 }
59 DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status);
60 return Status;
61 }
62
63 /* EOF */