I have a monolithic print driver built with the very latest DDK from MSDN.
The driver installs fine, and shows up in the lsit of asvailable printers.
When I print to it, all of the communications witrh the GDI are working good.
The problem happens when I try to switch from Engine Managed Surface to Device Managed Surface. I believe that I do not fully understand the difference between EngCreateBitmap and EngCreateDeviceSurface.
The surface of my device is fairly large (36" x 24") and resolve to a high dpi (5000 dpi.)
My device is also 24 bit color, so I need 24 bit surface bitmap.
The device surface is a raster AND a vector device.
36" x 5000 dpi = 180,000 pixels per scanline, x 3 (for 24 bit) = 540,000 bytes per scanline.
24" x 5000 dpi = 120,000 scanlines.
540,000 x 120,000 = 64,800,000,000 bytes
which is 60.349 GB
I have no intention of actually creating a bitmap that large. My goal is to “covince” the GDI that I have already created such a bitmap (perhaps in device memory) and that the GDI can therefore send all of the vectors fro a full contiguous page over at 5000 dpi.
I have no intentions of punting back to the GDI. I want to absorb the calls (all of which i have hooked) and take of writing to the device myself.
I notcies that the documentation for EngCreateDeviceSyrface says that I can “optimoally provide the surface memory” myself. I also note that after a call to EngCreateDeviceSurface that the returned surface contains pointer to pvBits, nor a delta, etc. This is good, because I intend to take care fo the rendering myself. it is my understanding that when I afterwards call EngModifySurface that I should still keep the GDI in the dark concering the pvBits and the Delta, etc.
The problem is that my call to EngCreateDeviceSurface fails, with an error code of zero.
My call looks like this…
SIZEL surfacedim;
surfacedim.cx = 180000;
surfacedim.cy = 120000;
mypdev->surface = EngCreateDeviceSurface((DHSURF)mpdev, surfacedim, BMF_24BPP);
I know I missing a point here somewhere… does EngCreateDeviceSurface actually TRY to allocate the 60 GB bitmap in this case, and thereby fails, or does EngCreateDeviceSurface NEVER try to allocate, and it is up to the driver to allocate and then use EngModifySurface to inform?
In the second case, I still have no intention of asking the OS to allocate the 60 GB bitmap. I merely need the GDI to believe that I have done som, so that the printing process can begin and I can start recieving all of the hooked DrvXXX calls for the full apge in fill color at a resolution of 5000 dpi.
So how am i failing to convince the GDI that I have the surface “taken care of”?
Cary Johnston