* Reactos Session Manager
*
*/
-
#include "smss.h"
-#include <rosrtl/string.h>
#define NDEBUG
#include <debug.h>
SmQryInfo /* smapyqry.c */
};
-/* TODO: optimize this address computation (it should be done
+/* TODO: optimize this address computation (it should be done
* with a macro) */
PSM_CONNECT_DATA FASTCALL SmpGetConnectData (PSM_PORT_MESSAGE Request)
{
#endif
/**********************************************************************
- * SmpCallback/2
+ * SmpCallbackServer/2
*
- * The SM calls back a previously connected subsystem process to
- * authorizes it to bootstrap (initialize). The SM connects to a
- * named LPC port which name was sent in the connection data by the
- * candidate subsystem server process.
+ * DESCRIPTION
+ * The SM calls back a previously connected subsystem process to
+ * authorize it to bootstrap (initialize). The SM connects to a
+ * named LPC port which name was sent in the connection data by
+ * the candidate subsystem server process.
*/
static NTSTATUS
SmpCallbackServer (PSM_PORT_MESSAGE Request,
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->SubSystemId)
+ if ( (IMAGE_SUBSYSTEM_UNKNOWN == ConnectData->SubSystemId) ||
+ (IMAGE_SUBSYSTEM_NATIVE == ConnectData->SubSystemId))
{
DPRINT("SM: %s: we do not need calling back SM!\n",
__FUNCTION__);
HANDLE hClientDataApiPortThread = (HANDLE) 0;
PHANDLE ClientDataApiPortThread = & hClientDataApiPortThread;
PVOID Context = NULL;
-
+
DPRINT("SM: %s called:\n SubSystemID=%d\n SbName=\"%S\"\n",
__FUNCTION__, ConnectData->SubSystemId, ConnectData->SbName);
{
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
- * connection request. An environment subsystem *never*
- * registers twice. (security issue)
+ * SmBeginClientInitialization/2 will succeed only if there
+ * is a candidate client ready.
*/
- Status = SmCreateClient (Request, & ClientData);
+ Status = SmBeginClientInitialization (Request, & ClientData);
if(STATUS_SUCCESS == Status)
{
DPRINT("SM: %s: ClientData = 0x%08lx\n",
ClientDataApiPortThread = & ClientData->ApiPortThread;
/*
* Call back the candidate environment subsystem
- * server (use the port name sent in in the
+ * server (use the port name sent in in the
* connection request message).
*/
Status = SmpCallbackServer (Request, ClientData);
NULL,
FALSE,
0,
- NULL,
- NULL,
+ 0,
+ 0,
(PTHREAD_START_ROUTINE) SmpApiConnectedThread,
ClientDataApiPort,
ClientDataApiPortThread,
*
* DECRIPTION
* Due to differences in LPC implementation between NT and ROS,
- * we need a thread to listen for connection request that
+ * we need a thread to listen to for connection request that
* creates a new thread for each connected port. This is not
* necessary in NT LPC, because server side connected ports are
- * never used to receive requests.
+ * never used to receive requests.
*/
VOID STDCALL
SmpApiThread (HANDLE ListeningPort)
LPC_MAX_MESSAGE Request = {{0}};
DPRINT("SM: %s called\n", __FUNCTION__);
-
+
while (TRUE)
{
Status = NtListenPort (ListeningPort, & Request.Header);
SmCreateApiPort(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes = {0};
- UNICODE_STRING UnicodeString = {0};
+ UNICODE_STRING UnicodeString = RTL_CONSTANT_STRING(L"\\SmApiPort");
NTSTATUS Status = STATUS_SUCCESS;
- RtlRosInitUnicodeStringFromLiteral(&UnicodeString,
- L"\\SmApiPort");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
- PORT_ALL_ACCESS,
+ 0,
NULL,
NULL);
NULL,
FALSE,
0,
- NULL,
- NULL,
+ 0,
+ 0,
(PTHREAD_START_ROUTINE)SmpApiThread,
(PVOID)SmApiPort,
NULL,