KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q163878: CreateBitmap() API - Bitmap Size Limits Introduced in WinNT 4.0

Article: Q163878
Product(s): Microsoft Windows NT
Version(s): WinNT:4.0
Operating System(s): 
Keyword(s): 
Last Modified: 09-AUG-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Windows NT Workstation version 4.0 
- Microsoft Windows NT Server version 4.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

If you have an application that uses the CreateBitmap() application programming
interface (API) to create bitmaps, you may find it impossible to create bitmaps
greater than 48 MB (or less, on computers with limited RAM) when you run the
application in Windows NT 4.0.

This limit is not apparent when the application is run in Windows NT 3.51.

CAUSE
=====

This is a side effect of moving display drivers from user mode in Windows NT
3.51 to kernel mode in Windows NT 4.0.

In Windows NT 3.51, the CreateBitmap() API allocates the bitmap in user- mode
paged memory, and it is therefore possible to create bitmaps up to the maximum
size of the pagefile. Bitmap size is therefore limited only by the amount of
disk space that you can allocate to your pagefile(s) in Windows NT 3.51.

In Windows NT 4.0, the CreateBitmap() API allocates the bitmap in kernel- mode
paged memory. As Kernel-mode paged memory is a scarce resource, and exhausting
it can adversely affect system performance, application usage of Kernel-mode
paged memory is restricted to smaller allocations.

RESOLUTION
==========

To circumvent this limit, the application must be recoded to create bitmaps by
calling the CreateDIBSection() API instead of the CreateBitmap() API.

CreateDIBSection() API allocates the bitmap in user-mode paged memory, and
bitmaps created using this API are therefore not affected by the limit imposed
on kernel-mode paged memory allocations.
======================================================================
Keywords          :  
Technology        : kbWinNTsearch kbWinNTWsearch kbWinNTW400 kbWinNTW400search kbWinNT400search kbWinNTSsearch kbWinNTS400search kbWinNTS400
Version           : WinNT:4.0
Issue type        : kbprb

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.