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

wineps: Handle EMRI_DEVMODE record in spool files.

parent 4496c64a
......@@ -436,7 +436,7 @@ static BOOL CDECL PSDRV_DeleteDC( PHYSDEV dev )
/**********************************************************************
* ResetDC (WINEPS.@)
*/
static BOOL CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData )
BOOL CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData )
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
......
......@@ -3228,6 +3228,30 @@ BOOL WINAPI PrintDocumentOnPrintProcessor(HANDLE pp, WCHAR *doc_name)
switch (record.ulID)
{
case EMRI_DEVMODE:
{
DEVMODEW *devmode = NULL;
if (record.cjSize)
{
devmode = malloc(record.cjSize);
if (!devmode)
goto cleanup;
ret = ReadPrinter(spool_data, devmode, record.cjSize, &r);
if (ret && r != record.cjSize)
{
SetLastError(ERROR_INVALID_DATA);
ret = FALSE;
}
}
if (ret)
ret = PSDRV_ResetDC(&data->pdev->dev, devmode);
free(devmode);
if (!ret)
goto cleanup;
break;
}
case EMRI_METAFILE_DATA:
pos.QuadPart = record.cjSize;
ret = SeekPrinter(spool_data, pos, NULL, FILE_CURRENT, FALSE);
......@@ -3242,7 +3266,7 @@ BOOL WINAPI PrintDocumentOnPrintProcessor(HANDLE pp, WCHAR *doc_name)
{
cur.QuadPart += record.cjSize;
ret = ReadPrinter(spool_data, &pos, sizeof(pos), &r);
if (r != sizeof(pos))
if (ret && r != sizeof(pos))
{
SetLastError(ERROR_INVALID_DATA);
ret = FALSE;
......
......@@ -467,6 +467,7 @@ extern INT CDECL PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) DECLSPEC_HID
extern BOOL CDECL PSDRV_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL PSDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData ) DECLSPEC_HIDDEN;
extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2,
PRINTERINFO *pi) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetFontMetrics(void) DECLSPEC_HIDDEN;
......
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