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