The MASM Forum

Miscellaneous => The Orphanage => Topic started by: shankle on December 01, 2018, 08:50:45 AM

Title: bitmapinfoheader
Post by: shankle 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"
Title: Re: bitmapinfoheader
Post by: Vortex 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 (http://masm32.com/board/index.php?topic=7185.0), you can find an example.
Title: Re: bitmapinfoheader
Post by: shankle 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?
Title: Re: bitmapinfoheader
Post by: Vortex 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
Title: Re: bitmapinfoheader
Post by: jj2007 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.
Title: Re: bitmapinfoheader
Post by: AW 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.