Commit 58c6bab9 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Don't hold the GDI lock while calling the driver printer functions.

parent b12a782e
......@@ -497,7 +497,6 @@ INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
HDC hdc;
DC *dc;
INT ret = -1;
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
TRACE("(%p, %p, %s, %s, %p, %s, %d)\n",
hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
......@@ -511,13 +510,12 @@ INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
if ((dc = DC_GetDCPtr( hdc )))
if ((dc = get_dc_ptr( hdc )))
{
pExtDeviceMode = dc->funcs->pExtDeviceMode;
DC_ReleaseDCPtr( dc );
if (pExtDeviceMode)
ret = pExtDeviceMode(buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
lpdmInput, lpszProfile, fwMode);
if (dc->funcs->pExtDeviceMode)
ret = dc->funcs->pExtDeviceMode( buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
lpdmInput, lpszProfile, fwMode );
release_dc_ptr( dc );
}
DeleteDC( hdc );
return ret;
......@@ -566,12 +564,12 @@ DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
if ((dc = DC_GetDCPtr( hdc )))
if ((dc = get_dc_ptr( hdc )))
{
if (dc->funcs->pDeviceCapabilities)
ret = dc->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
fwCapability, lpszOutput, lpdm );
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
}
DeleteDC( hdc );
return ret;
......@@ -695,12 +693,12 @@ INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
INT cbOutput, LPSTR lpszOutData )
{
INT ret = 0;
DC * dc = DC_GetDCPtr( hdc );
DC * dc = get_dc_ptr( hdc );
if (dc)
{
if (dc->funcs->pExtEscape)
ret = dc->funcs->pExtEscape( dc->physDev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
}
return ret;
}
......
......@@ -71,7 +71,7 @@ static const char Printers[] = "System\\CurrentControlSet\\Control\\Pri
INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
{
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
TRACE("DocName = %s Output = %s Datatype = %s\n",
debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
......@@ -80,7 +80,7 @@ INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
if(!dc) return SP_ERROR;
if (dc->funcs->pStartDoc) ret = dc->funcs->pStartDoc( dc->physDev, doc );
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
return ret;
}
......@@ -136,11 +136,11 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
INT WINAPI EndDoc(HDC hdc)
{
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if(!dc) return SP_ERROR;
if (dc->funcs->pEndDoc) ret = dc->funcs->pEndDoc( dc->physDev );
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
return ret;
}
......@@ -152,14 +152,14 @@ INT WINAPI EndDoc(HDC hdc)
INT WINAPI StartPage(HDC hdc)
{
INT ret = 1;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if(!dc) return SP_ERROR;
if(dc->funcs->pStartPage)
ret = dc->funcs->pStartPage( dc->physDev );
else
FIXME("stub\n");
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
return ret;
}
......@@ -170,19 +170,17 @@ INT WINAPI StartPage(HDC hdc)
*/
INT WINAPI EndPage(HDC hdc)
{
ABORTPROC abort_proc;
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if(!dc) return SP_ERROR;
if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc->physDev );
abort_proc = dc->pAbortProc;
DC_ReleaseDCPtr( dc );
if (abort_proc && !abort_proc( hdc, 0 ))
if (dc->pAbortProc && !dc->pAbortProc( hdc, 0 ))
{
EndDoc( hdc );
ret = 0;
}
release_dc_ptr( dc );
return ret;
}
......@@ -193,11 +191,11 @@ INT WINAPI EndPage(HDC hdc)
INT WINAPI AbortDoc(HDC hdc)
{
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if(!dc) return SP_ERROR;
if (dc->funcs->pAbortDoc) ret = dc->funcs->pAbortDoc( dc->physDev );
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
return ret;
}
......@@ -214,19 +212,14 @@ BOOL16 WINAPI QueryAbort16(HDC16 hdc16, INT16 reserved)
{
BOOL ret = TRUE;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc );
ABORTPROC abproc;
DC *dc = get_dc_ptr( hdc );
if(!dc) {
ERR("Invalid hdc %p\n", hdc);
return FALSE;
}
abproc = dc->pAbortProc;
DC_ReleaseDCPtr( dc );
if (abproc)
ret = abproc(hdc, 0);
if (dc->pAbortProc) ret = dc->pAbortProc(hdc, 0);
release_dc_ptr( dc );
return ret;
}
......@@ -237,11 +230,11 @@ BOOL16 WINAPI QueryAbort16(HDC16 hdc16, INT16 reserved)
static BOOL CALLBACK call_abort_proc16( HDC hdc, INT code )
{
ABORTPROC16 proc16;
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
proc16 = dc->pAbortProc16;
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
if (proc16)
{
WORD args[2];
......@@ -262,12 +255,13 @@ static BOOL CALLBACK call_abort_proc16( HDC hdc, INT code )
INT16 WINAPI SetAbortProc16(HDC16 hdc16, ABORTPROC16 abrtprc)
{
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
dc->pAbortProc16 = abrtprc;
DC_ReleaseDCPtr( dc );
return SetAbortProc( hdc, call_abort_proc16 );
dc->pAbortProc = call_abort_proc16;
release_dc_ptr( dc );
return TRUE;
}
/**********************************************************************
......@@ -276,11 +270,11 @@ INT16 WINAPI SetAbortProc16(HDC16 hdc16, ABORTPROC16 abrtprc)
*/
INT WINAPI SetAbortProc(HDC hdc, ABORTPROC abrtprc)
{
DC *dc = DC_GetDCPtr( hdc );
DC *dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
dc->pAbortProc = abrtprc;
DC_ReleaseDCPtr( dc );
release_dc_ptr( dc );
return TRUE;
}
......
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