SMDLL: helper to use the SM
[reactos.git] / reactos / lib / smdll / compses.c
1 /* $Id$
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/api.h>
11 #include <sm/helper.h>
12
13 NTSTATUS STDCALL
14 SmCompleteSession (HANDLE hSmApiPort, HANDLE hSbApiPort, HANDLE hApiPort)
15 {
16 NTSTATUS Status;
17 SM_PORT_MESSAGE SmReqMsg;
18
19 /* Marshal Ses in the LPC message */
20 SmReqMsg.CompSes.hApiPort = hApiPort;
21 SmReqMsg.CompSes.hSbApiPort = hSbApiPort;
22
23 /* SM API to invoke */
24 SmReqMsg.ApiIndex = SM_API_COMPLETE_SESSION;
25
26 /* Port message */
27 SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE;
28 SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.CompSes);
29 SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE;
30 Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg);
31 if (NT_SUCCESS(Status))
32 {
33 return SmReqMsg.Status;
34 }
35 DbgPrint ("%s failed (Status=0x%08lx)\n", __FUNCTION__, Status);
36 return Status;
37 }
38
39 /* EOF */