本文整理汇总了Python中ctypes.wintypes方法的典型用法代码示例。如果您正苦于以下问题:Python ctypes.wintypes方法的具体用法?Python ctypes.wintypes怎么用?Python ctypes.wintypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块ctypes的用法示例。
在下文中一共展示了ctypes.wintypes方法的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _is_gui_available
点赞 7
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import wintypes [as 别名]
def _is_gui_available():
UOI_FLAGS = 1
WSF_VISIBLE = 0x0001
class USEROBJECTFLAGS(ctypes.Structure):
_fields_ = [("fInherit", ctypes.wintypes.BOOL),
("fReserved", ctypes.wintypes.BOOL),
("dwFlags", ctypes.wintypes.DWORD)]
dll = ctypes.windll.user32
h = dll.GetProcessWindowStation()
if not h:
raise ctypes.WinError()
uof = USEROBJECTFLAGS()
needed = ctypes.wintypes.DWORD()
res = dll.GetUserObjectInformationW(h,
UOI_FLAGS,
ctypes.byref(uof),
ctypes.sizeof(uof),
ctypes.byref(needed))
if not res:
raise ctypes.WinError()
return bool(uof.dwFlags & WSF_VISIBLE)
开发者ID:war-and-code,项目名称:jawfish,代码行数:23,
示例2: get_window_thread_process_id
点赞 6
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import wintypes [as 别名]
def get_window_thread_process_id(window_obj):
"""A nice wrapper for GetWindowThreadProcessId(). Returns a tuple of the
thread id (tid) of the thread that created the specified window, and the
process id that created the window.
Syntax:
DWORD GetWindowThreadProcessId(
HWND hWnd,
LPDWORD lpdwProcessId
);
Microsoft Documentation:
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowthreadprocessid
"""
pid = wintypes.DWORD()
tid = ctypes.windll.user32.GetWindowThreadProcessId(window_obj.hWnd, ctypes.byref(pid))
return tid, pid.value
开发者ID:asweigart,项目名称:nicewin,代码行数:19,
示例3: _create_windows
点赞 6
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import wintypes [as 别名]
def _create_windows(source, destination, link_type):
"""Creates hardlink at destination from source in Windows."""
if link_type == HARDLINK:
import ctypes
from ctypes.wintypes import BOOL
CreateHardLink = ctypes.windll.kernel32.CreateHardLinkW
CreateHardLink.argtypes = [
ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_void_p
]
CreateHardLink.restype = BOOL
res = CreateHardLink(destination, source, None)
if res == 0:
raise ctypes.WinError()
else:
raise NotImplementedError("Link type unrecognized.")
开发者ID:getavalon,项目名称:core,代码行数:19,
示例4: open_device
点赞 6
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import wintypes [as 别名]
def open_device(self, access=GENERIC_READ | GENERIC_WRITE, mode=0, creation=OPEN_EXISTING, flags=FILE_ATTRIBUTE_NORMAL):
"""See: CreateFile function
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
"""
CreateFile_Fn = ctypes.windll.kernel32.CreateFileA
CreateFile_Fn.argtypes = [
wintypes.LPCSTR, # _In_ LPCTSTR lpFileName
wintypes.DWORD, # _In_ DWORD dwDesiredAccess
wintypes.DWORD, # _In_ DWORD dwShareMode
LPSECURITY_ATTRIBUTES, # _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes
wintypes.DWORD, # _In_ DWORD dwCreationDisposition
wintypes.DWORD, # _In_ DWORD dwFlagsAndAttributes
wintypes.HANDLE] # _In_opt_ HANDLE hTemplateFile
CreateFile_Fn.restype = wintypes.HANDLE
self.handle = wintypes.HANDLE(CreateFile_Fn('\\\\.\\' + self.name,
access,
mode,
NULL,
creation,
flags,
NULL))
开发者ID:FSecureLABS,项目名称:win_driver_plugin,代码行数:25,
示例5: open_service
点赞 6
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import wintypes [as 别名]
def open_service(service_manager_handle, service_name, desired_access):
""" See: OpenService function
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684330(v=vs.