I am trying to get a test page printed from the Windows Driver Kit (WDK) 8.1 Samples (the bitmap sample). Since I did not get any print output, I placed a "GetLastError" call after each call to 'DrvWriteSpoolBuf":
dwWritten = pDevObj->pDrvProcs->DrvWriteSpoolBuf(pDevObj, (void*)&(pOemPDEV->bmFileHeader), sizeof(BITMAPFILEHEADER));
DWORD pdwReturn = GetLastError();
if (pdwReturn != ERROR_SUCCESS)
ERR("OEMEndDoc: Error printing=%ld\n", pdwReturn);
I received Error 183 !!! From System Error Codes:
ERROR_ALREADY_EXISTS
183 (0xB7)
Cannot create a file when that file already exists.
Alternate version of call above
DWORD res = pOemPDEV->pOEMHelp->DrvWriteSpoolBuf(pDevObj, &(pOemPDEV->bmFileHeader), sizeof(BITMAPFILEHEADER), &dwWritten);
I get res=E_FAIL
(apology for using bold - comments seem to overlook this result though)
How can I get such an error from printing ? (either to LPT1 or FILE: port)
I have tested the code by saving to a bitmap the exact contents I am trying to send to he spooler, the bitmap was created correctly.
...I apologize for not including more code, it is available at the link I posted above... Windows Driver Kit (WDK) 8.1 Samples
Windows Driver Kit (WDK) 8.1 Samples\OEM Printer Customization Plug-in Samples\C++\bitmap
It seems that, because of a function that was implemented and not disabled, there were two different methods to process image data... I was not aware that each sent their output to the spooler (generating the ERROR_ALREADY_EXISTS
... is my guess)
(more precisely, while I did not implement FilterGraphics
, but only ImageProcessing
, I also should have returned S_FALSE
for FilterGraphics
in the GetImplementedMethod
)