6#include <rosrtl/string.h>
15static const char *
MyName =
"LPC-SRV";
39 LPC_MAX_MESSAGE ConnectMsg;
64 printf(
"%s: Listening for connections requests on port 0x%x...\n",
MyName, NamedPortHandle);
73 printf(
"%s: Received connection request 0x%08x on port 0x%x.\n",
MyName,
74 ConnectMsg.Header.MessageId, NamedPortHandle);
76 ConnectMsg.Header.ClientId.UniqueProcess, ConnectMsg.Header.ClientId.UniqueThread);
78 printf(
"%s: Accepting connection request 0x%08x...\n",
MyName,
79 ConnectMsg.Header.MessageId);
91 printf(
"%s: Connection request 0x%08x accepted as port 0x%x.\n",
MyName,
92 ConnectMsg.Header.MessageId, PortHandle);
94 printf(
"%s: Completing connection for port 0x%x (0x%08x).\n",
MyName,
95 PortHandle, ConnectMsg.Header.MessageId);
103 printf(
"%s: Entering server loop for port 0x%x...\n",
MyName, PortHandle);
114 printf(
"%s: NtReplyWaitReceivePort() failed with status = 0x%08lX.\n",
MyName,
Status);
120 printf(
"%s: Datagram message contents are <%s>.\n",
126 printf(
"%s: Message with type %d received on port 0x%x.\n",
MyName,
127 PORT_MESSAGE_TYPE(
Request), PortHandle);
129 printf(
"%s: Connected port 0x%x closed.\n\n",
MyName, PortHandle);
static UNICODE_STRING PortName
ACPI_SIZE strlen(const char *String)
NTSTATUS NTAPI NtAcceptConnectPort(OUT PHANDLE PortHandle, IN PVOID PortContext OPTIONAL, IN PPORT_MESSAGE ReplyMessage, IN BOOLEAN AcceptConnection, IN OUT PPORT_VIEW ServerView OPTIONAL, OUT PREMOTE_PORT_VIEW ClientView OPTIONAL)
NTSTATUS NTAPI NtCompleteConnectPort(IN HANDLE PortHandle)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
BOOL WINAPI DECLSPEC_HOTPATCH WriteConsoleA(IN HANDLE hConsoleOutput, IN CONST VOID *lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved)
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
void debug_printf(char *fmt,...)
static const char * MyName
#define InitializeObjectAttributes(p, n, a, r, s)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSTATUS NTAPI NtCreatePort(OUT PHANDLE PortHandle, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG MaxConnectInfoLength, IN ULONG MaxDataLength, IN ULONG MaxPoolUsage)
NTSTATUS NTAPI NtListenPort(IN HANDLE PortHandle, OUT PPORT_MESSAGE ConnectMessage)
NTSTATUS NTAPI NtReplyWaitReceivePort(IN HANDLE PortHandle, OUT PVOID *PortContext OPTIONAL, IN PPORT_MESSAGE ReplyMessage OPTIONAL, OUT PPORT_MESSAGE ReceiveMessage)