當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。