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

Method __init__

windows/alpc.py:25–44  ·  view source on GitHub ↗
(self, msg_or_size=DEFAULT_MESSAGE_SIZE, attributes=None)

Source from the content-addressed store, hash-verified

23 """Represent a full ALPC Message: a :class:`AlpcMessagePort` and a :class:`MessageAttribute`"""
24 # PORT_MESSAGE + MessageAttribute
25 def __init__(self, msg_or_size=DEFAULT_MESSAGE_SIZE, attributes=None):
26 # Init the PORT_MESSAGE
27 if isinstance(msg_or_size, windows.pycompat.int_types):
28 self.port_message_buffer_size = msg_or_size
29 self.port_message_raw_buffer = ctypes.c_buffer(msg_or_size)
30 self.port_message = AlpcMessagePort.from_buffer(self.port_message_raw_buffer)
31 self.port_message.set_datalen(0)
32 elif isinstance(msg_or_size, AlpcMessagePort):
33 self.port_message = msg_or_size
34 self.port_message_raw_buffer = self.port_message.raw_buffer
35 self.port_message_buffer_size = len(self.port_message_raw_buffer)
36 else:
37 raise NotImplementedError("Uneexpected type for <msg_or_size>: {0}".format(msg_or_size))
38
39 # Init the MessageAttributes
40 if attributes is None:
41 # self.attributes = MessageAttribute.with_all_attributes()
42 self.attributes = MessageAttribute.with_all_attributes() ## Testing
43 else:
44 self.attributes = attributes
45
46 # PORT_MESSAGE wrappers
47 @property

Callers

nothing calls this directly

Calls 3

set_datalenMethod · 0.80
with_all_attributesMethod · 0.80
from_bufferMethod · 0.45

Tested by

no test coverage detected