Jump to content

I am dying with dllcall. Need a little help.

Recommended Posts

I am trying to write a little routin that simply checks for the presence of a USB Security Lock. Here is the VB code:

Private Sub CheckForKEYLOK()

Dim Argument1 As Integer, Argument2 As Integer, Argument3 As Integer

Dim RotateCount1 As Integer, RotateCount2 As Integer

Call KTASK(KLCHECK, ValidateCode1, ValidateCode2, ValidateCode3)

RotateCount1 = ReturnValue2 And 7

RotateCount2 = ReturnValue1 And 15

Here us what I have to date:

#Include <array.au3>

$KLCheck = 1


$ValidateCode1 = 18571

$ValidateCode2 = 65250

$ValidateCode3 = 61328

Dim $result[10]

$result[0]= DllCall("kl2dll32.dll", "int", "int", $ValidateCode1, "int", $ValidateCode2, "int", $ValidateCode3)


I am really, really lost as to how the "return values" of the dllcall are obtained. Can someone help?

Link to post
Share on other sites

Ouch, a number of mistakes here.

First when you DllOpen a DLL, you get back a handle to it, which you should use for subsequent calls. See DllOpen help.

Now you have to check for errors, for instance right after invoking DllCall.

If you do that, you'll see that your DLL invokation is plain wrong. The arguments you supply don't match DllCall required syntax.

Re-read DllCall help to see where you diverge.

Then you give a VB prototype for one function (CheckForKEYLOK) but not anything useful else.

Which actual function do you need to call? Can you post their prototype?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...