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

localspl: Return error if cups port handle is used from different threads.

parent b09f8714
......@@ -66,6 +66,7 @@ typedef struct {
struct list entry;
DWORD type;
HANDLE hfile;
DWORD thread_id;
INT64 doc_handle;
WCHAR nameW[1];
} port_t;
......@@ -516,6 +517,8 @@ static BOOL WINAPI localmon_StartDocPort(HANDLE hport, WCHAR *printer_name,
if (port->doc_handle)
return TRUE;
port->thread_id = GetCurrentThreadId();
params.type = port->type;
params.port = port->nameW;
params.document_title = doc_info ? doc_info->pDocName : NULL;
......@@ -561,6 +564,13 @@ static BOOL WINAPI localmon_WritePort(HANDLE hport, BYTE *buf, DWORD size,
return FALSE;
}
if (port->type == PORT_IS_CUPS && port->thread_id != GetCurrentThreadId())
{
FIXME("used from other thread\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
params.doc = port->doc_handle;
params.buf = buf;
params.size = size;
......@@ -585,6 +595,13 @@ static BOOL WINAPI localmon_EndDocPort(HANDLE hport)
if (!port->doc_handle)
return TRUE;
if (port->type == PORT_IS_CUPS && port->thread_id != GetCurrentThreadId())
{
FIXME("used from other thread\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
params.doc = port->doc_handle;
port->doc_handle = 0;
return UNIX_CALL(end_doc, &params);
......
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