Jump to content
Sign in to follow this  
cbao

A strange dllcall, seek expert help!

Recommended Posts

cbao

This is a Taking of Bluetooth (btfunc.dll) BT_InquireDevices function code, you can always display the returned array does not, appeal to expert guidance, thank you!

Here is the function of the API Description:

This function inquires nearby Bluetooth devices or gets paired devices from BlueSoleil’s history records.

DWORD BT_InquireDevices(

/* [in] */ UCHAR ucInqMode,

/* [in] */ UCHAR ucInqTimeLen,

/* [in, out] */ DWORD* lpDevsListLength,

/* [out] */ PBLUETOOTH_DEVICE_INFO pDevsList,

);

Returns array:

typedef struct _BLUETOOTH_DEVICE_INFO {

DWORD dwSize;

BYTE address[DEVICE_ADDRESS_LENGTH];

BYTE classOfDevice[DEVICE_CLASS_LENGTH];

CHAR szName[MAX_DEVICE_NAME_LENGTH];

BOOL bPaired;

} BLUETOOTH_DEVICE_INFO, *PBLUETOOTH_DEVICE_INFO;

---------------------------------------------------------------------------------------------------------------

#Include <File.au3>

#Include <Array.au3>

Local $dllCallError[5] = [4, "BTSTATUS_SYSTEM_ERROR", "BTSTATUS_PARAMETER_ERROR", "BTSTATUS_BT_NOT_READY", "BTSTATUS_FAIL"]

Global const $DEVICE_ADDRESS_LENGTH = 6

Global const $DEVICE_CLASS_LENGTH = 3

Global const $MAX_DEVICE_NAME_LENGTH = 64

$handle = DllOpen("btfunc.dll")

$str = "DWORD;byte[" & $DEVICE_ADDRESS_LENGTH & "];byte[" & $DEVICE_CLASS_LENGTH & "];byte[" & $MAX_DEVICE_NAME_LENGTH & "];INT"

$struct_BLUETOOTH_DEVICE_INFO = DllStructCreate($str)

$lpDevsListLength = DllStructCreate("DWORD")

$dll = DllCall($handle,"dword:cdecl","BT_InquireDevices","byte","INQUIRY_GENERAL","byte",0x30,"long*",DllStructGetPtr($lpDevsListLength),"long*",DllStructGetPtr($struct_BLUETOOTH_DEVICE_INFO))

If @error then

Msgbox(0,"Error in Dll call", $dllCallError[@error])

Else

_arrayDisplay($dll,"BT_InquireDevices")

EndIf

------------------------------------------------------------------------------------------------------------

Sorry! I am a beginner AUTOIT from China, due to language problems, I do not know how to write source code box, please forgive me!

Edited by cbao

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.