wineps: Use the unicode version of StartDocPrinter.
This commit is contained in:
parent
0b9a3f9de4
commit
d963a8f864
|
@ -409,15 +409,15 @@ INT PSDRV_EndPage( PHYSDEV dev )
|
|||
|
||||
|
||||
/************************************************************************
|
||||
* PSDRV_StartDocA
|
||||
* PSDRV_StartDoc
|
||||
*/
|
||||
static INT PSDRV_StartDocA( PHYSDEV dev, const DOCINFOA *doc )
|
||||
INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc )
|
||||
{
|
||||
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
|
||||
DOC_INFO_1A di;
|
||||
DOC_INFO_1W di;
|
||||
|
||||
TRACE("(%p, %p) => %s, %s, %s\n", physDev, doc, debugstr_a(doc->lpszDocName),
|
||||
debugstr_a(doc->lpszOutput), debugstr_a(doc->lpszDatatype));
|
||||
TRACE("(%p, %p) => %s, %s, %s\n", physDev, doc, debugstr_w(doc->lpszDocName),
|
||||
debugstr_w(doc->lpszOutput), debugstr_w(doc->lpszDatatype));
|
||||
|
||||
if(physDev->job.id) {
|
||||
FIXME("hJob != 0. Now what?\n");
|
||||
|
@ -431,21 +431,21 @@ static INT PSDRV_StartDocA( PHYSDEV dev, const DOCINFOA *doc )
|
|||
return 0;
|
||||
}
|
||||
|
||||
di.pDocName = (LPSTR) doc->lpszDocName;
|
||||
di.pDocName = (LPWSTR) doc->lpszDocName;
|
||||
di.pDatatype = NULL;
|
||||
|
||||
if(doc->lpszOutput)
|
||||
di.pOutputFile = (LPSTR) doc->lpszOutput;
|
||||
di.pOutputFile = (LPWSTR) doc->lpszOutput;
|
||||
else if(physDev->job.output)
|
||||
di.pOutputFile = physDev->job.output;
|
||||
else
|
||||
di.pOutputFile = NULL;
|
||||
|
||||
TRACE("using output: %s\n", debugstr_a(di.pOutputFile));
|
||||
TRACE("using output: %s\n", debugstr_w(di.pOutputFile));
|
||||
|
||||
/* redirection located in HKCU\Software\Wine\Printing\Spooler
|
||||
is done during winspool.drv,ScheduleJob */
|
||||
physDev->job.id = StartDocPrinterA(physDev->job.hprinter, 1, (LPBYTE) &di);
|
||||
physDev->job.id = StartDocPrinterW(physDev->job.hprinter, 1, (LPBYTE) &di);
|
||||
if(!physDev->job.id) {
|
||||
WARN("StartDocPrinter() failed: %d\n", GetLastError());
|
||||
ClosePrinter(physDev->job.hprinter);
|
||||
|
@ -458,59 +458,15 @@ static INT PSDRV_StartDocA( PHYSDEV dev, const DOCINFOA *doc )
|
|||
physDev->job.in_passthrough = FALSE;
|
||||
physDev->job.had_passthrough_rect = FALSE;
|
||||
if(doc->lpszDocName) {
|
||||
physDev->job.DocName = HeapAlloc(GetProcessHeap(), 0, strlen(doc->lpszDocName)+1);
|
||||
strcpy(physDev->job.DocName, doc->lpszDocName);
|
||||
INT len = WideCharToMultiByte( CP_ACP, 0, doc->lpszDocName, -1, NULL, 0, NULL, NULL );
|
||||
physDev->job.DocName = HeapAlloc( GetProcessHeap(), 0, len );
|
||||
WideCharToMultiByte( CP_ACP, 0, doc->lpszDocName, -1, physDev->job.DocName, len, NULL, NULL );
|
||||
} else
|
||||
physDev->job.DocName = NULL;
|
||||
|
||||
return physDev->job.id;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* PSDRV_StartDoc
|
||||
*/
|
||||
INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc )
|
||||
{
|
||||
DOCINFOA docA;
|
||||
INT ret, len;
|
||||
LPSTR docname = NULL, output = NULL, datatype = NULL;
|
||||
|
||||
TRACE("(%p, %p) => %d,%s,%s,%s\n", dev, doc, doc->cbSize, debugstr_w(doc->lpszDocName),
|
||||
debugstr_w(doc->lpszOutput), debugstr_w(doc->lpszDatatype));
|
||||
|
||||
docA.cbSize = doc->cbSize;
|
||||
if (doc->lpszDocName)
|
||||
{
|
||||
len = WideCharToMultiByte( CP_ACP, 0, doc->lpszDocName, -1, NULL, 0, NULL, NULL );
|
||||
if ((docname = HeapAlloc( GetProcessHeap(), 0, len )))
|
||||
WideCharToMultiByte( CP_ACP, 0, doc->lpszDocName, -1, docname, len, NULL, NULL );
|
||||
}
|
||||
if (doc->lpszOutput)
|
||||
{
|
||||
len = WideCharToMultiByte( CP_ACP, 0, doc->lpszOutput, -1, NULL, 0, NULL, NULL );
|
||||
if ((output = HeapAlloc( GetProcessHeap(), 0, len )))
|
||||
WideCharToMultiByte( CP_ACP, 0, doc->lpszOutput, -1, output, len, NULL, NULL );
|
||||
}
|
||||
if (doc->lpszDatatype)
|
||||
{
|
||||
len = WideCharToMultiByte( CP_ACP, 0, doc->lpszDatatype, -1, NULL, 0, NULL, NULL );
|
||||
if ((datatype = HeapAlloc( GetProcessHeap(), 0, len )))
|
||||
WideCharToMultiByte( CP_ACP, 0, doc->lpszDatatype, -1, datatype, len, NULL, NULL );
|
||||
}
|
||||
docA.lpszDocName = docname;
|
||||
docA.lpszOutput = output;
|
||||
docA.lpszDatatype = datatype;
|
||||
docA.fwType = doc->fwType;
|
||||
|
||||
ret = PSDRV_StartDocA(dev, &docA);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, docname );
|
||||
HeapFree( GetProcessHeap(), 0, output );
|
||||
HeapFree( GetProcessHeap(), 0, datatype );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* PSDRV_EndDoc
|
||||
*/
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "winnls.h"
|
||||
#include "psdrv.h"
|
||||
#include "winspool.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/library.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -171,6 +172,17 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static inline WCHAR *strdupW( const WCHAR *str )
|
||||
{
|
||||
int size;
|
||||
WCHAR *ret;
|
||||
|
||||
if (!str) return NULL;
|
||||
size = (strlenW( str ) + 1) * sizeof(WCHAR);
|
||||
ret = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
if (ret) memcpy( ret, str, size );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
|
||||
{
|
||||
|
@ -355,11 +367,7 @@ static BOOL PSDRV_CreateDC( PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device,
|
|||
|
||||
if (!(physDev = create_psdrv_physdev( pi ))) return FALSE;
|
||||
|
||||
if (output && *output) {
|
||||
INT len = WideCharToMultiByte( CP_ACP, 0, output, -1, NULL, 0, NULL, NULL );
|
||||
if ((physDev->job.output = HeapAlloc( PSDRV_Heap, 0, len )))
|
||||
WideCharToMultiByte( CP_ACP, 0, output, -1, physDev->job.output, len, NULL, NULL );
|
||||
}
|
||||
if (output && *output) physDev->job.output = strdupW( output );
|
||||
|
||||
if(initData) {
|
||||
DEVMODEA *devmodeA = DEVMODEdupWtoA(PSDRV_Heap, initData);
|
||||
|
|
|
@ -346,7 +346,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
DWORD id; /* Job id */
|
||||
HANDLE hprinter; /* Printer handle */
|
||||
LPSTR output; /* Output file/port */
|
||||
LPWSTR output; /* Output file/port */
|
||||
LPSTR DocName; /* Document Name */
|
||||
BOOL banding; /* Have we received a NEXTBAND */
|
||||
BOOL OutOfPage; /* Page header not sent yet */
|
||||
|
|
Loading…
Reference in New Issue