Commit c0da44e4 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

It appears that StartDoc sends the STARTDOC escape with the DOCINFO

structure pointed to with the output data parameter.
parent 0f298856
...@@ -114,7 +114,10 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, ...@@ -114,7 +114,10 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput,
break; break;
} }
/* Escape(hdc,STARTDOC,LPSTR,NULL); */ /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFOA);
* lpvOutData is actually a pointer to the DocInfo structure and used as
* a second input parameter
*/
case STARTDOC: /* string may not be \0 terminated */ case STARTDOC: /* string may not be \0 terminated */
if(lpszInData) { if(lpszInData) {
...@@ -123,6 +126,18 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, ...@@ -123,6 +126,18 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput,
segin = SEGPTR_GET(cp); segin = SEGPTR_GET(cp);
} else } else
segin = 0; segin = 0;
if(lpvOutData) {
DOCINFO16 *lpsegdoc = SEGPTR_NEW(DOCINFO16);
DOCINFOA *lpdoc = lpvOutData;
memset(lpsegdoc, 0, sizeof(*lpsegdoc));
lpsegdoc->cbSize = sizeof(*lpsegdoc);
lpsegdoc->lpszDocName = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszDocName));
lpsegdoc->lpszOutput = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszOutput));
lpsegdoc->lpszDatatype = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszDatatype));
lpsegdoc->fwType = lpdoc->fwType;
segout = SEGPTR_GET(lpsegdoc);
}
break; break;
case SETABORTPROC: case SETABORTPROC:
...@@ -193,7 +208,16 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, ...@@ -193,7 +208,16 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput,
SEGPTR_FREE(x); SEGPTR_FREE(x);
break; break;
} }
case STARTDOC: case STARTDOC: {
DOCINFO16 *doc = PTR_SEG_TO_LIN(segout);
SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszDocName));
SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszOutput));
SEGPTR_FREE(PTR_SEG_TO_LIN(doc->lpszDatatype));
SEGPTR_FREE(doc);
SEGPTR_FREE(PTR_SEG_TO_LIN(segin));
break;
}
case CLIP_TO_PATH: case CLIP_TO_PATH:
case END_PATH: case END_PATH:
SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); SEGPTR_FREE(PTR_SEG_TO_LIN(segin));
......
...@@ -339,19 +339,27 @@ static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput, ...@@ -339,19 +339,27 @@ static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput,
} }
break; break;
case STARTDOC: case STARTDOC:
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape, {
lpInData, lpOutData); /* lpInData is not necessarily \0 terminated so make it so */
if (nRet != -1) char *cp = SEGPTR_ALLOC(cbInput + 1);
{ memcpy(cp, PTR_SEG_TO_LIN(lpInData), cbInput);
HDC *tmpHdc = SEGPTR_NEW(HDC); cp[cbInput] = '\0';
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
SEGPTR_GET(cp), lpOutData);
SEGPTR_FREE(cp);
if (nRet != -1)
{
HDC *tmpHdc = SEGPTR_NEW(HDC);
#define SETPRINTERDC SETABORTPROC #define SETPRINTERDC SETABORTPROC
*tmpHdc = dc->hSelf; *tmpHdc = dc->hSelf;
PRTDRV_Control(physDev->segptrPDEVICE, SETPRINTERDC, PRTDRV_Control(physDev->segptrPDEVICE, SETPRINTERDC,
SEGPTR_GET(tmpHdc), (SEGPTR)NULL); SEGPTR_GET(tmpHdc), (SEGPTR)NULL);
SEGPTR_FREE(tmpHdc); SEGPTR_FREE(tmpHdc);
} }
}
break; break;
default: default:
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape, nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
......
...@@ -261,6 +261,8 @@ typedef struct ...@@ -261,6 +261,8 @@ typedef struct
INT16 cbSize; INT16 cbSize;
SEGPTR lpszDocName; SEGPTR lpszDocName;
SEGPTR lpszOutput; SEGPTR lpszOutput;
SEGPTR lpszDatatype;
DWORD fwType;
} DOCINFO16, *LPDOCINFO16; } DOCINFO16, *LPDOCINFO16;
typedef BOOL16 (CALLBACK* ABORTPROC16)(HDC16, INT16); typedef BOOL16 (CALLBACK* ABORTPROC16)(HDC16, INT16);
......
...@@ -45,8 +45,16 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc ) ...@@ -45,8 +45,16 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
docA.cbSize = lpdoc->cbSize; docA.cbSize = lpdoc->cbSize;
docA.lpszDocName = PTR_SEG_TO_LIN(lpdoc->lpszDocName); docA.lpszDocName = PTR_SEG_TO_LIN(lpdoc->lpszDocName);
docA.lpszOutput = PTR_SEG_TO_LIN(lpdoc->lpszOutput); docA.lpszOutput = PTR_SEG_TO_LIN(lpdoc->lpszOutput);
docA.lpszDatatype = NULL;
docA.fwType = 0; if(lpdoc->cbSize >= 14)
docA.lpszDatatype = PTR_SEG_TO_LIN(lpdoc->lpszDatatype);
else
docA.lpszDatatype = NULL;
if(lpdoc->cbSize >= 18)
docA.fwType = lpdoc->fwType;
else
docA.fwType = 0;
return StartDocA(hdc, &docA); return StartDocA(hdc, &docA);
} }
...@@ -54,6 +62,10 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc ) ...@@ -54,6 +62,10 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
/****************************************************************** /******************************************************************
* StartDocA [GDI32.347] * StartDocA [GDI32.347]
* *
* StartDoc calls the STARTDOC Escape with the input data pointing to DocName
* and the output data (which is used as a second input parameter).pointing at
* the whole docinfo structure. This seems to be an undocumented feature of
* the STARTDOC Escape.
*/ */
INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
{ {
...@@ -68,7 +80,7 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) ...@@ -68,7 +80,7 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
return dc->funcs->pStartDoc( dc, doc ); return dc->funcs->pStartDoc( dc, doc );
else else
return Escape(hdc, STARTDOC, strlen(doc->lpszDocName), return Escape(hdc, STARTDOC, strlen(doc->lpszDocName),
doc->lpszDocName, 0); doc->lpszDocName, (LPVOID)doc);
} }
/************************************************************************* /*************************************************************************
......
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