- /* Allocate memory for a BITMAPINFOHEADER structure and a
- color table. The maximum number of colors in a color table
- is 256 which corresponds to a bitmap with depth 8.
- Bitmaps with higher depths don't have color tables. */
- bi = ExAllocatePoolWithTag(PagedPool,
- sizeof(BITMAPINFOHEADER) +
- 256 * sizeof(RGBQUAD),
- TAG_TEMP);
-
- if (bi)
+ RtlZeroMemory(&bi.bmiHeader, sizeof(bi.bmiHeader));
+ bi.bmiHeader.bV5Size = sizeof(bi.bmiHeader);
+ bi.bmiHeader.bV5Width = Width;
+ bi.bmiHeader.bV5Height = Height;
+ bi.bmiHeader.bV5Planes = dibs.dsBmih.biPlanes;
+ bi.bmiHeader.bV5BitCount = dibs.dsBmih.biBitCount;
+ bi.bmiHeader.bV5Compression = dibs.dsBmih.biCompression;
+ bi.bmiHeader.bV5SizeImage = 0;
+ bi.bmiHeader.bV5XPelsPerMeter = dibs.dsBmih.biXPelsPerMeter;
+ bi.bmiHeader.bV5YPelsPerMeter = dibs.dsBmih.biYPelsPerMeter;
+ bi.bmiHeader.bV5ClrUsed = dibs.dsBmih.biClrUsed;
+ bi.bmiHeader.bV5ClrImportant = dibs.dsBmih.biClrImportant;
+
+ if (bi.bmiHeader.bV5Compression == BI_BITFIELDS)
+ {
+ /* Copy the color masks */
+ bi.bmiHeader.bV5RedMask = dibs.dsBitfields[0];
+ bi.bmiHeader.bV5GreenMask = dibs.dsBitfields[1];
+ bi.bmiHeader.bV5BlueMask = dibs.dsBitfields[2];
+ }
+ else if (bi.bmiHeader.bV5BitCount <= 8)