News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetObject Fails if Bitmap Alignment not even

Started by Jimg, February 06, 2009, 05:58:02 PM

Previous topic - Next topic

Jimg

After screwing around for a few hours, I finally found out what was causing the problem with my program, and I thought I'd document it here in case it comes up for someone else.

The GetObject api fails if the BITMAP memory does not start on an even word boundary.

.data?
align 4
hBmp dd ?
tstbyte db ?
btmap   BITMAP <>  ; misaligned bitmap
.code
.
.
.
inv GetObject,hBmp,sizeof btmap,addr btmap

Works fine if I align btmap, otherwise it just returns a zero, and GetLastError returns "Error code 0, the operation completed successfully".