flat assembler
Message board for the users of flat assembler.
Index
> Windows > HeapAlloc problems |
Author |
|
okasvi 30 Apr 2006, 14:49
this is how i would do it, but you cant limit the heap for 10bytes
Code: format PE GUI 4.0 entry start include '%fasminc%\win32a.inc' section '.text' code readable executable start: ;heapcreate push 0 push 0 push 0 call [HeapCreate] mov [hHeap], eax ;heapalloc push 10 push 0 push [hHeap] call [HeapAlloc] mov [va],eax push s1 push sFormat push Buffer call [wsprintf] push Buffer push sFormat push va call [wsprintf] push 0 push va push va push 0 call [MessageBox] ;End push 0 call [ExitProcess] section '.data' Data readable writeable hHeap dd 0 sFormat db '%s',0 Buffer rb 1024 va dd ? s0 db "error",0 s1 db "0123456789abc",0 data import library kernel32, 'kernel32.dll', \ user32, 'user32.dll' import kernel32, \ ExitProcess,'ExitProcess', \ HeapCreate,'HeapCreate',\ HeapAlloc,'HeapAlloc' import user32, \ MessageBox,'MessageBoxA',\ wsprintf, 'wsprintfA' end data Quote:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/heapcreate.asp |
|||
30 Apr 2006, 14:49 |
|
Killswitch 30 Apr 2006, 16:32
Thanks, but I've just tested your code, and it's still got the same problem - va contains '0123456789abc' which exceeds the 10 bytes I allocated to va.
|
|||
30 Apr 2006, 16:32 |
|
okasvi 30 Apr 2006, 16:48
Killswitch wrote: Thanks, but I've just tested your code, and it's still got the same problem - va contains '0123456789abc' which exceeds the 10 bytes I allocated to va. so you didnt bother to read what i quoted from msdn, it rounds it to next page boundary, no matter what you do... _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
30 Apr 2006, 16:48 |
|
Killswitch 30 Apr 2006, 17:05
Sorry - thanks a lot for your help!
|
|||
30 Apr 2006, 17:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.