本文整理汇总了Python中ctypes.wintypes.USHORT属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.USHORT属性的具体用法?Python wintypes.USHORT怎么用?Python wintypes.USHORT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ctypes.wintypes
的用法示例。
在下文中一共展示了wintypes.USHORT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import USHORT [as 别名]
def __init__(self, filter_in, events):
struct_size = len(events) * ct.sizeof(wt.USHORT) + ct.sizeof(EVENT_FILTER_EVENT_ID)
self._buf = (ct.c_char * struct_size)()
self._props = ct.cast(ct.pointer(self._buf), ct.POINTER(EVENT_FILTER_EVENT_ID))
self._props.contents.FilterIn = filter_in
self._props.contents.Reserved = 0
self._props.contents.Count = len(events)
for i in range(len(events)):
ct.memmove(ct.cast(ct.addressof(self._buf) + ct.sizeof(EVENT_FILTER_EVENT_ID) + (ct.sizeof(wt.WCHAR) * i),
ct.c_void_p),
ct.byref(wt.USHORT(events[i])),
ct.sizeof(wt.WCHAR))
示例2: test_etw_eq
# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import USHORT [as 别名]
def test_etw_eq(self):
"""
Test container classes comparision
:return: None
"""
params = et.ENABLE_TRACE_PARAMETERS()
params.Version = 1
other_params = et.ENABLE_TRACE_PARAMETERS()
other_params.Version = 1
provider = ProviderInfo('Microsoft-Windows-Kernel-Process',
GUID("{22FB2CD6-0E7B-422B-A0C7-2FAD1FD0E716}"),
any_keywords=['WINEVENT_KEYWORD_PROCESS'],
params=ct.pointer(params))
other_provider = ProviderInfo('Microsoft-Windows-Kernel-Process',
GUID("{22FB2CD6-0E7B-422B-A0C7-2FAD1FD0E716}"),
any_keywords=['WINEVENT_KEYWORD_PROCESS'],
params=ct.pointer(other_params))
self.assertEqual(provider, other_provider)
other_params.Version = 2
self.assertNotEqual(provider, other_provider)
event_id_list = [54]
event_filter = ep.EVENT_FILTER_EVENT_ID(common.TRUE, event_id_list).get()
event_filters = [ep.EVENT_FILTER_DESCRIPTOR(ct.addressof(event_filter.contents),
ct.sizeof(event_filter.contents) +
ct.sizeof(wt.USHORT) * len(event_id_list),
ep.EVENT_FILTER_TYPE_EVENT_ID)]
properties = ProviderParameters(0, event_filters)
other_properties = ProviderParameters(0, event_filters)
self.assertEqual(properties, other_properties)
other_properties.get().contents.Version = 1
self.assertNotEqual(properties, other_properties)
params = TraceProperties(1024, 1024, 0, 10)
other_params = TraceProperties(1024, 1024, 0, 10)
self.assertEqual(params, other_params)
other_params.get().contents.BufferSize = 1025
self.assertNotEqual(params, other_params)
return