AutoHotkey Community

It is currently May 27th, 2012, 10:40 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: September 29th, 2008, 9:33 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I've made a few small changes to the script:
  • Added basic support for some unsigned types.
  • Improved the usefulness of code generated for arrays.
  • Forced the default name to apply if the name field is empty.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2008, 4:36 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
That's wonderful, thank you very much! :D

You're right, a full-fledged header parser would be a great tool. I just thought StructParser would itself evolve into such tool rather than a complete rewrite, but you know better. :wink:

Quote:
If you specifically delete the name, you get invalid code like NumGet(, 0, "Int").
Exactly my point. Thanks for fixing it.

Quote:
Quote:
Calling MulDiv throws an invalid page fault error.

Only if you pass it an invalid pointer or pointer to an invalid string (i.e. one that is not null-terminated).
Most likely an invalid pointer. I must be digging too deep but I just stumbled into a lot of problems while trying to read a few strings from a dll. File alignment, section alignment, code base, memory mapping, etc are all killers. :( The struct gives me pointers to strings' addresses, but I must take into account all of the above to get to the actual data and I haven't gotten around to doing that properly yet, so I guess I've been passing a wrong pointer to MulDiv all along.

Anyway, too much digressing. Thanks again for the improvements! :)

[EDIT]
Uhm... I just tested the new version and it doesn't automatically parse the struct member names now - getting a parse error dialog for every struct member. I'm thinking it could either use the original struct member names when present (as before) or automatically enumerate members when the member name is left blank.

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 29th, 2008, 10:38 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
There was an error in a regular expression which prevented types without a leading keyword (like "unsigned") from being recognized. It has been corrected.
Quote:
File alignment, section alignment, code base, memory mapping, etc are all killers.
I have not had any issues with any of these. If the pointer value is the address of a valid null-terminated string, the MulDiv method should succeed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2008, 7:07 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Dunno, maybe I'm too tired, but it just won't budge. I even built myself an error code parser to figure out faster what kind of error I'm getting. :(
Guess I'll be working to finish that thing first and then get back to processing dll data.

As for StructParser, it looks better now, thanks. Only thing is it still won't get the (proper) name of the struct when edit field is empty. My guess (haven't looked into the code) is you're trying to get the original name from the beginning of the declaration, while it might be better to get it from the end of the struct.

Some structs do have more names there (I'm not that familiar with C/C++ programming) but the very first one right after the closing brace should be perfect, IMHO.

So, in my example below, PLUGININFOEX would be the right name.
Code:
typedef struct {
   int cbSize;
   char *shortName;
   DWORD version;
   char *description;
   char *author;
   char *authorEmail;
   char *copyright;
   char *homepage;
   BYTE flags;
   int replacesDefaultModule;
   MUUID uuid;
   } PLUGININFOEX;

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2008, 8:37 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Drugwash wrote:
Only thing is it still won't get the (proper) name of the struct when edit field is empty.
It was never my intention to (automatically) name the variables after the type of struct. I explained this in one of my previous posts.
Quote:
My guess (haven't looked into the code) is you're trying to get the original name from the beginning of the declaration,
No; StructParser uses the name you give it, and nothing more. The default name (struct) is applied if you empty the name field to avoid generating invalid code.
Quote:
Some structs do have more names there
The forms I am familiar with are:
Code:
struct A { ... };
typedef struct _B { ... } B, *PB;
A and _B are the names of structs, while B and PB are type definitions based on _B (PB is a pointer type). B and PB are not strictly part of the struct definition.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2008, 5:43 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
My bad then, apologies. :oops:

_________________
AHK tools by Drugwash (AHK 1.0.48.05 and Win98SE)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2011, 12:56 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
Little love bump..
Image

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group