Sign in to follow this  
Followers 0
smashly

DllStruct

2 posts in this topic

Hi (sorry for the long winded story/question)

I've been playing around with windows aspi and find myself passing pointers to AutoIt created DllStucts to the aspi to rip a cd/dvd to raw data (bin file) and it works well enough in a rough draft of AutoIt code.

I've been basically copying the stucture from wnaspi32.h defines and translating the data types to work with autoit.

Most the time I just take a guess at the data type when I can't find enough info as to the data type I need to use.

eg: "PBYTE FAR *PostProc" I used "PTR PostProc" and all appears to do as expected.

But I sort of wonder how things work when translating and using arrays in DllStructs.

eg: "BYTE CDBByte[16]" is what the structure is meant to contain.

So the index starts at 0 and finished at 15 (16 bytes),

At first glance I say that's easy enough, but then I see that AutioIt starts the index at 1 and not 0.

Where as the the aspi I'm pasing the struct to references at 0.

All goes well and the data I pass at index 1 works.

So now when I'm filling the array everything has moved up 1.

So what should be at index 15 (16th byte) is at index 16.

Everything so far returns as expected in most cases.

But then it leaves me to wonder, should I be setting my array +1 eg: "BYTE CDBByte[17]"?

The only reason I ask is in another struct for TOC I actually had to add the extra byte in arrays to get the full data I requested.

Can provide crude code if needed.

TYIA

Cheers

Share this post


Link to post
Share on other sites



Stick with the 16 bytes. That C or any callee language accesses the first element with index 0 while you access it with index 1 is just a convention: both access the first element. Imagine that in AutoIt First = 1 while in C First = 0. Accessing CDByte[First] is going to refer to the first byte in the array, whatever "side" you look at it. The base index being 0 or 1 is just a convention local to a language. It could be 42 as well (albeit less natural).


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
Sign in to follow this  
Followers 0