flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 09 Jun 2010, 14:48
alorent wrote: Is it some kind of "forced" alignment in Windows 64? |
|||
![]() |
|
alorent 09 Jun 2010, 14:55
Thanks revolution.
I'm not sure if I got you correctly. Is each field in the structure aligned by itselft or the compiler just add "dummy" space at the end of all fields? Would it be possible to create the above structure in FASM to simulate the expected "format" in Windows? Because at the moment, the defined struct in FASM is not working as expected when is used in functions like VirtualQuery: Code: SIZE_T WINAPI VirtualQuery( __in_opt LPCVOID lpAddress, __out PMEMORY_BASIC_INFORMATION lpBuffer, __in SIZE_T dwLength ); Thanks! |
|||
![]() |
|
revolution 09 Jun 2010, 15:02
The C compiler just pads out each item to make it aligned.
Similar to this: Code: struct MEMORY_BASIC_INFORMATION align 8 BaseAddress dq 0 align 8 AllocationBase dq 0 align 4 AllocationProtect dd 0 align 8 RegionSize dq 0 ; SIZE_T is qword align 4 State dd 0 align 4 Protect dd 0 align 4 Type dd 0 align 8 ends |
|||
![]() |
|
alorent 09 Jun 2010, 20:27
Thanks revolution.
I think that the last "align 8" is not working as the final size is 30h - 4 (instead of 30h like in C) Don't you think that a macro to create such type of structures is a must for FASM when coding in Win64? Instead of us taking care of those "align's" for each parameter which just make the code looks ugly? ![]() Thanks! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.