flat assembler
Message board for the users of flat assembler.

Index > Windows > Any validators for fasm?

Author
Thread Post new topic Reply to topic
AE



Joined: 07 Apr 2022
Posts: 70
AE 17 Nov 2022, 18:07
I recently encountered a situation where GetCursorPos returned an error just because 'Mouse POINT' was not aligned in the data section.

So the question is, are there any tools or IDEs to check such things?
Post 17 Nov 2022, 18:07
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 17 Nov 2022, 20:49
if you know what happened, it means you know the way to check such things
Smile
Post 17 Nov 2022, 20:49
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20301
Location: In your JS exploiting you and your system
revolution 17 Nov 2022, 21:24
AE wrote:
So the question is, are there any tools or IDEs to check such things?
Yes. The tool is called the OS. When you run it and it crashes then you know there is a problem. Laughing

But seriously, it could be possible to rewrite struc to monitor for unaligned addresses. However that only helps for assembly time static structures. For dynamic allocations the assembler can't know or predict, so perhaps you could write a runtime allocator to guarantee all alignments are correct.
Post 17 Nov 2022, 21:24
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 17 Nov 2022, 22:47
Just align it like this:
Code:
.data
   align 16  ; or 8
   lpPoint   POINT
.code
   invoke   GetCursorPos, lpPoint
    
Post 17 Nov 2022, 22:47
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20301
Location: In your JS exploiting you and your system
revolution 18 Nov 2022, 02:41
Dynamic structures are more tricky. IF you use 64-bit code then you can keep the stack aligned to 16. The 32-bit stack needs more attention.
Post 18 Nov 2022, 02:41
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 21 Nov 2022, 14:25
AE wrote:
I recently encountered a situation where GetCursorPos returned an error just because 'Mouse POINT' was not aligned in the data section.

So the question is, are there any tools or IDEs to check such things?

AFAIR, there used to be so-called “checked Windows builds” that did their best to fail whenever an application does something strange/bad/not-strictly-conforming-to-the-official-OS-API-documentation. Not sure if they still exist.
Post 21 Nov 2022, 14:25
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.