Author Topic: bitmapinfoheader  (Read 163 times)

shankle

  • Member
  • ****
  • Posts: 801
bitmapinfoheader
« on: December 01, 2018, 08:50:45 AM »
Could someone translate the "C" version of a 64-bit BitMapInfoHeader into masm
please. I have looked but can find nothing but a "C" version.
I don't do "C"

Vortex

  • Member
  • *****
  • Posts: 1873
Re: bitmapinfoheader
« Reply #1 on: December 01, 2018, 09:05:39 AM »
Hi shankle,

Code: [Select]
BITMAPINFOHEADER STRUCT

  biSize            DWORD      ?
  biWidth           DWORD      ?
  biHeight          DWORD      ?
  biPlanes          WORD       ?
  biBitCount        WORD       ?
  biCompression     DWORD      ?
  biSizeImage       DWORD      ?
  biXPelsPerMeter   DWORD      ?
  biYPelsPerMeter   DWORD      ?
  biClrUsed         DWORD      ?
  biClrImportant    DWORD      ?

BITMAPINFOHEADER ENDS

Here, you can find an example.

shankle

  • Member
  • ****
  • Posts: 801
Re: bitmapinfoheader
« Reply #2 on: December 01, 2018, 09:52:51 AM »
Thank you Vortex for replying.
So biwidth, biheight, bixpelspermeter & biypelspermeter are not 64-bits long.
I thought they were. And I guess DD will work in a 64-bit system?

Vortex

  • Member
  • *****
  • Posts: 1873
Re: bitmapinfoheader
« Reply #3 on: December 01, 2018, 07:41:21 PM »
Hello shankle,

You are right. Looking at the original C declaration of the structure :

Code: [Select]
typedef struct tagBITMAPINFOHEADER {
  DWORD biSize;
  LONG  biWidth;
  LONG  biHeight;
  WORD  biPlanes;
  WORD  biBitCount;
  DWORD biCompression;
  DWORD biSizeImage;
  LONG  biXPelsPerMeter;
  LONG  biYPelsPerMeter;
  DWORD biClrUsed;
  DWORD biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;

Building the code below as 64-bit :

Code: [Select]
#include <stdio.h>
#include <windows.h>

int main()
{
BITMAPINFOHEADER *bi;
printf("sizeof(BITMAPINFOHEADER->biWidth)=%u\n",sizeof(bi->biWidth));
return 0;
}

Code: [Select]
sizeof(BITMAPINFOHEADER->biWidth)=4

jj2007

  • Member
  • *****
  • Posts: 8896
  • Assembler is fun ;-)
    • MasmBasic
Re: bitmapinfoheader
« Reply #4 on: December 02, 2018, 01:57:07 AM »
Many structures are identical for 32- and 64-bit code. The exceptions concern mostly pointers and handles.

AW

  • Member
  • *****
  • Posts: 1608
  • Let's Make ASM Great Again!
Re: bitmapinfoheader
« Reply #5 on: December 02, 2018, 08:16:50 AM »
This means that the same bmp file works without change in either 32 or 64 bit. Thanks God.