wineps.drv: Retrieve the full printer name to avoid truncation when the name is 32 characters or longer.

This commit is contained in:
Huw Davies 2010-03-12 10:42:44 +00:00 committed by Alexandre Julliard
parent e18afef774
commit 547e97a461

View File

@ -305,27 +305,22 @@ BOOL CDECL PSDRV_CreateDC( HDC hdc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWST
{ {
PSDRV_PDEVICE *physDev; PSDRV_PDEVICE *physDev;
PRINTERINFO *pi; PRINTERINFO *pi;
char *deviceA;
/* If no device name was specified, retrieve the device name /* If no device name was specified, retrieve the device name
* from the DEVMODE structure from the DC's physDev. * from the PRINTERINFO structure from the DC's physDev.
* (See CreateCompatibleDC) */ * (See CreateCompatibleDC) */
if ( !device && *pdev ) if ( !device && *pdev )
{ {
physDev = *pdev; pi = PSDRV_FindPrinterInfo((*pdev)->pi->FriendlyName);
deviceA = HeapAlloc(GetProcessHeap(), 0, CCHDEVICENAME);
lstrcpynA(deviceA, (LPCSTR)physDev->Devmode->dmPublic.dmDeviceName, CCHDEVICENAME);
} }
else else
{ {
DWORD len = WideCharToMultiByte(CP_ACP, 0, device, -1, NULL, 0, NULL, NULL); DWORD len = WideCharToMultiByte(CP_ACP, 0, device, -1, NULL, 0, NULL, NULL);
deviceA = HeapAlloc(GetProcessHeap(), 0, len); char *deviceA = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte(CP_ACP, 0, device, -1, deviceA, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, device, -1, deviceA, len, NULL, NULL);
pi = PSDRV_FindPrinterInfo(deviceA);
HeapFree(GetProcessHeap(), 0, deviceA);
} }
pi = PSDRV_FindPrinterInfo(deviceA);
HeapFree(GetProcessHeap(), 0, deviceA);
deviceA = NULL;
TRACE("(%s %s %s %p)\n", debugstr_w(driver), debugstr_w(device), TRACE("(%s %s %s %p)\n", debugstr_w(driver), debugstr_w(device),
debugstr_w(output), initData); debugstr_w(output), initData);