PRB: Saving/Loading Bitmaps in .DIB Format on MIPS (85844)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • Microsoft Windows NT Server 3.5
    • Microsoft Windows NT Server 3.51
    • Microsoft Windows NT Workstation 3.5
    • Microsoft Windows NT Workstation 3.51

This article was previously published under Q85844
3.50 3.51 WINDOWS NT kbgraphic kbprb

SYMPTOMS

In Win32, saving or loading a bitmap in .dib file format is basically the same as in Win16. However, care must be taken in DWORD alignment, especially on the MIPS platform.

An exception occurs when loading or saving a bitmap on the MIPS platform. In NTSD, the following error message appears:
data mis-alignment

CAUSE

A non-DWORD aligned actual parameter was passed to a function such as GetDIBits().

The .dib file format contains the BITMAPFILEHEADER followed immediately by the BITMAPINFOHEADER. Notice that the BITMAPFILEHEADER is not DWORD aligned. Thus, the structure that follows it, the BITMAPINFOHEADER, is not on a DWORD boundary. If a pointer to this DWORD misaligned structure is passed to the sixth argument of GetDIBits(), an exception occurs.

RESOLUTION

To resolve this problem, copy the data in the structure over to a DWORD- aligned memory and pass the pointer to the latter structure to the function instead. See the sample code LOADBMP.C for detail.

STATUS

This behavior is by design.

MORE INFORMATION

The is a sample to illustrates this process. Refer to the LOADBMP.C file in the MANDEL sample that comes with the Win32 SDK.

Modification Type:MinorLast Reviewed:2/11/2005
Keywords:kbprb KB85844