ReactOS  0.4.15-dev-1171-gab82533
compses.c
Go to the documentation of this file.
1 /*
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
6  */
7 
8 #include "precomp.h"
9 
10 #define NDEBUG
11 #include <debug.h>
12 
13 /**********************************************************************
14  * NAME EXPORTED
15  * SmCompleteSession/3
16  *
17  * DESCRIPTION
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).
21  *
22  * ARGUMENTS
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).
26  *
27  * RETURN VALUE
28  * Success status as handed by the SM reply; otherwise a failure
29  * status code.
30  */
34  IN HANDLE hApiPort)
35 {
37  SM_PORT_MESSAGE SmReqMsg;
38 
39  DPRINT("SMLIB: %s called\n", __FUNCTION__);
40 
41  /* Marshal Ses in the LPC message */
42  SmReqMsg.Request.CompSes.hApiPort = hApiPort;
43  SmReqMsg.Request.CompSes.hSbApiPort = hSbApiPort;
44 
45  /* SM API to invoke */
46  SmReqMsg.SmHeader.ApiIndex = SM_API_COMPLETE_SESSION;
47 
48  /* Port message */
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))
54  {
55  return SmReqMsg.SmHeader.Status;
56  }
57  DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status);
58  return Status;
59 }
60 
61 /* EOF */
#define IN
Definition: typedefs.h:39
NTSTATUS NTAPI NtRequestWaitReplyPort(IN HANDLE PortHandle, IN PPORT_MESSAGE LpcRequest, IN OUT PPORT_MESSAGE LpcReply)
Definition: send.c:695
LONG NTSTATUS
Definition: precomp.h:26
#define SM_API_COMPLETE_SESSION
Definition: api.h:32
#define SM_PORT_DATA_SIZE(c)
Definition: api.h:149
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WINAPI
Definition: msvc.h:6
Status
Definition: gdiplustypes.h:24
NTSTATUS WINAPI SmCompleteSession(IN HANDLE hSmApiPort, IN HANDLE hSbApiPort, IN HANDLE hApiPort)
Definition: compses.c:32
HANDLE hSbApiPort
Definition: init.c:32
struct _SM_PORT_MESSAGE::@3489::@3491::@3493 SmHeader
union _SM_PORT_MESSAGE::@3489::@3491::@3494::@3496 Request
PORT_MESSAGE Header
Definition: api.h:112
#define SM_PORT_MESSAGE_SIZE
Definition: api.h:150
#define __FUNCTION__
Definition: types.h:112