2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/smlib/compses.c
5 * PURPOSE: Call SM API SM_API_COMPLETE_SESSION
13 /**********************************************************************
18 * This function is called by an environment subsystem server to
19 * tell the SM it finished initialization phase and is ready to
20 * manage processes it registered for (SmConnectApiPort).
23 * hSmApiPort: port handle returned by SmConnectApiPort;
24 * hSbApiPort: call back API port of the subsystem (handle);
25 * hApiPort : API port of the subsystem (handle).
28 * Success status as handed by the SM reply; otherwise a failure
32 SmCompleteSession (IN HANDLE hSmApiPort
,
37 SM_PORT_MESSAGE SmReqMsg
;
39 DPRINT("SMLIB: %s called\n", __FUNCTION__
);
41 /* Marshal Ses in the LPC message */
42 SmReqMsg
.Request
.CompSes
.hApiPort
= hApiPort
;
43 SmReqMsg
.Request
.CompSes
.hSbApiPort
= hSbApiPort
;
45 /* SM API to invoke */
46 SmReqMsg
.SmHeader
.ApiIndex
= SM_API_COMPLETE_SESSION
;
49 SmReqMsg
.Header
.u2
.s2
.Type
= LPC_NEW_MESSAGE
;
50 SmReqMsg
.Header
.u1
.s1
.DataLength
= SM_PORT_DATA_SIZE(SmReqMsg
.Request
);
51 SmReqMsg
.Header
.u1
.s1
.TotalLength
= SM_PORT_MESSAGE_SIZE
;
52 Status
= NtRequestWaitReplyPort (hSmApiPort
, (PPORT_MESSAGE
) & SmReqMsg
, (PPORT_MESSAGE
) & SmReqMsg
);
53 if (NT_SUCCESS(Status
))
55 return SmReqMsg
.SmHeader
.Status
;
57 DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__
, Status
);