本文整理匯總了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