Commit b09f8714 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

localspl: Add cups port extension.

parent ee147d92
MODULE = localspl.dll MODULE = localspl.dll
UNIXLIB = localspl.so UNIXLIB = localspl.so
IMPORTS = spoolss user32 advapi32 IMPORTS = spoolss user32 advapi32
UNIX_CFLAGS = $(CUPS_CFLAGS)
UNIX_LIBS = $(APPLICATIONSERVICES_LIBS)
EXTRADLLFLAGS = -Wb,--prefer-native EXTRADLLFLAGS = -Wb,--prefer-native
......
...@@ -96,7 +96,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -96,7 +96,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hinstDLL ); DisableThreadLibraryCalls( hinstDLL );
localspl_instance = hinstDLL; localspl_instance = hinstDLL;
return !__wine_init_unix_call(); if (__wine_init_unix_call())
return FALSE;
UNIX_CALL(process_attach, NULL);
break;
} }
return TRUE; return TRUE;
} }
...@@ -506,8 +509,7 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name, ...@@ -506,8 +509,7 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name,
TRACE("(%p %s %ld %ld %p)\n", hport, debugstr_w(printer_name), TRACE("(%p %s %ld %ld %p)\n", hport, debugstr_w(printer_name),
job_id, level, doc_info); job_id, level, doc_info);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME || if (port->type >= PORT_IS_WINE)
port->type == PORT_IS_LPR)
{ {
struct start_doc_params params; struct start_doc_params params;
...@@ -516,6 +518,7 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name, ...@@ -516,6 +518,7 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name,
params.type = port->type; params.type = port->type;
params.port = port->nameW; params.port = port->nameW;
params.document_title = doc_info ? doc_info->pDocName : NULL;
params.doc = &port->doc_handle; params.doc = &port->doc_handle;
return UNIX_CALL(start_doc, &params); return UNIX_CALL(start_doc, &params);
} }
...@@ -547,12 +550,17 @@ static BOOL WINAPI localmon_WritePort(HANDLE hport, BYTE *buf, DWORD size, ...@@ -547,12 +550,17 @@ static BOOL WINAPI localmon_WritePort(HANDLE hport, BYTE *buf, DWORD size,
TRACE("(%p %p %lu %p)\n", hport, buf, size, written); TRACE("(%p %p %lu %p)\n", hport, buf, size, written);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME || if (port->type >= PORT_IS_WINE)
port->type == PORT_IS_LPR)
{ {
struct write_doc_params params; struct write_doc_params params;
BOOL ret; BOOL ret;
if (!port->doc_handle)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
params.doc = port->doc_handle; params.doc = port->doc_handle;
params.buf = buf; params.buf = buf;
params.size = size; params.size = size;
...@@ -570,11 +578,13 @@ static BOOL WINAPI localmon_EndDocPort(HANDLE hport) ...@@ -570,11 +578,13 @@ static BOOL WINAPI localmon_EndDocPort(HANDLE hport)
TRACE("(%p)\n", hport); TRACE("(%p)\n", hport);
if (port->type == PORT_IS_PIPE || port->type == PORT_IS_UNIXNAME || if (port->type >= PORT_IS_WINE)
port->type == PORT_IS_LPR)
{ {
struct end_doc_params params; struct end_doc_params params;
if (!port->doc_handle)
return TRUE;
params.doc = port->doc_handle; params.doc = port->doc_handle;
port->doc_handle = 0; port->doc_handle = 0;
return UNIX_CALL(end_doc, &params); return UNIX_CALL(end_doc, &params);
......
...@@ -171,6 +171,7 @@ struct start_doc_params ...@@ -171,6 +171,7 @@ struct start_doc_params
{ {
unsigned int type; unsigned int type;
const WCHAR *port; const WCHAR *port;
const WCHAR *document_title;
INT64 *doc; INT64 *doc;
}; };
...@@ -190,6 +191,7 @@ struct end_doc_params ...@@ -190,6 +191,7 @@ struct end_doc_params
enum cups_funcs enum cups_funcs
{ {
unix_process_attach,
unix_start_doc, unix_start_doc,
unix_write_doc, unix_write_doc,
unix_end_doc, unix_end_doc,
......
...@@ -988,7 +988,8 @@ static monitor_t * monitor_load_by_port(LPCWSTR portname) ...@@ -988,7 +988,8 @@ static monitor_t * monitor_load_by_port(LPCWSTR portname)
TRACE("(%s)\n", debugstr_w(portname)); TRACE("(%s)\n", debugstr_w(portname));
/* wine specific ports */ /* wine specific ports */
if (portname[0] == '|' || portname[0] == '/') if (portname[0] == '|' || portname[0] == '/' ||
!wcsncmp(portname, L"LPR:", 4) || !wcsncmp(portname, L"CUPS:", 5))
return monitor_load(L"Local Port", NULL); return monitor_load(L"Local Port", NULL);
/* Try the Local Monitor first */ /* Try the Local Monitor first */
......
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