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

localspl: Add cups port extension.

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