kOchirasu / AutoIt-Interception

AutoIt3 wrapper for oblitum/Interception
MIT License
0 stars 0 forks source link

crash when use interception_set_filter dll function #3

Open caoanhhao opened 3 years ago

caoanhhao commented 3 years ago

Hi Ochi-rasu, my program was crahed when use this Interception_Set_Filter function. Can you show me an example? Thanks you.

Func Interception_Set_Filter ($predicate, $filter)
   Local $aRet = DllCall($DLL_HANDLE, "none:cdecl", "interception_set_filter", _
    "ptr", $CONTEXT, _
    "ptr", $predicate, _
    "int", $filter)
   If @error Then Return SetError(@error, @extended, 0)
EndFunc

Func Interception_Is_Keyboard($device)
   Local $aRet = DllCall($DLL_HANDLE, "int:cdecl", "interception_is_keyboard","int", $device)
   If @error Then Return SetError(@error, @extended, 0)

   Return $aRet[0]
EndFunc

Global Const $interception_is_keyboard = DllCallbackGetPtr(DllCallbackRegister("Interception_Is_Keyboard", "int", "device"))
Interception_Set_Filter( $interception_is_keyboard,  BitOR($INTERCEPTION_FILTER_KEY_DOWN, $INTERCEPTION_FILTER_KEY_UP))
kOchirasu commented 3 years ago

Looks like InterceptionFilter is a ushort so you can try that instead. Just a guess.

https://github.com/oblitum/Interception/blob/master/library/interception.h#L50

caoanhhao commented 3 years ago

i changed to:

Local $aRet = DllCall($DLL_HANDLE, "none:cdecl", "interception_set_filter", _
    "ptr", $CONTEXT, _
    "ptr", $predicate, _
    "ushort", $filter)

and it was crashed. i try many ways, but ain't any work