I want to send this through wine-devel first to see if there are any problems with it. In gdi_private.h I had to change the parameters that pStartDoc accepted from DOCINFOA to DOCINFOW. I know I shouldn't change public api headers, but this one is private so the change seems acceptable. If it's not let me know. Another problem that might popup is the way the DOCINFOW struct is filled in the StartDocA function:
len = MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, NULL, 0 ); docName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, docName, len );
docW.lpszDocName = docName; <--- is this assignment a problem?
if(docName) HeapFree( GetProcessHeap(), 0, (LPWSTR)docName );
The reason why I had to make a docName variable is because docW.lpszDocName is a LPCWSTR so there were warnings when i had docW.lpszDocName directly in the call to MultiByteToWideChar.
Changelog * cleanup w->a cross calls in StartDoc
On Sat, Aug 28, 2004 at 04:27:12PM -0400, James Hawkins wrote:
Index: dlls/gdi/gdi_private.h
RCS file: /home/wine/wine/dlls/gdi/gdi_private.h,v retrieving revision 1.14 diff -u -r1.14 gdi_private.h --- dlls/gdi/gdi_private.h 6 Aug 2004 18:59:31 -0000 1.14 +++ dlls/gdi/gdi_private.h 28 Aug 2004 19:55:41 -0000 @@ -162,7 +162,7 @@ INT (*pSetWindowExt)(PHYSDEV,INT,INT); INT (*pSetWindowOrg)(PHYSDEV,INT,INT); BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
- INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
- INT (*pStartDoc)(PHYSDEV,const DOCINFOW*); INT (*pStartPage)(PHYSDEV); BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD); INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
The fact that you're touching a .h file should probably tell you that you need to look at more than just one .c file
Index: dlls/gdi/printdrv.c
RCS file: /home/wine/wine/dlls/gdi/printdrv.c,v retrieving revision 1.39 diff -u -r1.39 printdrv.c --- dlls/gdi/printdrv.c 4 May 2004 04:13:06 -0000 1.39 +++ dlls/gdi/printdrv.c 28 Aug 2004 19:55:41 -0000 @@ -70,13 +71,14 @@
- Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
*/ -INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) +INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc) { INT ret = 0; DC *dc = DC_GetDCPtr( hdc );
TRACE("DocName = '%s' Output = '%s' Datatype = '%s'\n",
doc->lpszDocName, doc->lpszOutput, doc->lpszDatatype);
debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
debugstr_w(doc->lpszDatatype));
if(!dc) return SP_ERROR;
And if you look further down StartDoc, you'll see:
if (dc->funcs->pStartDoc) ret = dc->funcs->pStartDoc( dc->physDev, doc );
so the question is where is this function implemented? Well the dc->funcs array can either contain ptrs to internal gdi fns from the metafile and enhmetafile drivers, or it'll have ptrs to external dlls such as x11drv or wineps - see dlls/gdi/driver.c for the details.
In the case of StartDoc a grep of the tree will show you that you need to update PSDRV_StartDoc. Unfortunately PSDRV_StartDoc is going to be rather messy to unicodify (this is probably why nobody has done this yet) since it uses calls to the 16 bit print spooling functions that are necessarily ansi.
Huw.