flat assembler
Message board for the users of flat assembler.

Index > Windows > Arrays??

Author
Thread Post new topic Reply to topic
neounk



Joined: 24 Sep 2006
Posts: 9
neounk 24 Sep 2006, 19:02
I'v read the documentation and I can't get arrays to work. I'm trying to make an array inside a structure (MODULEENTRY32) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/moduleentry32_str.asp but I cant get it to work.
Post 24 Sep 2006, 19:02
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 24 Sep 2006, 19:16
post your code which doesn't work and error returned.
Post 24 Sep 2006, 19:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 25 Sep 2006, 10:30
TCHAR szModule[MAX_MODULE_NAME32 + 1]
in (f)asm: szModule du MAX_MODULE_NAME32+1 dup(?)

TCHAR szExePath[MAX_PATH];
in (f)asm: szExePath du MAX_PATH dup(?)
Post 25 Sep 2006, 10:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 25 Sep 2006, 10:55
"du" or "db" depending on whether you use "A" or "W" functions.
fasm's headers have CHAR type defined for this purpose:
Code:
szModule CHAR MAX_MODULE_NAME32+1 dup(?)    
Post 25 Sep 2006, 10:55
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Sep 2006, 10:59
i really don't know then... you should maybe ask tomasz.

i really am not a big user of "struct" macro Wink
Post 25 Sep 2006, 10:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
neounk



Joined: 24 Sep 2006
Posts: 9
neounk 25 Sep 2006, 17:06
Thanks. Works now. Heres the struct incase anyone is interested:

struct MODULEENTRY32
dwSize dd ?
th32ModuleID dd ?
th32ProcessID dd ?
GlblcntUsage dd ?
ProccntUsage dd ?
modBaseAddr db ?
modBaseSize dd ?
hModule dd ?
szModule du 256h dup(?)
szExePath du 260h dup(?)
ends

although I'm not sure how to get BYTE* (think this is a pointer) working.
Post 25 Sep 2006, 17:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Sep 2006, 18:13
tomasz: i wanted to point out this later... don't you think it just blind following of "common" way to implement ansi and unicode versions with common interface, like in C? in C it is possible to manipulate these with (roughly) same code, but not in assembly.

Why not just do it directly? One file with imports for both ***A and ***W functions, and coders should know which he is using, and he can use both...
Post 25 Sep 2006, 18:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 25 Sep 2006, 18:28
You're right, that would be much more assembly-like.
I perhaps cared too much about compatibility here (while not at all in some other areas).
Post 25 Sep 2006, 18:28
View user's profile Send private message Visit poster's website Reply with quote
neounk



Joined: 24 Sep 2006
Posts: 9
neounk 25 Sep 2006, 18:31
Well I only use A versions. No specific reason why (habit I guess). Any idea what i would need to use BYTE* (no idea what this doesn in C, since I'v never done much C) or would it work fine like that?

Thanks for all your help so far Smile
Post 25 Sep 2006, 18:31
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Sep 2006, 18:35
do you think it's too late to break backward compatibility? For sure some people won't be very happy, but it would be nice to have this "clear", and if it should be done, then better sooner than later...

and, yes, you managed to spare us of "common way" in many areas Wink
Post 25 Sep 2006, 18:35
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 25 Sep 2006, 18:55
Well, the idea appeals to me.
However note, that the "common" way still has the advantages spared even by fasm sometimes - the HELLO example will compile and execute correctly when you change WIN32AX to WIN32WX.
Post 25 Sep 2006, 18:55
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Sep 2006, 19:13
well... in case of helloworld-like programs yes, but not after you modify single string by asm code... you know.

right now i am working on static string library, and i am becoming scared when i will have to port it to unicode Very Happy Wink
Post 25 Sep 2006, 19:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 25 Sep 2006, 19:14
I think you'd be REALLY scared if you had to port it to UTF-8 Wink Very Happy
Post 25 Sep 2006, 19:14
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Sep 2006, 21:18
hehe Wink
Post 25 Sep 2006, 21:18
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.