Convert StartDoc to Unicode.

This commit is contained in:
Mike McCormack 2005-01-04 20:39:19 +00:00 committed by Alexandre Julliard
parent 58b1e2a4e9
commit cc6b542a8e
4 changed files with 67 additions and 24 deletions

View File

@ -162,7 +162,7 @@ typedef struct tagDC_FUNCS
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 *,

View File

@ -50,7 +50,6 @@
#include "wine/debug.h"
#include "gdi.h"
#include "gdi_private.h"
#include "heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(print);
@ -70,13 +69,14 @@ static const char Printers[] = "System\\CurrentControlSet\\Control\\Pri
*
* 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);
TRACE("DocName = %s Output = %s Datatype = %s\n",
debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput),
debugstr_w(doc->lpszDatatype));
if(!dc) return SP_ERROR;
@ -86,28 +86,45 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
}
/*************************************************************************
* StartDocW [GDI32.@]
* StartDocA [GDI32.@]
*
*/
INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
{
DOCINFOA docA;
INT ret;
LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL;
DOCINFOW docW;
INT ret, len;
docA.cbSize = doc->cbSize;
docA.lpszDocName = doc->lpszDocName ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDocName ) : NULL;
docA.lpszOutput = doc->lpszOutput ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszOutput ) : NULL;
docA.lpszDatatype = doc->lpszDatatype ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDatatype ) : NULL;
docA.fwType = doc->fwType;
docW.cbSize = doc->cbSize;
if (doc->lpszDocName)
{
len = MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,NULL,0);
szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,szDocName,len);
}
if (doc->lpszOutput)
{
len = MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,NULL,0);
szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,szOutput,len);
}
if (doc->lpszDatatype)
{
len = MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,NULL,0);
szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,szDatatype,len);
}
ret = StartDocA(hdc, &docA);
docW.lpszDocName = szDocName;
docW.lpszOutput = szOutput;
docW.lpszDatatype = szDatatype;
docW.fwType = doc->fwType;
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
ret = StartDocW(hdc, &docW);
HeapFree( GetProcessHeap(), 0, szDocName );
HeapFree( GetProcessHeap(), 0, szOutput );
HeapFree( GetProcessHeap(), 0, szDatatype );
return ret;
}

View File

@ -28,6 +28,7 @@
#include "psdrv.h"
#include "wine/debug.h"
#include "winspool.h"
#include "heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
@ -345,9 +346,9 @@ INT PSDRV_EndPage( PSDRV_PDEVICE *physDev )
/************************************************************************
* PSDRV_StartDoc
* PSDRV_StartDocA
*/
INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
INT PSDRV_StartDocA( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
{
LPCSTR output = "LPT1:";
BYTE buf[300];
@ -393,6 +394,31 @@ INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
return physDev->job.hJob;
}
/************************************************************************
* PSDRV_StartDoc
*/
INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOW *doc )
{
DOCINFOA docA;
INT ret;
docA.cbSize = doc->cbSize;
docA.lpszDocName = doc->lpszDocName ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDocName ) : NULL;
docA.lpszOutput = doc->lpszOutput ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszOutput ) : NULL;
docA.lpszDatatype = doc->lpszDatatype ?
HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDatatype ) : NULL;
docA.fwType = doc->fwType;
ret = PSDRV_StartDocA(physDev, &docA);
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
return ret;
}
/************************************************************************
* PSDRV_EndDoc

View File

@ -495,7 +495,7 @@ extern BOOL PSDRV_RoundRect(PSDRV_PDEVICE *physDev, INT left, INT top, INT right
extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOW *doc );
extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT xSrc,