信宜-玉都风情网欢迎您的到来,注册后,您将能玩到更多好玩的功能!信宜人的网上家园,网聚信宜人的力量。
您需要 登录 才可以下载或查看,没有账号?注册会员
x
为了开发一个解密软件,只花了半日的时间写USB API函数,调试总是有问题。年尾近了。大量工作,烦得要命。 Public Declare Function CloseHandle _ Lib "kernel32" _ (ByVal hObject As Long) _ As Long 关闭设备 Public Declare Function CreateFile _ Lib "kernel32" _ Alias "CreateFileA" _ (ByVal lpFileName As String, _ ByVal dwDesiredAccess As Long, _ ByVal dwShareMode As Long, _ ByRef lpSecurityAttributes As Long, _ ByVal dwCreationDisposition As Long, _ ByVal dwFlagsAndAttributes As Long, _ ByVal hTemplateFile As Long) _ As Long 取得设备表示代号 Public Declare Function FormatMessage _ Lib "kernel32" _ Alias "FormatMessageA" _ (ByVal dwFlags As Long, _ ByRef lpSource As Any, _ ByVal dwMessageId As Long, _ ByVal dwLanguageZId As Long, _ ByVal lpBuffer As String, _ ByVal nSize As Long, _ ByVal Arguments As Long) _ As Long Public Declare Function HidD_FreePreparsedData _ Lib "hid.dll" _ (ByRef PreparsedData As Long) _ As Long 释放缓冲区 Public Declare Function HidD_GetAttributes _ Lib "hid.dll" _ (ByVal HidDeviceObject As Long, _ ByRef Attributes As HIDD_ATTRIBUTES) _ As Long '取得厂商与产品的ID Public Declare Function HidD_GetHidGuid _ Lib "hid.dll" _ (ByRef HidGuid As GUID) _ As Long 取得HID群组的GUID Public Declare Function HidD_GetPreparsedData _ Lib "hid.dll" _ (ByVal HidDeviceObject As Long, _ ByRef PreparsedData As Long) _ As Long 取得包含设备能力的缓冲区指针 Public Declare Function HidP_GetCaps _ Lib "hid.dll" _ (ByVal PreparsedData As Long, _ ByRef Capabilities As HIDP_CAPS) _ As Long 取得设备的能力 Public Declare Function HidP_GetValueCaps _ Lib "hid.dll" _ (ByVal ReportType As Integer, _ ByRef ValueCaps As Byte, _ ByRef ValueCapsLength As Integer, _ ByVal PreparsedData As Long) _ As Long 取得数值的能力 Public Declare Function ReadFile _ Lib "kernel32" _ (ByVal hFile As Long, _ ByRef lpBuffer As Byte, _ ByVal nNumberOfBytesToRead As Long, _ ByRef lpNumberOfBytesRead As Long, _ ByVal lpOverlapped As Long) _ As Long 从设备读取输入报告 Public Declare Function RtlMoveMemory _ Lib "kernel32" _ (dest As Any, _ src As Any, _ ByVal Count As Long) _ As Long Public Declare Function SetupDiDestroyDeviceInfoList _ Lib "setupapi.dll" _ (ByVal DeviceInfoSet As Long) _ As Long 释放hDevInfo数组 Public Declare Function SetupDiEnumDeviceInterfaces _ Lib "setupapi.dll" _ (ByVal DeviceInfoSet As Long, _ ByVal DeviceInfoData As Long, _ ByRef InterfaceClassGuid As GUID, _ ByVal MemberIndex As Long, _ ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA) _ As Long 识别每个HID接口 Public Declare Function SetupDiGetClassDevs _ Lib "setupapi.dll" _ Alias "SetupDiGetClassDevsA" _ (ByRef ClassGuid As GUID, _ ByVal Enumerator As String, _ ByVal hwndParent As Long, _ ByVal Flags As Long) _ As Long 取得所有HID信息的结构数组 Public Declare Function SetupDiGetDeviceInterfaceDetail _ Lib "setupapi.dll" _ Alias "SetupDiGetDeviceInterfaceDetailA" _ (ByVal DeviceInfoSet As Long, _ ByRef DeviceInterfaceData As SP_DEVICE_INTERFACE_DATA, _ ByVal DeviceInterfaceDetailData As Long, _ ByVal DeviceInterfaceDetailDataSize As Long, _ ByRef RequiredSize As Long, _ ByVal DeviceInfoData As Long) _ As Long 取得设备的详细信息 Public Declare Function WriteFile _ Lib "kernel32" _ (ByVal hFile As Long, _ ByRef lpBuffer As Byte, _ ByVal nNumberOfBytesToWrite As Long, _ ByRef lpNumberOfBytesWritten As Long, _ ByVal lpOverlapped As Long) _ As Long 传送输出报告给设备 Declare Function DeviceIoControl Lib "kernel32" Alias "DeviceIoContro
(ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, lpOverlapped As OVERLAPPED) As Long 对设备执行指定的操作 HidD_GetInputReport(IN HANDLE HidDeviceObject, OUT PVOID ReportBuffer, IN ULONG ReportBufferLength); 通过控制端点0读取报告的函数 HidD_SetOutputReport(IN HANDLE HidDeviceObject, OUT PVOID ReportBuffer, IN ULONG ReportBufferLength); 通过控制端点0发送报告的函数 l
|