ServerSbApiPortThread (HANDLE hSbApiPortListen)
{
HANDLE hConnectedPort = (HANDLE) 0;
- PORT_MESSAGE Request;
+ SB_API_MSG Request;
PVOID Context = NULL;
NTSTATUS Status = STATUS_SUCCESS;
PPORT_MESSAGE Reply = NULL;
DPRINT("CSR: %s called\n", __FUNCTION__);
RtlZeroMemory(&Request, sizeof(PORT_MESSAGE));
- Status = NtListenPort (hSbApiPortListen, & Request);
+ Status = NtListenPort (hSbApiPortListen, & Request.h);
if (!NT_SUCCESS(Status))
{
DPRINT("-- 1\n");
Status = NtAcceptConnectPort(&hConnectedPort,
NULL,
- &Request,
+ &Request.h,
TRUE,
NULL,
NULL);
Status = NtReplyWaitReceivePort(hConnectedPort,
Context,
Reply,
- &Request);
+ &Request.h);
if(!NT_SUCCESS(Status))
{
DPRINT1("CSR: %s: NtReplyWaitReceivePort failed (Status=0x%08lx)\n",
break;
}
- switch (Request.u2.s2.Type) //fix .h PORT_MESSAGE_TYPE(Request))
+ switch (Request.h.u2.s2.Type) //fix .h PORT_MESSAGE_TYPE(Request))
{
/* TODO */
+ case LPC_PORT_CLOSED:
+ case LPC_CLIENT_DIED:
+ DPRINT1("CSR: SMSS died\n");
+ Reply = NULL;
+ break;
+
default:
DPRINT1("CSR: %s received message (type=%d)\n",
- __FUNCTION__, Request.u2.s2.Type);
+ __FUNCTION__, Request.h.u2.s2.Type);
+
+ if (Request.ApiNumber == SbpCreateSession)
+ {
+ DPRINT("Session create... legacy CSRSS resuming thread as minimum work done\n");
+ Request.ReturnValue = NtResumeThread(Request.CreateSession.ProcessInfo.ThreadHandle, NULL);
+ }
+ else
+ {
+ DPRINT1("CSR: %d Not implemented in legacy CSRSS... faking success\n", Request.ApiNumber);
+ Request.ReturnValue = STATUS_SUCCESS;
+ }
+ Reply = &Request.h;
}
DPRINT("-- 5\n");
}
NULL);
Status = NtCreatePort ( Port,
& PortAttributes,
- LPC_MAX_DATA_LENGTH, /* TODO: make caller set it*/
- LPC_MAX_MESSAGE_LENGTH, /* TODO: make caller set it*/
- 0); /* TODO: make caller set it*/
+ sizeof(SB_CONNECTION_INFO),
+ sizeof(SB_API_MSG),
+ 32 * sizeof(SB_API_MSG));
if(!NT_SUCCESS(Status))
{
DPRINT1("CSR: %s: NtCreatePort failed (Status=%08lx)\n",
/**********************************************************************
* CsrpRegisterSubsystem/3
*/
+BOOLEAN g_ModernSm;
static NTSTATUS
CsrpRegisterSubsystem (int argc, char ** argv, char ** envp)
{
hSbApiPort,
IMAGE_SUBSYSTEM_WINDOWS_CUI,
& hSmApiPort);
+ if (!NT_SUCCESS(Status))
+ {
+ Status = SmConnectToSm(&Name, hSbApiPort, IMAGE_SUBSYSTEM_WINDOWS_GUI, &hSmApiPort);
+ g_ModernSm = TRUE;
+ }
if(!NT_SUCCESS(Status))
{
DPRINT("CSR: %s unable to connect to the SM (Status=0x%08lx)\n",
DPRINT("CSR: %s called\n", __FUNCTION__);
+ if (g_ModernSm) return STATUS_SUCCESS;
/* initialize the process parameters */
RtlInitUnicodeString (& ImagePath, L"\\SystemRoot\\system32\\winlogon.exe");
PCHAR ErrorMessage;
} InitRoutine [] = {
{TRUE, CsrpCreateBNODirectory, "create base named objects directory"},
- {TRUE, CsrpCreateCallbackPort, "create the callback port \\Windows\\SbApiPort"},
- {TRUE, CsrpRegisterSubsystem, "register with SM"},
{TRUE, CsrpCreateHeap, "create the CSR heap"},
{TRUE, CsrpCreateApiPort, "create the api port \\Windows\\ApiPort"},
{TRUE, CsrpCreateHardErrorPort, "create the hard error port"},
{TRUE, CsrpApiRegisterDef, "initialize api definitions"},
{TRUE, CsrpCCTS, "connect client to server"},
{TRUE, CsrpInitWin32Csr, "load usermode dll"},
+ {TRUE, CsrpCreateCallbackPort, "create the callback port \\Windows\\SbApiPort"},
+ {TRUE, CsrpRegisterSubsystem, "register with SM"},
{TRUE, CsrpRunWinlogon, "run WinLogon"},
};