((ServerDll->ValidTable) && !(ServerDll->ValidTable[ApiId])))
{
/* We are beyond the Maximum API ID, or it doesn't exist */
+ DPRINT1("API: %d\n", ApiId);
+#ifdef CSR_DBG
DPRINT1("CSRSS: %lx (%s) is invalid ApiTableIndex for %Z or is an "
"invalid API to call from the server.\n",
- ServerDll->ValidTable[ApiId],
+ ApiId,
((ServerDll->NameTable) && (ServerDll->NameTable[ApiId])) ?
- ServerDll->NameTable[ApiId] : "*** UNKNOWN ***", &ServerDll->Name);
+ ServerDll->NameTable[ApiId] : "*** UNKNOWN ***",
+ &ServerDll->Name);
+#endif
// DbgBreakPoint();
ReplyMsg->Status = STATUS_ILLEGAL_FUNCTION;
return STATUS_ILLEGAL_FUNCTION;
}
}
+#ifdef CSR_DBG
if (CsrDebug & 2)
{
DPRINT1("CSRSS: %s Api Request received from server process\n",
ServerDll->NameTable[ApiId]);
}
+#endif
/* Validation complete, start SEH */
_SEH2_TRY
Status = CsrSrvAttachSharedSection(CsrProcess, ConnectInfo);
/* Check how this went */
- if (NT_SUCCESS(Status)) AllowConnection = TRUE;
+ if (NT_SUCCESS(Status))
+ {
+ /* Allow the connection, and return debugging flag */
+ ConnectInfo->DebugFlags = CsrDebug;
+ AllowConnection = TRUE;
+ }
}
/* Dereference the project */
RemotePortView.ViewBase = NULL;
/* Save the Process ID */
- ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
+ ConnectInfo->ServerProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
/* Accept the Connection */
Status = NtAcceptConnectPort(&ServerPort,
continue;
}
+#ifdef CSR_DBG
if (CsrDebug & 2)
{
DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x\n",
ServerDll->NameTable[ApiId],
NULL);
}
+#endif
/* Assume success */
ReceiveMsg.Status = STATUS_SUCCESS;
continue;
}
+#ifdef CSR_DBG
if (CsrDebug & 2)
{
DPRINT1("[%02x] CSRSS: [%02x,%02x] - %s Api called from %08x, Process %08x - %08x\n",
CsrThread->Process,
CsrProcess);
}
+#endif
/* Assume success */
ReplyMsg = &ReceiveMsg;
NTAPI
CsrConnectToUser(VOID)
{
-#if 0 // FIXME: This code is OK, however it is ClientThreadSetup which sucks.
NTSTATUS Status;
ANSI_STRING DllName;
UNICODE_STRING TempName;
/* Return it */
return CsrThread;
-
-#else
-
- PTEB Teb = NtCurrentTeb();
- PCSR_THREAD CsrThread;
-
- /* Save pointer to this thread in TEB */
- CsrAcquireProcessLock();
- CsrThread = CsrLocateThreadInProcess(NULL, &Teb->ClientId);
- CsrReleaseProcessLock();
- if (CsrThread) Teb->CsrClientThread = CsrThread;
-
- /* Return it */
- return CsrThread;
-#endif
}
/*++