Microsoft KB Archive/85844

{|
 * width="100%"|

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

 * }

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 Server versions 3.5, 3.51
 * Microsoft Windows NT Workstation 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 : kbOSWinNT350 kbOSWinNT351 kbSDKWin32 kbDSupport

Issue type : kbprb

Technology : kbAudDeveloper kbWin32sSearch kbWin32API