*/\r
#define NTOS_MODE_USER\r
#include <ntos.h>\r
-#include <sm/api.h>\r
#include <sm/helper.h>\r
#include <pe.h>\r
\r
* ARGUMENTS\r
* pSbApiPortName: name of the Sb port the calling subsystem\r
* server already created in the system name space;\r
- * hSbApiPort: LPC port handle (checked, but not used);\r
- * dwSubsystem: a valid IMAGE_SUBSYSTEM_xxx value;\r
+ * hSbApiPort: LPC port handle (checked, but not used: the\r
+ * subsystem is required to have already created\r
+ * the callback port before it connects to the SM);\r
+ * wSubsystem: a valid IMAGE_SUBSYSTEM_xxx value;\r
* phSmApiPort: a pointer to a HANDLE, which will be\r
* filled with a valid client-side LPC comm port.\r
+ *\r
+ * There should be only two ways to call this API:\r
+ * a) subsystems willing to register with SM will use it\r
+ * with full parameters (the function checks them);\r
+ * b) regular SM clients, will set to 0 the 1st, the 2nd,\r
+ * and the 3rd parameter.\r
* \r
* RETURN VALUE\r
* If all three optional values are omitted, an LPC status.\r
* STATUS_INVALID_PARAMETER_MIX if PortName is defined and\r
- * both hSbApiPort and dwSubsystem are 0.\r
+ * both hSbApiPort and wSubsystem are 0.\r
*/\r
NTSTATUS STDCALL\r
SmConnectApiPort (IN PUNICODE_STRING pSbApiPortName OPTIONAL,\r
IN HANDLE hSbApiPort OPTIONAL,\r
- IN DWORD dwSubsystem OPTIONAL,\r
+ IN WORD wSubSystemId OPTIONAL,\r
IN OUT PHANDLE phSmApiPort)\r
{\r
UNICODE_STRING SmApiPortName;\r
SECURITY_QUALITY_OF_SERVICE SecurityQos;\r
NTSTATUS Status = STATUS_SUCCESS;\r
- SM_CONNECT_DATA ConnectData = {0,{0}};\r
+ SM_CONNECT_DATA ConnectData = {0,0,{0}};\r
ULONG ConnectDataLength = 0;\r
\r
DPRINT("SMLIB: %s called\n", __FUNCTION__);\r
{\r
return STATUS_INVALID_PARAMETER_1;\r
}\r
- if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == dwSubsystem)\r
+ if (NULL == hSbApiPort || IMAGE_SUBSYSTEM_UNKNOWN == wSubSystemId)\r
{\r
return STATUS_INVALID_PARAMETER_MIX;\r
}\r
RtlZeroMemory (& ConnectData, sizeof ConnectData);\r
- ConnectData.Subsystem = dwSubsystem;\r
+ ConnectData.Unused = 0;\r
+ ConnectData.SubSystemId = wSubSystemId;\r
if (pSbApiPortName->Length > 0)\r
{\r
RtlCopyMemory (& ConnectData.SbName,\r