当前位置: 首页>>代码示例>>Python>>正文


Python wintypes.BOOL属性代码示例

本文整理汇总了Python中ctypes.wintypes.BOOL属性的典型用法代码示例。如果您正苦于以下问题:Python wintypes.BOOL属性的具体用法?Python wintypes.BOOL怎么用?Python wintypes.BOOL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ctypes.wintypes的用法示例。


在下文中一共展示了wintypes.BOOL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: control_service

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def control_service(service_handle, control, service_status):
	"""See: ControlService function
	https://msdn.microsoft.com/en-us/library/windows/desktop/ms682108(v=vs.85).aspx
	"""
	ControlService_Fn = ctypes.windll.Advapi32.ControlService	 	#BOOL WINAPI ControlService(
	ControlService_Fn.argtypes = [							#
		wintypes.SC_HANDLE,									#	_In_  SC_HANDLE        hService,
		wintypes.DWORD,										#	_In_  DWORD            dwControl,
		wintypes.LPCVOID 							        #	_Out_ LPSERVICE_STATUS lpServiceStatus
	]
	ControlService_Fn.restype = wintypes.BOOL
	bool = ControlService_Fn(
		service_handle,
		control,
		service_status
	)
	return bool 
开发者ID:FSecureLABS,项目名称:win_driver_plugin,代码行数:19,代码来源:driverlib.py

示例2: start_service

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def start_service(service_handle, service_arg_count, service_arg_vectors):
	"""See: StartService function
	https://msdn.microsoft.com/en-us/library/windows/desktop/ms686321(v=vs.85).aspx
	"""
	
	StartService_Fn = ctypes.windll.Advapi32.StartServiceA	#BOOL WINAPI StartService(
	StartService_Fn.argtypes = [					#
		wintypes.SC_HANDLE,							#	_In_ 	 SC_HANDLE hService,
		wintypes.DWORD,								#	_In_ 	 DWORD     dwNumServiceArgs,
		LPCTSTR							#	_In_opt_ LPCTSTR   *lpServiceArgVectors
	]
	StartService_Fn.restype = wintypes.BOOL
	bool = StartService_Fn(
		service_handle,
		service_arg_count, 
		service_arg_vectors
	)
	return bool 
开发者ID:FSecureLABS,项目名称:win_driver_plugin,代码行数:20,代码来源:driverlib.py

示例3: test_CTRL_C_EVENT

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def test_CTRL_C_EVENT(self):
        from ctypes import wintypes
        import ctypes

        # Make a NULL value by creating a pointer with no argument.
        NULL = ctypes.POINTER(ctypes.c_int)()
        SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler
        SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int),
                                          wintypes.BOOL)
        SetConsoleCtrlHandler.restype = wintypes.BOOL

        # Calling this with NULL and FALSE causes the calling process to
        # handle Ctrl+C, rather than ignore it. This property is inherited
        # by subprocesses.
        SetConsoleCtrlHandler(NULL, 0)

        self._kill_with_event(signal.CTRL_C_EVENT, "CTRL_C_EVENT") 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_os.py

示例4: test_CTRL_C_EVENT

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def test_CTRL_C_EVENT(self):
        from ctypes import wintypes
        import ctypes

        # Make a NULL value by creating a pointer with no argument.
        NULL = ctypes.POINTER(ctypes.c_int)()
        SetConsoleCtrlHandler = ctypes.windll.kernel32.SetConsoleCtrlHandler
        SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int),
                                          wintypes.BOOL)
        SetConsoleCtrlHandler.restype = wintypes.BOOL

        # Calling this with NULL and FALSE causes the calling process to
        # handle CTRL+C, rather than ignore it. This property is inherited
        # by subprocesses.
        SetConsoleCtrlHandler(NULL, 0)

        self._kill_with_event(signal.CTRL_C_EVENT, "CTRL_C_EVENT") 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:19,代码来源:test_os.py

示例5: close

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def close(self):
        """
        Close WinAPI Handle.
        
        https://msdn.microsoft.com/en-us/library/windows/desktop/dd692936(v=vs.85).aspx
        BOOL DestroyPhysicalMonitor(
            _In_  HANDLE hMonitor
        );
        :return:
        """
        import ctypes
        api_call = ctypes.windll.Dxva2.DestroyPhysicalMonitor
        
        if not api_call(self._phy_monitor_handle):
            _LOGGER.error(ctypes.WinError())
    
    # ########################## 发送/读取 VCP 设置的函数 
开发者ID:dot-osk,项目名称:monitor_ctrl,代码行数:19,代码来源:vcp.py

示例6: get_root

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def get_root(key: list =['网上股票交易系统', '通达信']) -> tuple:
    from ctypes.wintypes import BOOL, HWND, LPARAM

    @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
    def callback(hwnd, lparam):
        user32.GetWindowTextW(hwnd, buf, 64)
        for s in key:
            if s in buf.value:
                handle.value = hwnd
                return False
        return True

    buf = ctypes.create_unicode_buffer(64)
    handle = ctypes.c_ulong()
    user32.EnumWindows(callback)
    return handle.value, buf.value 
开发者ID:Raytone-D,项目名称:puppet,代码行数:18,代码来源:puppet_util.py

示例7: finder

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def finder(register):
    ''' 枚举所有可用的broker交易端并实例化 '''
    team = set()
    buff = buffer(32)
    @ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
    def check(hwnd, extra):
        if op.IsWindowVisible(hwnd):
            op.GetWindowTextW(hwnd, buff, 32)
            if '交易系统' in buff.value:
                team.add(hwnd)
        return 1
    op.EnumWindows(check, 0)
    
    def get_nickname(hwnd):
        account = hwnd
        for i in 59392, 0, 1711:
            account = op.GetDlgItem(account, i)
        op.SendMessageW(account, WM_GETTEXT, 32, buff)
        return register.get(buff.value[-3:])
        
    return {get_nickname(hwnd): unity(hwnd) for hwnd in team if hwnd} 
开发者ID:Raytone-D,项目名称:puppet,代码行数:23,代码来源:release_puppet_unity_ths.py

示例8: __init__

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def __init__(self, console_handle, fileno, stream_name, encoding):
    super(WinUnicodeConsoleOutput, self).__init__(
        fileno, '<Unicode console %s>' % stream_name, encoding)
    # Handle to use for WriteConsoleW
    self._console_handle = console_handle

    # Loads the necessary function.
    # These types are available on linux but not Mac.
    # pylint: disable=no-name-in-module,F0401
    from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE
    from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR
    from ctypes.wintypes import LPVOID  # pylint: disable=no-name-in-module

    self._DWORD = DWORD
    self._byref = byref

    # <http://msdn.microsoft.com/en-us/library/ms687401.aspx>
    self._WriteConsoleW = WINFUNCTYPE(
        BOOL, HANDLE, LPWSTR, DWORD, POINTER(DWORD), LPVOID)(
            ('WriteConsoleW', windll.kernel32))
    self._GetLastError = GetLastError 
开发者ID:luci,项目名称:luci-py,代码行数:23,代码来源:fix_encoding.py

示例9: win_handle_is_a_console

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def win_handle_is_a_console(handle):
  """Returns True if a Windows file handle is a handle to a console."""
  # These types are available on linux but not Mac.
  # pylint: disable=no-name-in-module,F0401
  from ctypes import byref, POINTER, windll, WINFUNCTYPE
  from ctypes.wintypes import BOOL, DWORD, HANDLE

  FILE_TYPE_CHAR   = 0x0002
  FILE_TYPE_REMOTE = 0x8000
  INVALID_HANDLE_VALUE = DWORD(-1).value

  # <http://msdn.microsoft.com/en-us/library/ms683167.aspx>
  GetConsoleMode = WINFUNCTYPE(BOOL, HANDLE, POINTER(DWORD))(
      ('GetConsoleMode', windll.kernel32))
  # <http://msdn.microsoft.com/en-us/library/aa364960.aspx>
  GetFileType = WINFUNCTYPE(DWORD, DWORD)(('GetFileType', windll.kernel32))

  # GetStdHandle returns INVALID_HANDLE_VALUE, NULL, or a valid handle.
  if handle == INVALID_HANDLE_VALUE or handle is None:
    return False
  return (
      (GetFileType(handle) & ~FILE_TYPE_REMOTE) == FILE_TYPE_CHAR and
       GetConsoleMode(handle, byref(DWORD()))) 
开发者ID:luci,项目名称:luci-py,代码行数:25,代码来源:fix_encoding.py

示例10: RtlAdjustPrivilege

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def RtlAdjustPrivilege(privilige_id, enable = True, thread_or_process = False):
	"""
	privilige_id: int
	"""
	_RtlAdjustPrivilege = windll.ntdll.RtlAdjustPrivilege
	_RtlAdjustPrivilege.argtypes = [ULONG, BOOL, BOOL, POINTER(BOOL)]
	_RtlAdjustPrivilege.restype  = NTSTATUS
	
	CurrentThread = thread_or_process #enable for whole process
	Enabled = BOOL()
	
	status = _RtlAdjustPrivilege(privilige_id, enable, CurrentThread, ctypes.byref(Enabled))
	if status != STATUS_SUCCESS:
		raise Exception(NtError(status))
	
	return True 
开发者ID:skelsec,项目名称:pypykatz,代码行数:18,代码来源:privileges.py

示例11: RtlAdjustPrivilege

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def RtlAdjustPrivilege(privilige_id, enable = True, thread_or_process = False):
	"""
	privilige_id: int
	"""
	_RtlAdjustPrivilege = windll.ntdll.RtlAdjustPrivilege
	_RtlAdjustPrivilege.argtypes = [ULONG, BOOL, BOOL, POINTER(BOOL)]
	_RtlAdjustPrivilege.restype  = NTSTATUS

	
	CurrentThread = thread_or_process #False = enable for whole process, True = current thread only
	Enabled = BOOL()
	
	status = _RtlAdjustPrivilege(privilige_id, enable, CurrentThread, ctypes.byref(Enabled))
	if status != 0:
		raise Exception('Failed call to RtlAdjustPrivilege! Status: %s' % status)
	
	return Enabled.value 
开发者ID:skelsec,项目名称:pypykatz,代码行数:19,代码来源:ntdll.py

示例12: _wait_for_handles

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def _wait_for_handles(handles, timeout=-1):
    """
    Waits for multiple handles. (Similar to 'select') Returns the handle which is ready.
    Returns `None` on timeout.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).aspx
    """
    arrtype = HANDLE * len(handles)
    handle_array = arrtype(*handles)

    ret = windll.kernel32.WaitForMultipleObjects(
        len(handle_array), handle_array, BOOL(False), DWORD(timeout))

    if ret == WAIT_TIMEOUT:
        return None
    else:
        h = handle_array[ret]
        return h 
开发者ID:bkerler,项目名称:android_universal,代码行数:20,代码来源:win32.py

示例13: is64bitProc

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def is64bitProc(process_handle):
	is64 = BOOL()
	res = IsWow64Process(process_handle, ctypes.byref(is64))
	if res == 0:
		logging.warning('Failed to get process version info!')
		WinError(get_last_error())
	return not bool(is64.value)
	
# https://waitfordebug.wordpress.com/2012/01/27/pid-enumeration-on-windows-with-pure-python-ctypes/ 
开发者ID:skelsec,项目名称:minidump,代码行数:11,代码来源:createminidump.py

示例14: send_ioctl

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def send_ioctl(self, ioctl, inbuf, inbufsiz, outbuf, outbufsiz):
        """See: DeviceIoControl function
        http://msdn.microsoft.com/en-us/library/aa363216(v=vs.85).aspx
        """
        DeviceIoControl_Fn = ctypes.windll.kernel32.DeviceIoControl
        DeviceIoControl_Fn.argtypes = [
                wintypes.HANDLE,                    # _In_          HANDLE hDevice
                wintypes.DWORD,                     # _In_          DWORD dwIoControlCode
                wintypes.LPVOID,                    # _In_opt_      LPVOID lpInBuffer
                wintypes.DWORD,                     # _In_          DWORD nInBufferSize
                wintypes.LPVOID,                    # _Out_opt_     LPVOID lpOutBuffer
                wintypes.DWORD,                     # _In_          DWORD nOutBufferSize
                LPDWORD,                            # _Out_opt_     LPDWORD lpBytesReturned
                LPOVERLAPPED]                       # _Inout_opt_   LPOVERLAPPED lpOverlapped
        DeviceIoControl_Fn.restype = wintypes.BOOL
        # allocate a DWORD, and take its reference
        dwBytesReturned = wintypes.DWORD(0)
        lpBytesReturned = ctypes.byref(dwBytesReturned)
        status = DeviceIoControl_Fn(self.handle,
                      ioctl,
                      inbuf,
                      inbufsiz,
                      outbuf,
                      outbufsiz,
                      lpBytesReturned,
                      None)

        return status, dwBytesReturned 
开发者ID:FSecureLABS,项目名称:win_driver_plugin,代码行数:30,代码来源:driverlib.py

示例15: close_service_handle

# 需要导入模块: from ctypes import wintypes [as 别名]
# 或者: from ctypes.wintypes import BOOL [as 别名]
def close_service_handle(service_handle):
	"""See: CloseServiceHandle function 
	https://msdn.microsoft.com/en-us/library/windows/desktop/ms682028(v=vs.85).aspx
	"""
	CloseServiceHandle_Fn = ctypes.windll.Advapi32.CloseServiceHandle	#BOOL WINAPI CloseServiceHandle(
	CloseServiceHandle_Fn.argtypes = [
		wintypes.SC_HANDLE										#	_In_ SC_HANDLE hSCObject
	]
	CloseServiceHandle_Fn.restype = wintypes.BOOL
	bool = CloseServiceHandle_Fn(
		service_handle
	)
	return bool 
开发者ID:FSecureLABS,项目名称:win_driver_plugin,代码行数:15,代码来源:driverlib.py


注:本文中的ctypes.wintypes.BOOL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。