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

ID: Q85844

3.50 3.51 WINDOWS NT kbgraphic kbprb
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT, versions 3.5, 3.51


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.

Additional query words: 3.10

Keywords : kbNTOS350 kbNTOS351 kbSDKWin32 kbDSupport
Version : winnt:3.5,3.51
Platform : winnt
Issue type : kbprb


Last Reviewed: July 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.