e2cde91af2939fab9345029416d081e60f3ea54c
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
10 #include <ndk/ntndk.h>
12 #include <sm/helper.h>
17 /**********************************************************************
22 * This function is called by an environment subsystem server to
23 * tell the SM it finished initialization phase and is ready to
24 * manage processes it registered for (SmConnectApiPort).
27 * hSmApiPort: port handle returned by SmConnectApiPort;
28 * hSbApiPort: call back API port of the subsystem (handle);
29 * hApiPort : API port of the subsystem (handle).
32 * Success status as handed by the SM reply; otherwise a failure
36 SmCompleteSession (IN HANDLE hSmApiPort
,
41 SM_PORT_MESSAGE SmReqMsg
;
43 DPRINT("SMLIB: %s called\n", __FUNCTION__
);
45 /* Marshal Ses in the LPC message */
46 SmReqMsg
.Request
.CompSes
.hApiPort
= hApiPort
;
47 SmReqMsg
.Request
.CompSes
.hSbApiPort
= hSbApiPort
;
49 /* SM API to invoke */
50 SmReqMsg
.SmHeader
.ApiIndex
= SM_API_COMPLETE_SESSION
;
53 SmReqMsg
.Header
.u2
.s2
.Type
= LPC_NEW_MESSAGE
;
54 SmReqMsg
.Header
.u1
.s1
.DataLength
= SM_PORT_DATA_SIZE(SmReqMsg
.Request
);
55 SmReqMsg
.Header
.u1
.s1
.TotalLength
= SM_PORT_MESSAGE_SIZE
;
56 Status
= NtRequestWaitReplyPort (hSmApiPort
, (PPORT_MESSAGE
) & SmReqMsg
, (PPORT_MESSAGE
) & SmReqMsg
);
57 if (NT_SUCCESS(Status
))
59 return SmReqMsg
.SmHeader
.Status
;
61 DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__
, Status
);