def __init__(self, buffer_size=1024):
"""Builds the tracing session properties.
Parameters
---------
buffer_size: int
the amount of memory allocated for each trace buffer
"""
# allocate buffer for the trace
self.max_string_len = 1024
self.buff_size = sizeof(EVENT_TRACE_PROPERTIES) + 2 * sizeof(c_wchar) * self.max_string_len
self._buff = (c_char * self.buff_size)()
self._props = cast(pointer(self._buff), POINTER(EVENT_TRACE_PROPERTIES))
# set trace properties
self._props.contents.wnode.buffer_size = self.buff_size
self._props.contents.wnode.guid = KERNEL_TRACE_CONTROL_GUID
self._props.contents.wnode.flags = WNODE_FLAG_TRACED_GUID
self._props.contents.logger_name_offset = sizeof(EVENT_TRACE_PROPERTIES)
self._props.contents.log_file_name_offset = 0
self._props.contents.log_file_mode = PROCESS_TRACE_MODE_REAL_TIME
self._props.contents.buffer_size = buffer_size
评论列表
文章目录