flat assembler
Message board for the users of flat assembler.
Index
> Windows > VirtualAlloc Trouble. |
Author |
|
typedef 04 Jan 2012, 19:49
let the system do it for you the second call.
|
|||
04 Jan 2012, 19:49 |
|
Overflowz 04 Jan 2012, 20:03
typedef
What you mean ? |
|||
04 Jan 2012, 20:03 |
|
typedef 04 Jan 2012, 20:09
Leave out the address parameter to null and the system will find the appropriate address for you
|
|||
04 Jan 2012, 20:09 |
|
Overflowz 04 Jan 2012, 20:31
I know that, but I need it to be allocated at that address :/ trying to write windows PE loader manually.
I did like this, but imports are not correct I don't know what is happening.. Image is loaded at 50000000h, file is in buffer and when I allocated space equal to IMAGE_NT_HEADERS.OptionalHeader.SizeOfImage and copied IMAGE_DOS_HEADER, IMAGE_NT_HEADERS and all sections there, but it didn't loaded cause of import calls are wrong. Did I miss something ? |
|||
04 Jan 2012, 20:31 |
|
aq83326 05 Jan 2012, 07:06
http://blogs.msdn.com/b/oldnewthing/archive/2003/10/08/55239.aspx
Maybe: VirtualAlloc cannot reserve a reserved page, but the documentation doesn't say what happens if you try to do so-I'd like to know what happens too. The allocation granularity is likely 64k, thus the first call to VirtualAlloc reserves and commits 64k rather than the single page necessary to hold 200h. So even though the addresses are likely a page apart (4k being the usual page size) you are reserving a reserved page. So see what happens when you try to reserve a reserved page and try just using MEM_COMMIT by itself for that second line to see what happens. |
|||
05 Jan 2012, 07:06 |
|
Overflowz 05 Jan 2012, 08:55
Thanks, I'm working on it now.
|
|||
05 Jan 2012, 08:55 |
|
f0dder 05 Jan 2012, 23:27
Check http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958%28v=vs.85%29.aspx , notably the allocation granularity - don't blindly assume 64k.
|
|||
05 Jan 2012, 23:27 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.