flat assembler
Message board for the users of flat assembler.
Index
> Main > reserve, times and dup! |
Author |
|
vid 05 Oct 2005, 12:03
ke?!? anyway:
"name db value" creates one byte with value <value> in output file. <name> is address of that byte (when program is loaded in memory). "name rb value" reserves <value> bytes with undefined contents, address of first one is stored in <name>. |
|||
05 Oct 2005, 12:03 |
|
Kenny80 05 Oct 2005, 19:45
my question is simple, what is reserve, times and dup and how do they work?
rb for me sounds like "db ?"! i'm used to masm "dup" but it seems like masm dup is same as "times" in fasm or? |
|||
05 Oct 2005, 19:45 |
|
vid 05 Oct 2005, 21:18
oh. i already explained "db" and "rb" enough i hope.
db is same as in masm i think "rb <count>" is like masm "db <count> dup(?)" - it reserves <count> bytes (but is nicer) times count <anything> just repeats <anything> <count> times, for example "times 5 db 0" is like db 0 db 0 db 0 db 0 db 0 plus you can use "%" symbol which is (innermost) repeating count: "times 5 db %" is like db 1 db 2 db 3 db 4 db 5 also "dup" works just like in MASM, you can use it too db 5 dup ('a',0) hope it helped |
|||
05 Oct 2005, 21:18 |
|
Kenny80 06 Oct 2005, 09:17
o, ya alot better hehe than info in manual about fasm!
what i meant above before was when i use this code below invoke RegQueryValueEx, [hKey], PI, 0, ValueType, [PI_DATA], PI_Data_Size in this particular question we focus on "PI_Data_Size", if i declare "PI_Data_Size" with a "rb" or "times" then it won't work, i get error back from "RegQueryValueEx" in eax (for all u who don't know if all went fine then it will return 0 in eax) and that is "EA" but if u change it to "db" then it works, so i still confused why "rb or times" don't work with that function!? hope my questions is bit easier to read now! |
|||
06 Oct 2005, 09:17 |
|
Tomasz Grysztar 06 Oct 2005, 09:29
The lpcbData parameter for the RegQueryValueEx needs to be a pointer to value containing the size of your buffer (which the function replaces with the size of data actually copied into that buffer). This means you either need to have this value initialized - you can initialize it at compilation time by using definition like "PI_Data_Size dd 100" (where 100 is the example size of your buffer); or you can define it as unitilialized, with "PI_Data_Size dd ?" or "PI_Data_Size rd 1", but then you have to initialize it at run time, before calling the RegQueryValueEx, for example with "mov [PI_Data_Size],100". The second method is actually better, because if you want to call RegQueryValueEx many times, you will have to re-initialize this variable each time any way, since RegQueryValueEx replaces the value in that variable with the data size.
|
|||
06 Oct 2005, 09:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.