From 810d009783c4f4b45d5d80eb1075921556d30c1d Mon Sep 17 00:00:00 2001 From: Emanuele Aliberti Date: Sun, 10 Apr 2005 19:08:23 +0000 Subject: [PATCH] SM: initial work on SM_API_QUERY_INFORMATION (client side; ROS specific). SM: fixed connection data in callback SM->subsystem_server during ss registration svn path=/trunk/; revision=14581 --- reactos/include/sm/api.h | 68 ++++++++++++++++++++--- reactos/include/sm/helper.h | 19 +++---- reactos/lib/smdll/query.c | 92 +++++++++++++++++++++++++++----- reactos/lib/smdll/smdll.def | 2 +- reactos/lib/smdll/testapi.c | 20 ------- reactos/lib/smlib/compses.c | 11 ++-- reactos/lib/smlib/connect.c | 24 ++++++--- reactos/lib/smlib/execpgm.c | 25 ++++++--- reactos/subsys/smss/client.c | 8 +-- reactos/subsys/smss/smapi.c | 30 ++++++----- reactos/subsys/smss/smapicomp.c | 7 +-- reactos/subsys/smss/smapiexec.c | 10 ++-- reactos/subsys/smss/smapiquery.c | 2 +- 13 files changed, 218 insertions(+), 100 deletions(-) delete mode 100644 reactos/lib/smdll/testapi.c diff --git a/reactos/include/sm/api.h b/reactos/include/sm/api.h index ecca2b89d0c..9b4944b5f5f 100644 --- a/reactos/include/sm/api.h +++ b/reactos/include/sm/api.h @@ -12,15 +12,16 @@ #pragma pack(push,4) -/* SmConnectApiPort */ +/* SmConnectApiPort (SS->SM) */ typedef struct _SM_CONNECT_DATA { - ULONG Subsystem; + USHORT SubSystemId; + WORD Unused; WCHAR SbName [SM_SB_NAME_MAX_LENGTH]; } SM_CONNECT_DATA, *PSM_CONNECT_DATA; -/* SmpConnectSbApiPort */ +/* SmpConnectSbApiPort (SM->SS) */ typedef struct _SB_CONNECT_DATA { ULONG SmApiMax; @@ -65,6 +66,47 @@ typedef struct _SM_PORT_MESSAGE_EXECPGM } SM_PORT_MESSAGE_EXECPGM, *PSM_PORT_MESSAGE_EXECPGM; +/*** 5 ****************************************************************/ + +#define SM_API_QUERY_INFORMATION 5 /* ask SM to send back some data */ + /* Note: this is not in NT */ +#define SM_QRYINFO_MAX_SS_COUNT 8 +#define SM_QRYINFO_MAX_ROOT_NODE 30 + +typedef enum { + SmBasicInformation = 0, + SmSubSystemInformation = 1, +} SM_INFORMATION_CLASS; + +typedef struct _SM_BASIC_INFORMATION +{ + USHORT SubSystemCount; + WORD Unused; + struct { + WORD Id; + WORD Flags; + DWORD ProcessId; + } SubSystem [SM_QRYINFO_MAX_SS_COUNT]; +} SM_BASIC_INFORMATION, *PSM_BASIC_INFORMATION; + +typedef struct _SM_SUBSYSTEM_INFORMATION +{ + WORD SubSystemId; + WORD Flags; + DWORD ProcessId; + WCHAR NameSpaceRootNode [SM_QRYINFO_MAX_ROOT_NODE]; +} SM_SUBSYSTEM_INFORMATION, *PSM_SUBSYSTEM_INFORMATION; + +typedef struct _SM_PORT_MESSAGE_QRYINFO +{ + SM_INFORMATION_CLASS SmInformationClass; + ULONG DataLength; + union { + SM_BASIC_INFORMATION BasicInformation; + SM_SUBSYSTEM_INFORMATION SubSystemInformation; + }; +} SM_PORT_MESSAGE_QRYINFO, * PSM_PORT_MESSAGE_QRYINFO; + /*** | ****************************************************************/ typedef struct _SM_PORT_MESSAGE @@ -72,12 +114,22 @@ typedef struct _SM_PORT_MESSAGE /*** LPC common header ***/ LPC_MESSAGE Header; /*** SM common header ***/ - DWORD ApiIndex; - NTSTATUS Status; + struct { + DWORD ApiIndex; + NTSTATUS Status; + } SmHeader; /*** SM per API arguments ***/ union { - SM_PORT_MESSAGE_COMPSES CompSes; - SM_PORT_MESSAGE_EXECPGM ExecPgm; + union { + SM_PORT_MESSAGE_COMPSES CompSes; + SM_PORT_MESSAGE_EXECPGM ExecPgm; + SM_PORT_MESSAGE_QRYINFO QryInfo; + } Request; + union { + SM_PORT_MESSAGE_COMPSES CompSes; + SM_PORT_MESSAGE_EXECPGM ExecPgm; + SM_PORT_MESSAGE_QRYINFO QryInfo; + } Reply; }; } SM_PORT_MESSAGE, * PSM_PORT_MESSAGE; @@ -86,7 +138,7 @@ typedef struct _SM_PORT_MESSAGE /*** MACRO ***********************************************************/ -#define SM_CONNECT_DATA_SIZE(m) ((m).Header.DataSize-sizeof(ULONG)) +#define SM_CONNECT_DATA_SIZE(m) ((m).Header.DataSize-sizeof(USHORT)-sizeof(WORD)) #define SM_PORT_DATA_SIZE(c) (sizeof(DWORD)+sizeof(NTSTATUS)+sizeof(c)) #define SM_PORT_MESSAGE_SIZE (sizeof(SM_PORT_MESSAGE)) diff --git a/reactos/include/sm/helper.h b/reactos/include/sm/helper.h index aca5158bddf..3ca42dfcbe6 100644 --- a/reactos/include/sm/helper.h +++ b/reactos/include/sm/helper.h @@ -1,13 +1,17 @@ #if !defined(INCLUDE_SM_HELPER_H) #define INCLUDE_SM_HELPER_H +#if !defined(__SM_API_H) +#include +#endif + /* $Id$ */ /* smlib/connect.c */ NTSTATUS STDCALL SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, IN HANDLE hSbApiPort OPTIONAL, - IN DWORD dwSubsystem OPTIONAL, /* pe.h */ + IN WORD wSubsystem OPTIONAL, /* pe.h */ IN OUT PHANDLE phSmApiPort); /* smlib/compses.c */ NTSTATUS STDCALL @@ -20,14 +24,11 @@ SmExecuteProgram (IN HANDLE hSmApiPort, IN PUNICODE_STRING Pgm ); /* smdll/query.c */ -typedef enum { - SM_BASE_INFORMATION -} SM_INFORMATION_CLASS, *PSM_INFORMATION_CLASS; - NTSTATUS STDCALL -SmQuery (IN HANDLE SmApiPort, - IN SM_INFORMATION_CLASS SmInformationClass, - IN OUT PVOID Data, - IN OUT PULONG DataLength); +SmQueryInformation (IN HANDLE SmApiPort, + IN SM_INFORMATION_CLASS SmInformationClass, + IN OUT PVOID Data, + IN ULONG DataLength, + IN OUT PULONG ReturnedDataLength OPTIONAL); #endif /* ndef INCLUDE_SM_HELPER_H */ diff --git a/reactos/lib/smdll/query.c b/reactos/lib/smdll/query.c index 0e8fe38c7fd..078cf4b5207 100644 --- a/reactos/lib/smdll/query.c +++ b/reactos/lib/smdll/query.c @@ -1,39 +1,105 @@ -/* $Id: compses.c 13731 2005-02-23 23:37:06Z ea $ +/* $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries * FILE: lib/smdll/query.c - * PURPOSE: Call SM API SM_API_QUERY (not in NT) + * PURPOSE: Call SM API SM_API_QUERY_INFORMATION (not in NT) */ #define NTOS_MODE_USER #include -#include #include #define NDEBUG #include + /********************************************************************** * NAME EXPORTED - * SmQuery/4 + * SmQueryInformation/5 * * DESCRIPTION + * Ask the SM to collect some data from its internal data + * structures and send it back. * * ARGUMENTS - * + * hSmApiPort: handle returned by SmConnectApiPort; + * SmInformationClass: an SM information class ID: + * SM_BASIC_INFORMATION: the number of registered subsystems + * Data: pointer to storage for the information to request; + * DataLength: length in bytes of the Data buffer; it must be + * set and must match the SmInformationClass info size; + * ReturnedDataLength: optional pointer to storage to receive + * the size of the returnede data. + * * RETURN VALUE + * STATUS_SUCCESS: OK you get what you asked for; + * STATUS_INFO_LENGTH_MISMATCH: you set DataLength to 0 or to a + * value that does not match whet the SmInformationClass + * requires; + * STATUS_INVALID_PARAMETER_2: bad information class; + * A port error. + * */ NTSTATUS STDCALL -SmQuery (IN HANDLE SmApiPort, - IN SM_INFORMATION_CLASS SmInformationClass, - IN OUT PVOID Data, - IN OUT PULONG DataLength) +SmQueryInformation (IN HANDLE hSmApiPort, + IN SM_INFORMATION_CLASS SmInformationClass, + IN OUT PVOID Data, + IN ULONG DataLength, + IN OUT PULONG ReturnedDataLength OPTIONAL) { - /* TODO */ - if(NULL != DataLength) + NTSTATUS Status = STATUS_SUCCESS; + SM_PORT_MESSAGE SmReqMsg; + + + if(0 == DataLength) { - *DataLength = 0; + return STATUS_INFO_LENGTH_MISMATCH; } - return STATUS_SUCCESS; + /* Marshal data in the port message */ + switch (SmInformationClass) + { + case SmBasicInformation: + if(DataLength != sizeof (SM_BASIC_INFORMATION)) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + SmReqMsg.Request.QryInfo.SmInformationClass = SmBasicInformation; + SmReqMsg.Request.QryInfo.DataLength = DataLength; + SmReqMsg.Request.QryInfo.BasicInformation.SubSystemCount = 0; + break; + case SmSubSystemInformation: + if(DataLength != sizeof (SM_SUBSYSTEM_INFORMATION)) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + SmReqMsg.Request.QryInfo.SmInformationClass = SmSubSystemInformation; + SmReqMsg.Request.QryInfo.DataLength = DataLength; + SmReqMsg.Request.QryInfo.SubSystemInformation.SubSystemId = + ((PSM_SUBSYSTEM_INFORMATION)Data)->SubSystemId; + break; + default: + return STATUS_INVALID_PARAMETER_2; + } + /* SM API to invoke */ + SmReqMsg.SmHeader.ApiIndex = SM_API_QUERY_INFORMATION; + + /* Prepare the port request message */ + SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); + SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; + Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); + if (NT_SUCCESS(Status)) + { + /* Unmarshal data */ + RtlCopyMemory (Data, & SmReqMsg.Reply.QryInfo.BasicInformation, SmReqMsg.Reply.QryInfo.DataLength); + /* Use caller provided storage to store data size */ + if(NULL != ReturnedDataLength) + { + *ReturnedDataLength = SmReqMsg.Reply.QryInfo.DataLength; + } + return SmReqMsg.SmHeader.Status; + } + DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); + return Status; } /* EOF */ diff --git a/reactos/lib/smdll/smdll.def b/reactos/lib/smdll/smdll.def index 8be3c1fb4ae..df6394e5f0a 100644 --- a/reactos/lib/smdll/smdll.def +++ b/reactos/lib/smdll/smdll.def @@ -3,4 +3,4 @@ EXPORTS SmCompleteSession@12 SmConnectApiPort@16 SmExecuteProgram@8 -SmQuery@16 +SmQueryInformation@20 diff --git a/reactos/lib/smdll/testapi.c b/reactos/lib/smdll/testapi.c deleted file mode 100644 index cfb8b453dfd..00000000000 --- a/reactos/lib/smdll/testapi.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id$ */ -#define NTOS_MODE_USER -#include -#include - -VOID STDCALL SmPrintPortMessage (PSM_PORT_MESSAGE SmMessage) -{ - DbgPrint ("SM_PORT_MESSAGE %08lx:\n", (ULONG) SmMessage); - DbgPrint (" Header:\n"); - DbgPrint (" MessageType = %u\n", SmMessage->Header.MessageType); - DbgPrint (" DataSize = %d\n", SmMessage->Header.DataSize); - DbgPrint (" MessageSize = %d\n", SmMessage->Header.MessageSize); - DbgPrint (" ApiIndex = %ld\n", SmMessage->ApiIndex); - DbgPrint (" Status = %08lx\n", SmMessage->Status); - DbgPrint (" ExecPgm:\n"); - DbgPrint (" NameLength = %ld\n", SmMessage->ExecPgm.NameLength); - DbgPrint (" Name = %ls\n", (LPWSTR) & SmMessage->ExecPgm.Name); -} -/* EOF */ - diff --git a/reactos/lib/smlib/compses.c b/reactos/lib/smlib/compses.c index f4b43166e2b..54542380583 100644 --- a/reactos/lib/smlib/compses.c +++ b/reactos/lib/smlib/compses.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #define NDEBUG @@ -42,20 +41,20 @@ SmCompleteSession (IN HANDLE hSmApiPort, DPRINT("SMLIB: %s called\n", __FUNCTION__); /* Marshal Ses in the LPC message */ - SmReqMsg.CompSes.hApiPort = hApiPort; - SmReqMsg.CompSes.hSbApiPort = hSbApiPort; + SmReqMsg.Request.CompSes.hApiPort = hApiPort; + SmReqMsg.Request.CompSes.hSbApiPort = hSbApiPort; /* SM API to invoke */ - SmReqMsg.ApiIndex = SM_API_COMPLETE_SESSION; + SmReqMsg.SmHeader.ApiIndex = SM_API_COMPLETE_SESSION; /* Port message */ SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; - SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.CompSes); + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); if (NT_SUCCESS(Status)) { - return SmReqMsg.Status; + return SmReqMsg.SmHeader.Status; } DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); return Status; diff --git a/reactos/lib/smlib/connect.c b/reactos/lib/smlib/connect.c index ce6f1353b68..dfd5925cbf6 100644 --- a/reactos/lib/smlib/connect.c +++ b/reactos/lib/smlib/connect.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #include @@ -25,26 +24,34 @@ * ARGUMENTS * pSbApiPortName: name of the Sb port the calling subsystem * server already created in the system name space; - * hSbApiPort: LPC port handle (checked, but not used); - * dwSubsystem: a valid IMAGE_SUBSYSTEM_xxx value; + * hSbApiPort: LPC port handle (checked, but not used: the + * subsystem is required to have already created + * the callback port before it connects to the SM); + * wSubsystem: a valid IMAGE_SUBSYSTEM_xxx value; * phSmApiPort: a pointer to a HANDLE, which will be * filled with a valid client-side LPC comm port. + * + * There should be only two ways to call this API: + * a) subsystems willing to register with SM will use it + * with full parameters (the function checks them); + * b) regular SM clients, will set to 0 the 1st, the 2nd, + * and the 3rd parameter. * * RETURN VALUE * If all three optional values are omitted, an LPC status. * STATUS_INVALID_PARAMETER_MIX if PortName is defined and - * both hSbApiPort and dwSubsystem are 0. + * both hSbApiPort and wSubsystem are 0. */ NTSTATUS STDCALL SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, IN HANDLE hSbApiPort OPTIONAL, - IN DWORD dwSubsystem OPTIONAL, + IN WORD wSubSystemId OPTIONAL, IN OUT PHANDLE phSmApiPort) { UNICODE_STRING SmApiPortName; SECURITY_QUALITY_OF_SERVICE SecurityQos; NTSTATUS Status = STATUS_SUCCESS; - SM_CONNECT_DATA ConnectData = {0,{0}}; + SM_CONNECT_DATA ConnectData = {0,0,{0}}; ULONG ConnectDataLength = 0; DPRINT("SMLIB: %s called\n", __FUNCTION__); @@ -55,12 +62,13 @@ SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL, { return STATUS_INVALID_PARAMETER_1; } - if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == dwSubsystem) + if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == wSubSystemId) { return STATUS_INVALID_PARAMETER_MIX; } RtlZeroMemory (& ConnectData, sizeof ConnectData); - ConnectData.Subsystem = dwSubsystem; + ConnectData.Unused = 0; + ConnectData.SubSystemId = wSubSystemId; if (pSbApiPortName->Length > 0) { RtlCopyMemory (& ConnectData.SbName, diff --git a/reactos/lib/smlib/execpgm.c b/reactos/lib/smlib/execpgm.c index 75b7aaf58ff..fd29e70ede7 100644 --- a/reactos/lib/smlib/execpgm.c +++ b/reactos/lib/smlib/execpgm.c @@ -7,7 +7,6 @@ */ #define NTOS_MODE_USER #include -#include #include #include @@ -41,7 +40,8 @@ SmExecuteProgram (IN HANDLE hSmApiPort, SM_PORT_MESSAGE SmReqMsg; - DPRINT("SMLIB: %s called\n", __FUNCTION__); + DPRINT("SMLIB: %s(%08lx,'%S') called\n", + __FUNCTION__, hSmApiPort, Pgm->Buffer); /* Check Pgm's length */ if (Pgm->Length > (sizeof (Pgm->Buffer[0]) * SM_EXEXPGM_MAX_LENGTH)) @@ -50,24 +50,35 @@ SmExecuteProgram (IN HANDLE hSmApiPort, } /* Marshal Pgm in the LPC message */ RtlZeroMemory (& SmReqMsg, sizeof SmReqMsg); - SmReqMsg.ExecPgm.NameLength = Pgm->Length; - RtlCopyMemory (SmReqMsg.ExecPgm.Name, + SmReqMsg.Request.ExecPgm.NameLength = Pgm->Length; + RtlCopyMemory (SmReqMsg.Request.ExecPgm.Name, Pgm->Buffer, Pgm->Length); /* SM API to invoke */ - SmReqMsg.ApiIndex = SM_API_EXECUTE_PROGRAMME; + SmReqMsg.SmHeader.ApiIndex = SM_API_EXECUTE_PROGRAMME; /* LPC message */ SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE; - SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.ExecPgm); + SmReqMsg.Header.DataSize = SM_PORT_DATA_SIZE(SmReqMsg.Request); SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE; + DPRINT("SMLIB: %s:\n" + " MessageType = %d\n" + " DataSize = %d\n" + " MessageSize = %d\n" + " sizeof(LPC_MESSAGE)==%d\n", + __FUNCTION__, + SmReqMsg.Header.MessageType, + SmReqMsg.Header.DataSize, + SmReqMsg.Header.MessageSize, + sizeof(LPC_MESSAGE)); + /* Call SM and wait for a reply */ Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg); if (NT_SUCCESS(Status)) { - return SmReqMsg.Status; + return SmReqMsg.SmHeader.Status; } DPRINT("SMLIB: %s failed (Status=0x%08lx)\n", __FUNCTION__, Status); return Status; diff --git a/reactos/subsys/smss/client.c b/reactos/subsys/smss/client.c index 33dc6bf5477..d0efa95663d 100644 --- a/reactos/subsys/smss/client.c +++ b/reactos/subsys/smss/client.c @@ -166,14 +166,14 @@ SmCreateClient(PSM_PORT_MESSAGE Request, PSM_CLIENT_DATA * ClientData) /* * Check if a client for the ID already exist. */ - if (SmpLookupClient(ConnectData->Subsystem)) + if (SmpLookupClient(ConnectData->SubSystemId)) { DPRINT("SM: %s: attempt to register again subsystem %d.\n", __FUNCTION__, - ConnectData->Subsystem); + ConnectData->SubSystemId); return STATUS_UNSUCCESSFUL; } - DPRINT("SM: %s: registering subsystem %d \n", __FUNCTION__, ConnectData->Subsystem); + DPRINT("SM: %s: registering subsystem ID=%d \n", __FUNCTION__, ConnectData->SubSystemId); /* * Allocate the storage for client data */ @@ -188,7 +188,7 @@ SmCreateClient(PSM_PORT_MESSAGE Request, PSM_CLIENT_DATA * ClientData) /* * Initialize the client data */ - pClient->SubsystemId = ConnectData->Subsystem; + pClient->SubsystemId = ConnectData->SubSystemId; /* SM auto-initializes; other subsystems are required to call * SM_API_COMPLETE_SESSION via SMDLL. */ pClient->Initialized = (IMAGE_SUBSYSTEM_NATIVE == pClient->SubsystemId); diff --git a/reactos/subsys/smss/smapi.c b/reactos/subsys/smss/smapi.c index a1578507f7e..b514546c765 100644 --- a/reactos/subsys/smss/smapi.c +++ b/reactos/subsys/smss/smapi.c @@ -21,7 +21,7 @@ static HANDLE SmApiPort = INVALID_HANDLE_VALUE; SMAPI(SmInvalid) { DPRINT("SM: %s called\n",__FUNCTION__); - Request->Status = STATUS_NOT_IMPLEMENTED; + Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED; return STATUS_SUCCESS; } @@ -67,10 +67,12 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request, PSM_CONNECT_DATA ConnectData = SmpGetConnectData (Request); UNICODE_STRING CallbackPortName; ULONG CallbackPortNameLength = SM_SB_NAME_MAX_LENGTH; /* TODO: compute length */ + SB_CONNECT_DATA SbConnectData; + ULONG SbConnectDataLength = sizeof SbConnectData; DPRINT("SM: %s called\n", __FUNCTION__); - if(IMAGE_SUBSYSTEM_NATIVE == ConnectData->Subsystem) + if(IMAGE_SUBSYSTEM_NATIVE == ConnectData->SubSystemId) { DPRINT("SM: %s: we do not need calling back SM!\n", __FUNCTION__); @@ -81,14 +83,16 @@ SmpCallbackServer (PSM_PORT_MESSAGE Request, CallbackPortNameLength); RtlInitUnicodeString (& CallbackPortName, ClientData->SbApiPortName); + + SbConnectData.SmApiMax = (sizeof SmApi / sizeof SmApi[0]); Status = NtConnectPort (& ClientData->SbApiPort, & CallbackPortName, NULL, NULL, NULL, NULL, - NULL, - NULL); + & SbConnectData, + & SbConnectDataLength); return Status; } @@ -138,13 +142,13 @@ SmpApiConnectedThread(PVOID pConnectedPort) Reply = NULL; break; default: - if ((Request.ApiIndex) && - (Request.ApiIndex < (sizeof SmApi / sizeof SmApi[0]))) + if ((Request.SmHeader.ApiIndex) && + (Request.SmHeader.ApiIndex < (sizeof SmApi / sizeof SmApi[0]))) { - Status = SmApi[Request.ApiIndex](&Request); + Status = SmApi[Request.SmHeader.ApiIndex](&Request); Reply = (PLPC_MESSAGE) & Request; } else { - Request.Status = STATUS_NOT_IMPLEMENTED; + Request.SmHeader.Status = STATUS_NOT_IMPLEMENTED; Reply = (PLPC_MESSAGE) & Request; } } @@ -181,11 +185,11 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) PVOID Context = NULL; DPRINT("SM: %s called:\n SubSystemID=%d\n SbName=\"%S\"\n", - __FUNCTION__, ConnectData->Subsystem, ConnectData->SbName); + __FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName); if(sizeof (SM_CONNECT_DATA) == Request->Header.DataSize) { - if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->Subsystem) + if(IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->SubSystemId) { /* * This is not a call to register an image set, @@ -202,9 +206,9 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) * Reject GUIs classes: only odd subsystem IDs are * allowed to register here (tty mode images). */ - if(1 == (ConnectData->Subsystem % 2)) + if(1 == (ConnectData->SubSystemId % 2)) { - DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->Subsystem); + DPRINT("SM: %s: id = %d\n", __FUNCTION__, ConnectData->SubSystemId); /* * SmCreateClient/2 is called here explicitly to *fail*. * If it succeeds, there is something wrong in the @@ -236,7 +240,7 @@ SmpHandleConnectionRequest (PSM_PORT_MESSAGE Request) } else { DPRINT("SM: %s: SmpCallbackServer failed (Status=%08lx)\n", __FUNCTION__, Status); - Status = SmDestroyClient (ConnectData->Subsystem); + Status = SmDestroyClient (ConnectData->SubSystemId); } } } diff --git a/reactos/subsys/smss/smapicomp.c b/reactos/subsys/smss/smapicomp.c index 52ef9613954..94abeb96ef1 100644 --- a/reactos/subsys/smss/smapicomp.c +++ b/reactos/subsys/smss/smapicomp.c @@ -36,15 +36,12 @@ SMAPI(SmCompSes) { NTSTATUS Status = STATUS_SUCCESS; - DPRINT("SM: %s called from [%lx|%lx]\n", - __FUNCTION__, - Request->ClientId.UniqueProcessId, - Request->ClientId.UniqueThreadId); + DPRINT("SM: %s called\n", __FUNCTION__); Status = SmCompleteClientInitialization (Request->Header.ClientId.UniqueProcess); if(!NT_SUCCESS(Status)) { - Request->Status = STATUS_UNSUCCESSFUL; + Request->SmHeader.Status = STATUS_UNSUCCESSFUL; } return Status; } diff --git a/reactos/subsys/smss/smapiexec.c b/reactos/subsys/smss/smapiexec.c index 7efc800b110..f74ac34b3b9 100644 --- a/reactos/subsys/smss/smapiexec.c +++ b/reactos/subsys/smss/smapiexec.c @@ -253,7 +253,7 @@ SMAPI(SmExecPgm) DPRINT("SM: %s called from CID(%lx|%lx)\n", __FUNCTION__, Request->Header.ClientId.UniqueProcess, Request->Header.ClientId.UniqueThread); - ExecPgm = & Request->ExecPgm; + ExecPgm = & Request->Request.ExecPgm; /* Check if the name lenght is valid */ if((ExecPgm->NameLength > 0) && (ExecPgm->NameLength <= SM_EXEXPGM_MAX_LENGTH) && @@ -277,7 +277,7 @@ SMAPI(SmExecPgm) * independent process; now it is embedded in the * SM for performance or security. */ - Request->Status = SmInitializeDbgSs(); + Request->SmHeader.Status = SmInitializeDbgSs(); } else { @@ -299,20 +299,20 @@ SMAPI(SmExecPgm) wcscat (ImagePath, Data); /* Create native process */ - Request->Status = SmCreateUserProcess(ImagePath, + Request->SmHeader.Status = SmCreateUserProcess(ImagePath, L"", /* FIXME */ FALSE, /* wait */ NULL, FALSE, /* terminate */ NULL); }else{ - Request->Status = Status; + Request->SmHeader.Status = Status; } } } else { - Request->Status = Status = STATUS_INVALID_PARAMETER; + Request->SmHeader.Status = Status = STATUS_INVALID_PARAMETER; } return Status; } diff --git a/reactos/subsys/smss/smapiquery.c b/reactos/subsys/smss/smapiquery.c index e93e593405a..4172231c60b 100644 --- a/reactos/subsys/smss/smapiquery.c +++ b/reactos/subsys/smss/smapiquery.c @@ -38,7 +38,7 @@ SMAPI(SmQryInfo) DPRINT("SM: %s called\n", __FUNCTION__); - Request->Status = STATUS_NOT_IMPLEMENTED; + Request->SmHeader.Status = STATUS_NOT_IMPLEMENTED; return Status; }