<s> from __future__ import absolute_import <EOL> import ctypes <EOL> from ctypes import Structure , Union , c_ubyte , c_long , c_ulong , c_ushort , c_wchar , c_void_p , c_uint <EOL> from ctypes import byref , POINTER , sizeof <EOL> from ctypes . wintypes import ULONG , BOOLEAN , BYTE , WORD , DWORD , HANDLE , BOOL , WCHAR , LPWSTR , LPCWSTR <EOL> from . import helpers <EOL> import platform <EOL> UCHAR = c_ubyte <EOL> ENUM = c_uint <EOL> TCHAR = WCHAR <EOL> if platform . architecture ( ) [ <NUM_LIT:0> ] . startswith ( '<STR_LIT>' ) : <EOL> WIN_PACK = <NUM_LIT:8> <EOL> else : <EOL> WIN_PACK = <NUM_LIT:1> <EOL> class WinApiException ( Exception ) : <EOL> "<STR_LIT>" <EOL> pass <EOL> def winapi_result ( result ) : <EOL> """<STR_LIT>""" <EOL> if not result : <EOL> raise WinApiException ( "<STR_LIT>" % ( ctypes . GetLastError ( ) , <EOL> ctypes . GetLastError ( ) , ctypes . FormatError ( ) ) ) <EOL> return result <EOL> setup_api = ctypes . windll . setupapi <EOL> hid_dll = ctypes . windll . hid <EOL> kernel32 = ctypes . windll . kernel32 <EOL> ReadFile = kernel32 . ReadFile <EOL> CancelIo = kernel32 . CancelIo <EOL> WriteFile = kernel32 . WriteFile <EOL> CloseHandle = kernel32 . CloseHandle <EOL> CloseHandle . restype = BOOL <EOL> CloseHandle . argtypes = [ HANDLE ] <EOL> SetEvent = kernel32 . SetEvent <EOL> WaitForSingleObject = kernel32 . WaitForSingleObject <EOL> c_tchar = c_wchar <EOL> CreateFile = kernel32 . CreateFileW <EOL> CreateEvent = kernel32 . CreateEventW <EOL> CM_Get_Device_ID = setup_api . CM_Get_Device_IDW <EOL> b_verbose = True <EOL> usb_verbose = False <EOL> class GUID ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _pack_ = <NUM_LIT:1> <EOL> _fields_ = [ ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , WORD ) , <EOL> ( "<STR_LIT>" , WORD ) , <EOL> ( "<STR_LIT>" , BYTE * <NUM_LIT:8> ) ] <EOL> class OVERLAPPED ( Structure ) : <EOL> class OFFSET_OR_HANDLE ( Union ) : <EOL> class OFFSET ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , DWORD ) ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , OFFSET ) , <EOL> ( "<STR_LIT>" , c_void_p ) ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , POINTER ( ULONG ) ) , <EOL> ( "<STR_LIT>" , POINTER ( ULONG ) ) , <EOL> ( "<STR_LIT:u>" , OFFSET_OR_HANDLE ) , <EOL> ( "<STR_LIT>" , HANDLE ) <EOL> ] <EOL> class SP_DEVICE_INTERFACE_DATA ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _pack_ = WIN_PACK <EOL> _fields_ = [ ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , GUID ) , <EOL> ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , POINTER ( ULONG ) ) <EOL> ] <EOL> class SP_DEVICE_INTERFACE_DETAIL_DATA ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _pack_ = WIN_PACK <EOL> _fields_ = [ ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , TCHAR * <NUM_LIT:1> ) <EOL> ] <EOL> def get_string ( self ) : <EOL> """<STR_LIT>""" <EOL> return ctypes . wstring_at ( byref ( self , sizeof ( DWORD ) ) ) <EOL> class SP_DEVINFO_DATA ( Structure ) : <EOL> """<STR_LIT>""" <EOL> _pack_ = WIN_PACK <EOL> _fields_ = [ ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , GUID ) , <EOL> ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , POINTER ( ULONG ) ) , <EOL> ] <EOL> SetupDiGetDeviceInterfaceDetail = setup_api . SetupDiGetDeviceInterfaceDetailW <EOL> SetupDiGetDeviceInterfaceDetail . restype = BOOL <EOL> SetupDiGetDeviceInterfaceDetail . argtypes = [ <EOL> HANDLE , <EOL> POINTER ( SP_DEVICE_INTERFACE_DATA ) , <EOL> POINTER ( SP_DEVICE_INTERFACE_DETAIL_DATA ) , <EOL> DWORD , <EOL> POINTER ( DWORD ) , <EOL> POINTER ( SP_DEVINFO_DATA ) , <EOL> ] <EOL> SetupDiGetDeviceInstanceId = setup_api . SetupDiGetDeviceInstanceIdW <EOL> SetupDiGetDeviceInstanceId . restype = BOOL <EOL> SetupDiGetDeviceInstanceId . argtypes = [ <EOL> HANDLE , <EOL> POINTER ( SP_DEVINFO_DATA ) , <EOL> LPWSTR , <EOL> DWORD , <EOL> POINTER ( DWORD ) , <EOL> ] <EOL> SetupDiGetClassDevs = setup_api . SetupDiGetClassDevsW <EOL> SetupDiGetClassDevs . restype = HANDLE <EOL> SetupDiGetClassDevs . argtypes = [ <EOL> POINTER ( GUID ) , <EOL> LPCWSTR , <EOL> HANDLE , <EOL> DWORD , <EOL> ] <EOL> SetupDiGetDeviceRegistryProperty = setup_api . SetupDiGetDeviceRegistryPropertyW <EOL> SetupDiGetDeviceRegistryProperty . restype = BOOL <EOL> SetupDiGetDeviceRegistryProperty . argtypes = [ <EOL> HANDLE , <EOL> POINTER ( SP_DEVINFO_DATA ) , <EOL> DWORD , <EOL> POINTER ( DWORD ) , <EOL> POINTER ( BYTE ) , <EOL> DWORD , <EOL> POINTER ( DWORD ) , <EOL> ] <EOL> SetupDiDestroyDeviceInfoList = setup_api . SetupDiDestroyDeviceInfoList <EOL> SetupDiDestroyDeviceInfoList . restype = BOOL <EOL> SetupDiDestroyDeviceInfoList . argtypes = [ <EOL> HANDLE , <EOL> ] <EOL> SetupDiEnumDeviceInterfaces = setup_api . SetupDiEnumDeviceInterfaces <EOL> SetupDiEnumDeviceInterfaces . restype = BOOL <EOL> SetupDiEnumDeviceInterfaces . argtypes = [ <EOL> HANDLE , <EOL> POINTER ( SP_DEVINFO_DATA ) , <EOL> POINTER ( GUID ) , <EOL> DWORD , <EOL> POINTER ( SP_DEVICE_INTERFACE_DATA ) , <EOL> ] <EOL> class DIGCF : <EOL> """<STR_LIT>""" <EOL> DEFAULT = <NUM_LIT> <EOL> PRESENT = <NUM_LIT> <EOL> ALLCLASSES = <NUM_LIT> <EOL> PROFILE = <NUM_LIT> <EOL> DEVICEINTERFACE = <NUM_LIT> <EOL> class HIDD_ATTRIBUTES ( Structure ) : <EOL> _fields_ = [ ( "<STR_LIT>" , DWORD ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> class HIDP_CAPS ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort * <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> class HIDP_BUTTON_CAPS ( Structure ) : <EOL> class RANGE_NOT_RANGE ( Union ) : <EOL> class RANGE ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> class NOT_RANGE ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , RANGE ) , <EOL> ( "<STR_LIT>" , NOT_RANGE ) <EOL> ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ubyte ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , c_ulong * <NUM_LIT:10> ) , <EOL> ( "<STR_LIT>" , RANGE_NOT_RANGE ) <EOL> ] <EOL> class HIDP_VALUE_CAPS ( Structure ) : <EOL> class RANGE_NOT_RANGE ( Union ) : <EOL> class RANGE ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> class NOT_RANGE ( Structure ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , ( "<STR_LIT>" , c_ushort ) <EOL> ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , RANGE ) , <EOL> ( "<STR_LIT>" , NOT_RANGE ) <EOL> ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ubyte ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ( "<STR_LIT>" , c_ubyte ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort * <NUM_LIT:5> ) , <EOL> ( "<STR_LIT>" , c_ulong ) , <EOL> ( "<STR_LIT>" , c_ulong ) , <EOL> ( "<STR_LIT>" , c_long ) , <EOL> ( "<STR_LIT>" , c_long ) , <EOL> ( "<STR_LIT>" , c_long ) , <EOL> ( "<STR_LIT>" , c_long ) , <EOL> ( "<STR_LIT>" , RANGE_NOT_RANGE ) <EOL> ] <EOL> class HIDP_DATA ( Structure ) : <EOL> class HIDP_DATA_VALUE ( Union ) : <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ulong ) , <EOL> ( "<STR_LIT>" , BOOLEAN ) , <EOL> ] <EOL> _fields_ = [ <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT>" , c_ushort ) , <EOL> ( "<STR_LIT:value>" , HIDP_DATA_VALUE ) <EOL> ] <EOL> HidP_Input = <NUM_LIT> <EOL> HidP_Output = <NUM_LIT> <EOL> HidP_Feature = <NUM_LIT> <EOL> FACILITY_HID_ERROR_CODE = <NUM_LIT> <EOL> def HIDP_ERROR_CODES ( sev , code ) : <EOL> return ( ( ( sev ) << <NUM_LIT> ) | ( FACILITY_HID_ERROR_CODE << <NUM_LIT:16> ) | ( code ) ) & <NUM_LIT> <EOL> class HidStatus ( object ) : <EOL> HIDP_STATUS_SUCCESS = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> HIDP_STATUS_NULL = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:1> ) ) <EOL> HIDP_STATUS_INVALID_PREPARSED_DATA = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:1> ) ) <EOL> HIDP_STATUS_INVALID_REPORT_TYPE = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:2> ) ) <EOL> HIDP_STATUS_INVALID_REPORT_LENGTH = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:3> ) ) <EOL> HIDP_STATUS_USAGE_NOT_FOUND = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:4> ) ) <EOL> HIDP_STATUS_VALUE_OUT_OF_RANGE = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:5> ) ) <EOL> HIDP_STATUS_BAD_LOG_PHY_VALUES = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:6> ) ) <EOL> HIDP_STATUS_BUFFER_TOO_SMALL = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:7> ) ) <EOL> HIDP_STATUS_INTERNAL_ERROR = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:8> ) ) <EOL> HIDP_STATUS_I8042_TRANS_UNKNOWN = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT:9> ) ) <EOL> HIDP_STATUS_INCOMPATIBLE_REPORT_ID = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_NOT_VALUE_ARRAY = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_IS_VALUE_ARRAY = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_DATA_INDEX_NOT_FOUND = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_BUTTON_NOT_PRESSED = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_REPORT_DOES_NOT_EXIST = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> HIDP_STATUS_NOT_IMPLEMENTED = ( HIDP_ERROR_CODES ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> error_message_dict = { <EOL> HIDP_STATUS_SUCCESS : "<STR_LIT:success>" , <EOL> HIDP_STATUS_NULL : "<STR_LIT:null>" , <EOL> HIDP_STATUS_INVALID_PREPARSED_DATA : "<STR_LIT>" , <EOL> HIDP_STATUS_INVALID_REPORT_TYPE : "<STR_LIT>" , <EOL> HIDP_STATUS_INVALID_REPORT_LENGTH : "<STR_LIT>" , <EOL> HIDP_STATUS_USAGE_NOT_FOUND : "<STR_LIT>" , <EOL> HIDP_STATUS_VALUE_OUT_OF_RANGE : "<STR_LIT>" , <EOL> HIDP_STATUS_BAD_LOG_PHY_VALUES : "<STR_LIT>" , <EOL> HIDP_STATUS_BUFFER_TOO_SMALL : "<STR_LIT>" , <EOL> HIDP_STATUS_INTERNAL_ERROR : "<STR_LIT>" , <EOL> HIDP_STATUS_I8042_TRANS_UNKNOWN : "<STR_LIT>" , <EOL> HIDP_STATUS_INCOMPATIBLE_REPORT_ID : "<STR_LIT>" , <EOL> HIDP_STATUS_NOT_VALUE_ARRAY : "<STR_LIT>" , <EOL> HIDP_STATUS_IS_VALUE_ARRAY : "<STR_LIT>" , <EOL> HIDP_STATUS_DATA_INDEX_NOT_FOUND : "<STR_LIT>" , <EOL> HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE : "<STR_LIT>" , <EOL> HIDP_STATUS_BUTTON_NOT_PRESSED : "<STR_LIT>" , <EOL> HIDP_STATUS_REPORT_DOES_NOT_EXIST : "<STR_LIT>" , <EOL> HIDP_STATUS_NOT_IMPLEMENTED : "<STR_LIT>" <EOL> } <EOL> def __init__ ( self , error_code ) : <EOL> error_code &= <NUM_LIT> <EOL> self . error_code = error_code <EOL> if error_code != self . HIDP_STATUS_SUCCESS : <EOL> if error_code in self . error_message_dict : <EOL> raise helpers . HIDError ( "<STR_LIT>" % self . error_message_dict [ error_code ] ) <EOL> else : <EOL> raise helpers . HIDError ( "<STR_LIT>" % hex ( error_code ) ) <EOL> WAIT_ABANDONED = <NUM_LIT> <EOL> WAIT_OBJECT_0 = <NUM_LIT> <EOL> WAIT_TIMEOUT = <NUM_LIT> <EOL> WAIT_FAILED = <NUM_LIT> <EOL> INFINITE = <NUM_LIT> <EOL> GENERIC_READ = ( - <NUM_LIT> ) <EOL> GENERIC_WRITE = ( <NUM_LIT> ) <EOL> FILE_SHARE_READ = <NUM_LIT:1> <EOL> FILE_SHARE_WRITE = <NUM_LIT:2> <EOL> OPEN_EXISTING = <NUM_LIT:3> <EOL> OPEN_ALWAYS = <NUM_LIT:4> <EOL> INVALID_HANDLE_VALUE = HANDLE ( - <NUM_LIT:1> ) <EOL> FILE_FLAG_OVERLAPPED = <NUM_LIT> <EOL> FILE_ATTRIBUTE_NORMAL = <NUM_LIT> <EOL> NO_ERROR = <NUM_LIT:0> <EOL> ERROR_IO_PENDING = <NUM_LIT> <EOL> def GetHidGuid ( ) : <EOL> "<STR_LIT>" <EOL> hid_guid = GUID ( ) <EOL> hid_dll . HidD_GetHidGuid ( byref ( hid_guid ) ) <EOL> return hid_guid <EOL> class DeviceInterfaceSetInfo ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , guid_target ) : <EOL> self . guid = guid_target <EOL> self . h_info = None <EOL> def __enter__ ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . open ( ) <EOL> def open ( self ) : <EOL> """<STR_LIT>""" <EOL> self . h_info = SetupDiGetClassDevs ( byref ( self . guid ) , None , None , <EOL> ( DIGCF . PRESENT | DIGCF . DEVICEINTERFACE ) ) <EOL> return self . h_info <EOL> def __exit__ ( self , exc_type , exc_value , traceback ) : <EOL> """<STR_LIT>""" <EOL> self . close ( ) <EOL> def close ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . h_info and self . h_info != INVALID_HANDLE_VALUE : <EOL> SetupDiDestroyDeviceInfoList ( self . h_info ) <EOL> self . h_info = None <EOL> def enum_device_interfaces ( h_info , guid ) : <EOL> """<STR_LIT>""" <EOL> dev_interface_data = SP_DEVICE_INTERFACE_DATA ( ) <EOL> dev_interface_data . cb_size = sizeof ( dev_interface_data ) <EOL> device_index = <NUM_LIT:0> <EOL> while SetupDiEnumDeviceInterfaces ( h_info , <EOL> None , <EOL> byref ( guid ) , <EOL> device_index , <EOL> byref ( dev_interface_data ) ) : <EOL> yield dev_interface_data <EOL> device_index += <NUM_LIT:1> <EOL> del dev_interface_data <EOL> def get_device_path ( h_info , interface_data , ptr_info_data = None ) : <EOL> """<STR_LIT>""" <EOL> required_size = c_ulong ( <NUM_LIT:0> ) <EOL> dev_inter_detail_data = SP_DEVICE_INTERFACE_DETAIL_DATA ( ) <EOL> dev_inter_detail_data . cb_size = sizeof ( SP_DEVICE_INTERFACE_DETAIL_DATA ) <EOL> SetupDiGetDeviceInterfaceDetail ( h_info , byref ( interface_data ) , <EOL> None , <NUM_LIT:0> , byref ( required_size ) , <EOL> None ) <EOL> ctypes . resize ( dev_inter_detail_data , required_size . value ) <EOL> SetupDiGetDeviceInterfaceDetail ( h_info , byref ( interface_data ) , <EOL> byref ( dev_inter_detail_data ) , required_size , None , <EOL> ptr_info_data ) <EOL> return dev_inter_detail_data . get_string ( ) </s>
