#ifndef _NTLPCAPI_H
// Port connection (client)
NTSYSCALLAPI
NTSTATUS
NTAPI
NtConnectPort(
_Out_ PHANDLE PortHandle,
_In_ PUNICODE_STRING PortName,
_In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
_Inout_opt_ PPORT_VIEW ClientView,
_Inout_opt_ PREMOTE_PORT_VIEW ServerView,
_Out_opt_ PULONG MaxMessageLength,
_Inout_updates_bytes_to_opt_(*ConnectionInformationLength, *ConnectionInformationLength) PVOID ConnectionInformation,
_Inout_opt_ PULONG ConnectionInformationLength
);
View code on GitHub#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwConnectPort(
_Out_ PHANDLE PortHandle,
_In_ PUNICODE_STRING PortName,
_In_ PSECURITY_QUALITY_OF_SERVICE SecurityQos,
_Inout_opt_ PPORT_VIEW ClientView,
_Inout_opt_ PREMOTE_PORT_VIEW ServerView,
_Out_opt_ PULONG MaxMessageLength,
_Inout_updates_bytes_to_opt_(*ConnectionInformationLength, *ConnectionInformationLength) PVOID ConnectionInformation,
_Inout_opt_ PULONG ConnectionInformationLength
);
View code on GitHubNtConnectPort is used by client process for establish LPC connection with Named Port's owner.
Result of call - HANDLE to Port Object.
Name of port to connect to.
Used when calling process created Section Object for shared memory. See NtAcceptConnectPort for details.
Used when calling process didn't create Section Object. See NtAcceptConnectPort for details.
Maximum communication message length. This value is calculated by server on port creation process (see NtCreatePort).
Pointer to RAW buffer containing information from client. That information is received by server through LPC_MESSAGE with MessageType field set to LPC_CONNECTION_REQUEST.
Size of ConnectionInfo buffer, in bytes.
LPC_MESSAGELPC_SECTION_MEMORYLPC_SECTION_OWNER_MEMORYNtAcceptConnectPortNtCompleteConnectPortNtCreatePort