Hi,
let me explain you what actually am trying to do.
writeprinter() function in a rendering plug-in of a Unidrv printer driver if
implemented , enables us to capture the out put data generated by the Unidrv
printer driver.
So am trying to implement this function there by capturing the data the
driver is giving out. So , for this i have written a function which opens a
file captures the driver data .But to my surprise am not able to get any data
,but NULL is being captured.
You can see my implementation as below..
HRESULT __stdcall
COemUni2::
WritePrinter(
PDEVOBJ pdevobj,
PVOID pBuf,
DWORD cbBuffer,
PDWORD pcbWritten
)
{
BOOL bResult;
bResult = GetDriverOutput(pdevobj, pBuf, cbBuffer, pcbWritten);
if(bResult)
{
return S_OK;
}
return S_FALSE;
}
BOOL GetDriverOutput(PDEVOBJ pdevobj, PVOID pBuf, DWORD cbBuffer, PDWORD
pcbWritten) {
FILE *fp1;
char* sFile;
sFile = "E:\\result.txt";
HANDLE hFile1 = CreateFile((LPCTSTR)sFile, GENERIC_WRITE |
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if( (fp1 = fopen( sFile, "w" )) == NULL ){
return FALSE;
}
fprintf(fp1, "%s", pBuf);
fclose(fp1);
CloseHandle(hFile1);
return TRUE;
}
This is what i implemented. I dont know why NULL is being captured ....
Now my objective is to capture the correct out put data generated by Unidrv
driver and also i should send this data what ever captured ,to the print
spooler for printing and this should be done automatically by my function .
So please throw some light , by giving me some idea on how do i do this and
please let me know where exactly am going wrong.
Thanks in advance for your time and help.
Please let me know if you still want any more details from my side.
Thanks,