summaryrefslogtreecommitdiffstats
path: root/private/nullsrv/server/nullloop.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/nullsrv/server/nullloop.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/nullsrv/server/nullloop.c')
-rw-r--r--private/nullsrv/server/nullloop.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/private/nullsrv/server/nullloop.c b/private/nullsrv/server/nullloop.c
new file mode 100644
index 000000000..53c297543
--- /dev/null
+++ b/private/nullsrv/server/nullloop.c
@@ -0,0 +1,105 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ nullloop.c
+
+Abstract:
+
+ Session Manager Listen and API loops
+
+Author:
+
+ Mark Lucovsky (markl) 04-Oct-1989
+
+Revision History:
+
+--*/
+
+#include "nullsrvp.h"
+
+
+PNULLAPI NullSrvApiDispatch[NullMaxApiNumber] = {
+ NullSrvNull1,
+ NullSrvNull4,
+ NullSrvNull8,
+ NullSrvNull16
+ };
+
+
+#if DBG
+PSZ NullSrvApiName[ NullMaxApiNumber+1 ] = {
+ "NullSrvNull1",
+ "NullSrvNull4",
+ "NullSrvNull8",
+ "NullSrvNull16",
+ "Unknown Sm Api Number"
+};
+#endif // DBG
+
+NTSTATUS
+NullSrvApiLoop (
+ IN PVOID ThreadParameter
+ )
+
+{
+ PNULLAPIMSG ApiReplyMsg;
+ NULLAPIMSG ApiMsg;
+ NTSTATUS Status;
+ HANDLE ConnectionPort,CommunicationPort;
+
+ ConnectionPort = (HANDLE) ThreadParameter;
+
+ ApiReplyMsg = NULL;
+ for(;;) {
+
+ Status = NtReplyWaitReceivePort(
+ ConnectionPort,
+ NULL,
+ (PPORT_MESSAGE) ApiReplyMsg,
+ (PPORT_MESSAGE) &ApiMsg
+ );
+
+ if ( !NT_SUCCESS(Status) ) {
+ ApiReplyMsg = NULL;
+ continue;
+ }
+ else if ( ApiMsg.h.u2.s2.Type == LPC_CONNECTION_REQUEST ) {
+ Status = NtAcceptConnectPort(
+ &CommunicationPort,
+ NULL,
+ &ApiMsg,
+ TRUE,
+ NULL,
+ NULL
+ );
+ if (!NT_SUCCESS(Status)) {
+ printf("NtAccept Failed %x\n",Status);
+ ExitProcess(1);
+ }
+
+ Status = NtCompleteConnectPort(CommunicationPort);
+ if (!NT_SUCCESS(Status)) {
+ printf("NtAccept Failed %x\n",Status);
+ ExitProcess(1);
+ }
+ ApiReplyMsg = NULL;
+ }
+ else if ( ApiMsg.h.u2.s2.Type == LPC_PORT_CLOSED ) {
+ ApiReplyMsg = NULL;
+ }
+ else {
+ Status = (NullSrvApiDispatch[ApiMsg.ApiNumber])(&ApiMsg);
+ ApiMsg.ReturnedStatus = Status;
+ ApiReplyMsg = &ApiMsg;
+ }
+ }
+
+ //
+ // Make the compiler happy
+ //
+
+ return STATUS_UNSUCCESSFUL;
+}