Nope, your code sets the *pointer* to 30, not the value it points to.


mov eax,
mov byte ptr , 30

...
mov eax,
inc byte ptr


hope this helps :)
Posted on 2006-01-18 08:52:03 by f0dder
well its one step closer... does not seem to work.. instead, it is increasing the returned pointer value..
Posted on 2006-01-18 21:04:13 by resistance_is_futile

well its one step closer... does not seem to work.. instead, it is increasing the returned pointer value..

That's what your code would do - you have to load the pointer value into a register first, then access the memory via the register. And you *have* to use the indirection-brackets for that...
Posted on 2006-01-19 07:52:43 by f0dder
oic. that code should still work though...hmm it may be something I am doing further down in the code. See the program is a type of miniature game. What it does is allocates the memory at a seperate address each time and afterwards, puts the decimal value into the address so it can be modified later on. Once the app starts, the count is started at 30 and increased from there each time a button is pushed and then formatted and printed out in decimal form on the screen. Sorry if it seems that I am being a bit ignorant on the subject because, well I am lol. I dont have much experience with memory manipulation.

Any back to the subject. My program further down is converting like this. I think that part of my problem might be my wsprintf call:


format db "%lu",0
thirty db 256 dup (?)
...

invoke wsprintf, addr thirty, addr format, use_this_pointer


This should work okay correct? Again I apologize for the inconvenience.

RIF
Posted on 2006-01-19 17:58:18 by resistance_is_futile
nope, this way will still print the value of "use_this_pointer". Remember, the variable "use_this_pointer" is an address to the memory you allocated - so when you write "use_this_pointer", you don't get the "thirsty" value, you get the address of "thirsty". To get thirsty, you need indirection via a register:


format db "%lu",0
thirty db 256 dup (?)
...

mov eax,
invoke wsprintf, addr thirty, addr format, dword ptr


(note that if you use any local variables with "addr" in an invoke statement, EAX will be clobbered and you need to use another register for the indirection).
Posted on 2006-01-19 18:20:01 by f0dder
Awesome works absolutely perfect. Thanks again fellas
Posted on 2006-01-20 00:32:48 by resistance_is_futile