MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / accept_connection

Method accept_connection

windows/alpc.py:503–529  ·  view source on GitHub ↗

Accept the connection for a ``LPC_CONNECTION_REQUEST`` message. ``msg.MessageId`` must be the same as the connection requesting message. :param AlpcMessage msg: The response message. :param ALPC_PORT_ATTRIBUTES port_attr: The attributes of the port, one with defa

(self, msg, port_attr=None, port_context=None)

Source from the content-addressed store, hash-verified

501 self.handle = handle.value
502
503 def accept_connection(self, msg, port_attr=None, port_context=None):
504 """Accept the connection for a ``LPC_CONNECTION_REQUEST`` message.
505 ``msg.MessageId`` must be the same as the connection requesting message.
506
507 :param AlpcMessage msg: The response message.
508 :param ALPC_PORT_ATTRIBUTES port_attr: The attributes of the port, one with default value will be used if this parameter is ``None``
509 :param PVOID port_context: A value that will be copied in ``ALPC_CONTEXT_ATTR.PortContext`` of every message on this connection.
510
511 """
512 rhandle = gdef.HANDLE()
513
514 if port_attr is None:
515 port_attr = gdef.ALPC_PORT_ATTRIBUTES()
516 port_attr.Flags = 0x80000
517 # port_attr.Flags = 0x80000 + 0x2000000
518 # port_attr.Flags = 0x2000000
519 port_attr.MaxMessageLength = DEFAULT_MESSAGE_SIZE
520 port_attr.MemoryBandwidth = 0
521 port_attr.MaxPoolUsage = 0xffffffff
522 port_attr.MaxSectionSize = 0xffffffff
523 port_attr.MaxViewSize = 0xffffffff
524 port_attr.MaxTotalSectionSize = 0xffffffff
525 port_attr.DupObjectTypes = 0xffffffff
526 # windows.utils.print_ctypes_struct(port_attr, " - CONN_PORT_ATTR", hexa=True)
527 winproxy.NtAlpcAcceptConnectPort(rhandle, self.handle, 0, None, port_attr, port_context, msg.port_message, None, True)
528 self.communication_port_list.append(rhandle.value)
529 return msg
530
531 def disconnect(self):
532 if self.handle:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected