Commit 62e017c9 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

localspl: Support Port handles in WritePrinter.

parent 6bb5bb44
......@@ -3223,23 +3223,38 @@ static DWORD WINAPI fpStartDocPrinter(HANDLE hprinter, DWORD level, BYTE *doc_in
static BOOL WINAPI fpWritePrinter(HANDLE hprinter, void *buf, DWORD size, DWORD *written)
{
printer_t *printer = (printer_t *)hprinter;
handle_header_t *header = (handle_header_t *)hprinter;
TRACE("(%p, %p, %ld, %p)\n", hprinter, buf, size, written);
if(!printer || printer->header.type != HANDLE_PRINTER)
if (!header)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if(!printer->doc)
if (header->type == HANDLE_PORT)
{
SetLastError(ERROR_SPL_NO_STARTDOC);
return FALSE;
port_t *port = (port_t *)hprinter;
return port->mon->monitor.pfnWritePort(port->hport, buf, size, written);
}
if (header->type == HANDLE_PRINTER)
{
printer_t *printer = (printer_t *)hprinter;
if (!printer->doc)
{
SetLastError(ERROR_SPL_NO_STARTDOC);
return FALSE;
}
return WriteFile(printer->doc->hf, buf, size, written, NULL);
}
return WriteFile(printer->doc->hf, buf, size, written, NULL);
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
static BOOL WINAPI fpSetJob(HANDLE hprinter, DWORD job_id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment