Author: ion Date: Tue Feb 14 00:54:32 2012 New Revision: 55584
URL: http://svn.reactos.org/svn/reactos?rev=55584&view=rev Log: [SMLIB]: Implement SmSessionComplete.
Modified: trunk/reactos/include/reactos/subsys/sm/smmsg.h trunk/reactos/lib/smlib/smclient.c
Modified: trunk/reactos/include/reactos/subsys/sm/smmsg.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/sm/s... ============================================================================== --- trunk/reactos/include/reactos/subsys/sm/smmsg.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/sm/smmsg.h [iso-8859-1] Tue Feb 14 00:54:32 2012 @@ -43,7 +43,7 @@ typedef struct _SM_SESSION_COMPLETE_MSG { ULONG SessionId; - NTSTATUS Status; + NTSTATUS SessionStatus; } SM_SESSION_COMPLETE_MSG, *PSM_SESSION_COMPLETE_MSG;
typedef struct _SM_TERMINATE_FOREIGN_SESSION_MSG @@ -219,6 +219,15 @@ #endif
// +// SB Message Handler +// +typedef +BOOLEAN +(NTAPI *PSB_API_ROUTINE)( + IN PSB_API_MSG SbApiMsg +); + +// // The actual server functions that a client linking with smlib can call // NTSTATUS @@ -238,4 +247,12 @@ IN BOOLEAN DebugFlag );
-#endif +NTSTATUS +NTAPI +SmSessionComplete( + IN HANDLE SmApiPort, + IN ULONG SessionId, + IN NTSTATUS SessionStatus +); + +#endif
Modified: trunk/reactos/lib/smlib/smclient.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/smlib/smclient.c?rev=55... ============================================================================== --- trunk/reactos/lib/smlib/smclient.c [iso-8859-1] (original) +++ trunk/reactos/lib/smlib/smclient.c [iso-8859-1] Tue Feb 14 00:54:32 2012 @@ -128,3 +128,41 @@ /* Return if the connection was successful or not */ return Status; } + +NTSTATUS +NTAPI +SmSessionComplete(IN HANDLE SmApiPort, + IN ULONG SessionId, + IN NTSTATUS SessionStatus) +{ + NTSTATUS Status; + SM_API_MSG ApiMessage; + PSM_SESSION_COMPLETE_MSG SessionComplete = &ApiMessage.u.SessionComplete; + + /* Set the message data */ + SessionComplete->SessionId = SessionId; + SessionComplete->SessionStatus = SessionStatus; + + /* Set the API Message Port Message header */ + ApiMessage.ApiNumber = SmSessionCompleteApi; + ApiMessage.h.u1.s1.DataLength = sizeof(SM_SESSION_COMPLETE_MSG) + 8; + ApiMessage.h.u1.s1.TotalLength = sizeof(SM_API_MSG); + ApiMessage.h.u2.ZeroInit = 0; + + /* Sent the message and wait for a reply */ + Status = NtRequestWaitReplyPort(SmApiPort, + &ApiMessage.h, + &ApiMessage.h); + if (NT_SUCCESS(Status)) + { + /* Return the real status */ + Status = ApiMessage.ReturnValue; + } + else + { + DPRINT1("SmCompleteSession: NtRequestWaitReply failed\n"); + } + + /* Return status */ + return Status; +}