Jump to content

VarGetType Return Type

Recommended Posts

Playing with VarGetType with DllStructCreate and getting return types not expected.

uint; ulong; dword all return Int64, but DllStructSize = 12 correctly.

Please, tell me what this means, or if doing it wrong.


local $tStruct = DllStructCreate("uint;ulong;dword")
local $sTypes  = ""

For $i = 1 To 3
    $sTypes &= VarGetType(DllStructGetData($tStruct,$i)) & "," ;@lf

MsgBox(64,@error & " Struct Var Types","Au3 Version="  & @AutoItVersion & @lf & _
                                       "Au3 X64="      & @AutoItX64 & @lf & _
                                       "OS Arch="      & @OSArch & @lf & _
                                       "OS Version="   & @OSVersion & @lf & _
                                       "Struct Size="  & DllStructGetSize($tStruct) & @lf & _
                                       "Struct Types=" & $sTypes)

Here is what Msgbox is on my pc.

Au3 Version=
Au3 X64=0
OS Arch=X64
OS Version=WIN_7
Struct Size=12
Struct Types=Int64,Int64,Int64

Share this post

Link to post
Share on other sites

Here's is why you get what you see: when extracting (with DllStructGetData) items from the structure, AutoIt needs to ensure that there is no misrepresentation of the value. As you already know, uint, ulong and dword all mean unsigned 32-bit integer. AutoIt doesn't have such a variant, so it must store the value in the next larger integral variant, i.e. Int64, the only datatype able to hold all positive 32-bit values above 0x7FFFFFFF which may be stored in the items' structure.

Inside the structure, values occupy the size they are meant to.

Hope this clears the mud.

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)

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

  • Create New...