Author Topic: BITMAP STRUCT in win64.inc  (Read 1913 times)

0000

  • Member
  • ****
  • Posts: 872
BITMAP STRUCT in win64.inc
« on: July 20, 2018, 06:38:39 AM »
While converting a program down to 32 bits, I noticed a potential flaw in win64.inc (as pointed out by Vortex)


The BITMAP structure in Windows.inc (32 bit) is defined as


Code: [Select]



BITMAP STRUCT
  bmType        DWORD       ?
  bmWidth       DWORD       ?
  bmHeight      DWORD       ?
  bmWidthBytes  DWORD       ?
  bmPlanes      WORD        ?
  bmBitsPixel   WORD        ?
  bmBits        DWORD       ?
BITMAP ENDS

in win64.inc:

Code: [Select]
  BITMAP STRUCT
    bmType   LONG ?
    bmWidth   LONG ?
    bmHeight  LONG ?
    bmWidthBytes LONG ?
    mPlanes   WORD ?   ;<-- error?
    mBitsPixel  WORD ? ;<-- error?
    DWORD ?                ;junction?
    mBits   LPVOID ?      ;<--error?
  BITMAP ENDS







Vortex

  • Member
  • *****
  • Posts: 2588
Re: BITMAP STRUCT in win64.inc
« Reply #1 on: July 20, 2018, 06:45:20 AM »
Hi zedd,

Thinking now about the structure :

Code: [Select]
  BITMAP STRUCT
    bmType   LONG ?
    bmWidth   LONG ?
    bmHeight  LONG ?
    bmWidthBytes LONG ?
    mPlanes   WORD ?
    mBitsPixel  WORD ?
    DWORD ?
    mBits   LPVOID ?
  BITMAP ENDS

The last DWORD entry is for the alignment. The small name differences like mPlanes vs bmPlanes should not be a problem.

0000

  • Member
  • ****
  • Posts: 872
Re: BITMAP STRUCT in win64.inc
« Reply #2 on: July 20, 2018, 06:51:28 AM »
Hi zedd,

Thinking now about the structure :


The last DWORD entry is for the alignment.


Okay, I'll buy that.



Quote
The small name differences like mPlanes vs bmPlanes should not be a problem.


But for a conversion to 32 bits, the names would have to be changed then, as I have done to reflect the names in windows.inc. (32 bit)


Reference:


gdi BITMAP STRUCT

Vortex

  • Member
  • *****
  • Posts: 2588
Re: BITMAP STRUCT in win64.inc
« Reply #3 on: July 20, 2018, 07:15:09 AM »
Hi zedd,

The member names of the structures are not important for the assemblers\compilers. They are necessary for us to read and distinguish them.

0000

  • Member
  • ****
  • Posts: 872
Re: BITMAP STRUCT in win64.inc
« Reply #4 on: July 20, 2018, 07:18:16 AM »
But if you use the wrong name, ml throws an error. Thats when I first encountered it. I had not known at the time that the names were specified differently in win64.inc and windows.inc.