mirror of
https://github.com/reactos/reactos.git
synced 2025-05-16 15:50:24 +00:00
[SMLIB]: Implement SmSessionComplete.
svn path=/trunk/; revision=55584
This commit is contained in:
parent
0674ee0915
commit
9e265ba699
2 changed files with 56 additions and 1 deletions
|
@ -43,7 +43,7 @@ typedef struct _SM_CREATE_FOREIGN_SESSION_MSG
|
|||
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
|
||||
|
@ -218,6 +218,15 @@ C_ASSERT(sizeof(SB_CONNECTION_INFO) == 0xF4);
|
|||
C_ASSERT(sizeof(SB_API_MSG) == 0x110);
|
||||
#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
|
||||
//
|
||||
|
@ -238,4 +247,12 @@ SmExecPgm(
|
|||
IN BOOLEAN DebugFlag
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
SmSessionComplete(
|
||||
IN HANDLE SmApiPort,
|
||||
IN ULONG SessionId,
|
||||
IN NTSTATUS SessionStatus
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -128,3 +128,41 @@ SmConnectToSm(IN PUNICODE_STRING SbApiPortName,
|
|||
/* 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue