From 933733ce5b78bf2dba6e1a8ad741df07877895f0 Mon Sep 17 00:00:00 2001 From: Huw D M Davies Date: Thu, 15 Aug 2002 23:20:19 +0000 Subject: [PATCH] Get the initial paper size from the locale info. --- dlls/wineps/init.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index 56ebcb9927f..210d1d752db 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -444,6 +444,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) DWORD ppdType; char* ppdFileName = NULL; HKEY hkey; + BOOL using_default_devmode = FALSE; TRACE("'%s'\n", name); @@ -473,8 +474,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) goto cleanup; memcpy(pi->Devmode, &DefaultDevmode, sizeof(DefaultDevmode) ); strcpy(pi->Devmode->dmPublic.dmDeviceName,name); - DrvSetPrinterData16((LPSTR)name, (LPSTR)INT_PD_DEFAULT_DEVMODE, - REG_BINARY, (LPBYTE)&DefaultDevmode, sizeof(DefaultDevmode) ); + using_default_devmode = TRUE; /* need to do something here AddPrinter?? */ } @@ -560,6 +560,23 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) goto closeprinter; } + + if(using_default_devmode) { + DWORD papersize; + + if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER, + (LPWSTR)&papersize, sizeof(papersize))) { + PSDRV_DEVMODEA dm; + memset(&dm, 0, sizeof(dm)); + dm.dmPublic.dmFields = DM_PAPERSIZE; + dm.dmPublic.u1.s1.dmPaperSize = papersize; + PSDRV_MergeDevmodes(pi->Devmode, &dm, pi); + } + DrvSetPrinterData16((LPSTR)name, (LPSTR)INT_PD_DEFAULT_DEVMODE, + REG_BINARY, (LPBYTE)pi->Devmode, sizeof(DefaultDevmode) ); + } + + /* * This is a hack. The default paper size should be read in as part of * the Devmode structure, but Wine doesn't currently provide a convenient