Jump to content

Security dongle DLL


 Share

Recommended Posts

Hello,

I need help to access a security dongle dll. But after many tries I’m going crazy...

Code in VB6:

Declare Function UniKey Lib "UniKey.DLL" (ByVal fcode As Integer, ByRef handle As Integer, ByRef lp1 As Long, ByRef lp2 As Long, ByRef p1 As Long, ByRef p2 As Long, ByRef p3 As Long, ByRef p4 As Long, ByRef buffer As Byte) As Integer

Dim handle(15) As Integer
Dim p1, p2, p3, p4, i, j, count, retcode As Long
Dim lp1, lp2 As Long
Dim buffer() As Byte

retcode = UniKey(1, handle(0), lp1, lp2, p1, p2, p3, p4, buffer(0))

Code in VB2008:

Declare Function UniKey Lib "UniKey.DLL" (ByVal fcode As Integer, ByRef handle As Integer, ByRef lp1 As Long, ByRef lp2 As Long, ByRef p1 As Integer, ByRef p2 As Integer, ByRef p3 As Integer, ByRef p4 As Integer, ByRef buffer As Byte) As Integer

Dim handle As Integer
Dim p1, p2, p3, p4, i, j, retcode As Integer
Dim lp1, lp2, v As Integer
Dim buffer(4096) As Byte

retcode = UniKey(1, handle, lp1, lp2, p1, p2, p3, p4, buffer(0))

In VB6 and VB2008 works well, and return (retcode) the value 0.

With this code by me in Autoit:

Dim $fcode, $handler, $lp1, $lp2, $p1, $p2, $p3, $p4, $buffer, $result

$fcode = 1
$handler = 0
$p1 = 1234
$p2 = 1234
$p3 = 1234
$p4 = 1234
$buffer = 0

$result = DllCall("UniKey.dll", "int", "UniKey", "int", $fcode, "int", $handler, "int", $lp1, "int", $lp2, "int", $p1, "int", $p2, "int", $p3, "int", $p4, "byte", $buffer)

The Autoit closes with a fatal error.

Any suggestion?

Best Regards, Pardalito.

Edited by Pardalito
Link to comment
Share on other sites

Hello and thanks,

Changed...

$result = DllCall(@ScriptDir & "\UniKey.dll", "int", "UniKey", "int", $fcode, "int*", $handler, "int*", $lp1, "int*", $lp2, "int*", $p1, "int*", $p2, "int*", $p3, "int*", $p4, "byte*", $buffer)

msgbox(0,'',String($result) & " - " & $result)

The fatal error disappears (perfect), but I dont have or I don't see the response by security dongle.

The $result is null.

API in VC6:

extern "C" long __stdcall UniKey(WORD Function, WORD* handle, DWORD* lp1, DWORD* lp2, WORD* p1, WORD* p2, WORD* p3, WORD* p4, BYTE* buffer);

For $fcode = 1 all the values are optional.

I dont see the error, any ideas?

Best Regards, Pardalito.

Link to comment
Share on other sites

  • Developers

If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified when passed by reference).

$return[0] = function return value

$return[1] = param1

$return[2] = param2

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hello,

Yes... You have right...

Works like a charm and in array return the serial number or the security dongle.

$result = DllCall(@ScriptDir & "\UniKey.dll", "int", "UniKey", "int", $fcode, "int*", $handler, "int*", $lp1, "int*", $lp2, "int*", $p1, "int*", $p2, "int*", $p3, "int*", $p4, "byte*", $buffer)

_ArrayDisplay($result)

Many thanks.

Best Regards, Pardalito.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...