Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/localspl/localmon.c | 8 +- dlls/localspl/localspl.rc | 120 +++++++++++++++++ dlls/localspl/localspl_private.h | 119 +++++++++++++++++ dlls/localspl/provider.c | 222 ++++++++++++++++++++++++++++++- dlls/winspool.drv/info.c | 12 ++ 5 files changed, 474 insertions(+), 7 deletions(-)
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c index d4346505319..f49c40b1701 100644 --- a/dlls/localspl/localmon.c +++ b/dlls/localspl/localmon.c @@ -81,7 +81,7 @@ static struct list xcv_handles = LIST_INIT( xcv_handles ); static const WCHAR WinNT_CV_PortsW[] = L"Software\Microsoft\Windows NT\CurrentVersion\Ports"; static const WCHAR WinNT_CV_WindowsW[] = L"Software\Microsoft\Windows NT\CurrentVersion\Windows";
-static HINSTANCE LOCALSPL_hInstance; +HINSTANCE localspl_instance;
/***************************************************** * DllMain @@ -94,7 +94,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); - LOCALSPL_hInstance = hinstDLL; + localspl_instance = hinstDLL; break; } return TRUE; @@ -185,8 +185,8 @@ static DWORD get_ports_from_reg(DWORD level, LPBYTE pPorts, DWORD cbBuf, LPDWORD }
/* "+1" for '\0' */ - reslen_MonitorW = LoadStringW(LOCALSPL_hInstance, IDS_LOCALMONITOR, res_MonitorW, IDS_LOCALMONITOR_MAXLEN) + 1; - reslen_PortW = LoadStringW(LOCALSPL_hInstance, IDS_LOCALPORT, res_PortW, IDS_LOCALPORT_MAXLEN) + 1; + reslen_MonitorW = LoadStringW(localspl_instance, IDS_LOCALMONITOR, res_MonitorW, IDS_LOCALMONITOR_MAXLEN) + 1; + reslen_PortW = LoadStringW(localspl_instance, IDS_LOCALPORT, res_PortW, IDS_LOCALPORT_MAXLEN) + 1;
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_PortsW, &hroot); if (res == ERROR_SUCCESS) { diff --git a/dlls/localspl/localspl.rc b/dlls/localspl/localspl.rc index d0daaa833f0..71ebc3f258c 100644 --- a/dlls/localspl/localspl.rc +++ b/dlls/localspl/localspl.rc @@ -31,6 +31,126 @@ STRINGTABLE IDS_LOCALMONITOR "Local Monitor" }
+STRINGTABLE +{ + IDS_FORM_LETTER "Letter" + IDS_FORM_LETTER_SMALL "Letter Small" + IDS_FORM_TABLOID "Tabloid" + IDS_FORM_LEDGER "Ledger" + IDS_FORM_LEGAL "Legal" + IDS_FORM_STATEMENT "Statement" + IDS_FORM_EXECUTIVE "Executive" + IDS_FORM_A3 "A3" + IDS_FORM_A4 "A4" + IDS_FORM_A4_SMALL "A4 Small" + IDS_FORM_A5 "A5" + IDS_FORM_B4_JIS "B4 (JIS)" + IDS_FORM_B5_JIS "B5 (JIS)" + IDS_FORM_FOLIO "Folio" + IDS_FORM_QUARTO "Quarto" + IDS_FORM_10x14 "10x14" + IDS_FORM_11x17 "11x17" + IDS_FORM_NOTE "Note" + IDS_FORM_ENVELOPE_9 "Envelope #9" + IDS_FORM_ENVELOPE_10 "Envelope #10" + IDS_FORM_ENVELOPE_11 "Envelope #11" + IDS_FORM_ENVELOPE_12 "Envelope #12" + IDS_FORM_ENVELOPE_14 "Envelope #14" + IDS_FORM_C_SIZE_SHEET "C size sheet" + IDS_FORM_D_SIZE_SHEET "D size sheet" + IDS_FORM_E_SIZE_SHEET "E size sheet" + IDS_FORM_ENVELOPE_DL "Envelope DL" + IDS_FORM_ENVELOPE_C5 "Envelope C5" + IDS_FORM_ENVELOPE_C3 "Envelope C3" + IDS_FORM_ENVELOPE_C4 "Envelope C4" + IDS_FORM_ENVELOPE_C6 "Envelope C6" + IDS_FORM_ENVELOPE_C65 "Envelope C65" + IDS_FORM_ENVELOPE_B4 "Envelope B4" + IDS_FORM_ENVELOPE_B5 "Envelope B5" + IDS_FORM_ENVELOPE_B6 "Envelope B6" + IDS_FORM_ENVELOPE "Envelope" + IDS_FORM_ENVELOPE_MONARCH "Envelope Monarch" + IDS_FORM_6_34_ENVELOPE "6 3/4 Envelope" + IDS_FORM_US_STD_FANFOLD "US Std Fanfold" + IDS_FORM_GERMAN_STD_FANFOLD "German Std Fanfold" + IDS_FORM_GERMAN_LEGAL_FANFOLD "German Legal Fanfold" + IDS_FORM_B4_ISO "B4 (ISO)" + IDS_FORM_JAPANESE_POSTCARD "Japanese Postcard" + IDS_FORM_9x11 "9x11" + IDS_FORM_10x11 "10x11" + IDS_FORM_15x11 "15x11" + IDS_FORM_ENVELOPE_INVITE "Envelope Invite" + IDS_FORM_LETTER_EXTRA "Letter Extra" + IDS_FORM_LEGAL_EXTRA "Legal Extra" + IDS_FORM_TABLOID_EXTRA "Tabloid Extra" + IDS_FORM_A4_EXTRA "A4 Extra" + IDS_FORM_LETTER_TRANSVERSE "Letter Transverse" + IDS_FORM_A4_TRANSVERSE "A4 Transverse" + IDS_FORM_LETTER_EXTRA_TRANSVERSE "Letter Extra Transverse" + IDS_FORM_SUPER_A "Super A" + IDS_FORM_SUPER_B "Super B" + IDS_FORM_LETTER_PLUS "Letter Plus" + IDS_FORM_A4_PLUS "A4 Plus" + IDS_FORM_A5_TRANSVERSE "A5 Transverse" + IDS_FORM_B5_JIS_TRANSVERSE "B5 (JIS) Transverse" + IDS_FORM_A3_EXTRA "A3 Extra" + IDS_FORM_A5_EXTRA "A5 Extra" + IDS_FORM_B5_ISO_EXTRA "B5 (ISO) Extra" + IDS_FORM_A2 "A2" + IDS_FORM_A3_TRANSVERSE "A3 Transverse" + IDS_FORM_A3_EXTRA_TRANSVERSE "A3 Extra Transverse" + IDS_FORM_JAPANESE_DOUBLE_POSTCARD "Japanese Double Postcard" + IDS_FORM_A6 "A6" + IDS_FORM_JAPANESE_ENVELOPE_KAKU_2 "Japanese Envelope Kaku #2" + IDS_FORM_JAPANESE_ENVELOPE_KAKU_3 "Japanese Envelope Kaku #3" + IDS_FORM_JAPANESE_ENVELOPE_CHOU_3 "Japanese Envelope Chou #3" + IDS_FORM_JAPANESE_ENVELOPE_CHOU_4 "Japanese Envelope Chou #4" + IDS_FORM_LETTER_ROTATED "Letter Rotated" + IDS_FORM_A3_ROTATED "A3 Rotated" + IDS_FORM_A4_ROTATED "A4 Rotated" + IDS_FORM_A5_ROTATED "A5 Rotated" + IDS_FORM_B4_JIS_ROTATED "B4 (JIS) Rotated" + IDS_FORM_B5_JIS_ROTATED "B5 (JIS) Rotated" + IDS_FORM_JAPANESE_POSTCARD_ROTATED "Japanese Postcard Rotated" + IDS_FORM_DOUBLE_JAPAN_POSTCARD_ROTATED "Double Japan Postcard Rotated" + IDS_FORM_A6_ROTATED "A6 Rotated" + IDS_FORM_JAPAN_ENVELOPE_KAKU_2_ROTATED "Japan Envelope Kaku #2 Rotated" + IDS_FORM_JAPAN_ENVELOPE_KAKU_3_ROTATED "Japan Envelope Kaku #3 Rotated" + IDS_FORM_JAPAN_ENVELOPE_CHOU_3_ROTATED "Japan Envelope Chou #3 Rotated" + IDS_FORM_JAPAN_ENVELOPE_CHOU_4_ROTATED "Japan Envelope Chou #4 Rotated" + IDS_FORM_B6_JIS "B6 (JIS)" + IDS_FORM_B6_JIS_ROTATED "B6 (JIS) Rotated" + IDS_FORM_12x11 "12x11" + IDS_FORM_JAPAN_ENVELOPE_YOU_4 "Japan Envelope You #4" + IDS_FORM_JAPAN_ENVELOPE_YOU_4_ROTATED "Japan Envelope You #4 Rotated" + IDS_FORM_PRC_16K "PRC 16K" + IDS_FORM_PRC_32K "PRC 32K" + IDS_FORM_PRC_32K_BIG "PRC 32K(Big)" + IDS_FORM_PRC_ENVELOPE_1 "PRC Envelope #1" + IDS_FORM_PRC_ENVELOPE_2 "PRC Envelope #2" + IDS_FORM_PRC_ENVELOPE_3 "PRC Envelope #3" + IDS_FORM_PRC_ENVELOPE_4 "PRC Envelope #4" + IDS_FORM_PRC_ENVELOPE_5 "PRC Envelope #5" + IDS_FORM_PRC_ENVELOPE_6 "PRC Envelope #6" + IDS_FORM_PRC_ENVELOPE_7 "PRC Envelope #7" + IDS_FORM_PRC_ENVELOPE_8 "PRC Envelope #8" + IDS_FORM_PRC_ENVELOPE_9 "PRC Envelope #9" + IDS_FORM_PRC_ENVELOPE_10 "PRC Envelope #10" + IDS_FORM_PRC_16K_ROTATED "PRC 16K Rotated" + IDS_FORM_PRC_32K_ROTATED "PRC 32K Rotated" + IDS_FORM_PRC_32K_BIG_ROTATED "PRC 32K(Big) Rotated" + IDS_FORM_PRC_ENVELOPE_1_ROTATED "PRC Envelope #1 Rotated" + IDS_FORM_PRC_ENVELOPE_2_ROTATED "PRC Envelope #2 Rotated" + IDS_FORM_PRC_ENVELOPE_3_ROTATED "PRC Envelope #3 Rotated" + IDS_FORM_PRC_ENVELOPE_4_ROTATED "PRC Envelope #4 Rotated" + IDS_FORM_PRC_ENVELOPE_5_ROTATED "PRC Envelope #5 Rotated" + IDS_FORM_PRC_ENVELOPE_6_ROTATED "PRC Envelope #6 Rotated" + IDS_FORM_PRC_ENVELOPE_7_ROTATED "PRC Envelope #7 Rotated" + IDS_FORM_PRC_ENVELOPE_8_ROTATED "PRC Envelope #8 Rotated" + IDS_FORM_PRC_ENVELOPE_9_ROTATED "PRC Envelope #9 Rotated" + IDS_FORM_PRC_ENVELOPE_10_ROTATED "PRC Envelope #10 Rotated" +} + LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define WINE_FILENAME_STR "localspl.dll" diff --git a/dlls/localspl/localspl_private.h b/dlls/localspl/localspl_private.h index ed44b1413c9..b82dfa2dedf 100644 --- a/dlls/localspl/localspl_private.h +++ b/dlls/localspl/localspl_private.h @@ -23,7 +23,126 @@
#include <windef.h>
+extern HINSTANCE localspl_instance DECLSPEC_HIDDEN; + /* ## Resource-ID ## */ +#define IDS_FORM_LETTER 200 +#define IDS_FORM_LETTER_SMALL 201 +#define IDS_FORM_TABLOID 202 +#define IDS_FORM_LEDGER 203 +#define IDS_FORM_LEGAL 204 +#define IDS_FORM_STATEMENT 205 +#define IDS_FORM_EXECUTIVE 206 +#define IDS_FORM_A3 207 +#define IDS_FORM_A4 208 +#define IDS_FORM_A4_SMALL 209 +#define IDS_FORM_A5 210 +#define IDS_FORM_B4_JIS 211 +#define IDS_FORM_B5_JIS 212 +#define IDS_FORM_FOLIO 213 +#define IDS_FORM_QUARTO 214 +#define IDS_FORM_10x14 215 +#define IDS_FORM_11x17 216 +#define IDS_FORM_NOTE 217 +#define IDS_FORM_ENVELOPE_9 218 +#define IDS_FORM_ENVELOPE_10 219 +#define IDS_FORM_ENVELOPE_11 220 +#define IDS_FORM_ENVELOPE_12 221 +#define IDS_FORM_ENVELOPE_14 222 +#define IDS_FORM_C_SIZE_SHEET 223 +#define IDS_FORM_D_SIZE_SHEET 224 +#define IDS_FORM_E_SIZE_SHEET 225 +#define IDS_FORM_ENVELOPE_DL 226 +#define IDS_FORM_ENVELOPE_C5 227 +#define IDS_FORM_ENVELOPE_C3 228 +#define IDS_FORM_ENVELOPE_C4 229 +#define IDS_FORM_ENVELOPE_C6 230 +#define IDS_FORM_ENVELOPE_C65 231 +#define IDS_FORM_ENVELOPE_B4 232 +#define IDS_FORM_ENVELOPE_B5 233 +#define IDS_FORM_ENVELOPE_B6 234 +#define IDS_FORM_ENVELOPE 235 +#define IDS_FORM_ENVELOPE_MONARCH 236 +#define IDS_FORM_6_34_ENVELOPE 237 +#define IDS_FORM_US_STD_FANFOLD 238 +#define IDS_FORM_GERMAN_STD_FANFOLD 239 +#define IDS_FORM_GERMAN_LEGAL_FANFOLD 240 +#define IDS_FORM_B4_ISO 241 +#define IDS_FORM_JAPANESE_POSTCARD 242 +#define IDS_FORM_9x11 243 +#define IDS_FORM_10x11 244 +#define IDS_FORM_15x11 245 +#define IDS_FORM_ENVELOPE_INVITE 246 +#define IDS_FORM_LETTER_EXTRA 247 +#define IDS_FORM_LEGAL_EXTRA 248 +#define IDS_FORM_TABLOID_EXTRA 249 +#define IDS_FORM_A4_EXTRA 250 +#define IDS_FORM_LETTER_TRANSVERSE 251 +#define IDS_FORM_A4_TRANSVERSE 252 +#define IDS_FORM_LETTER_EXTRA_TRANSVERSE 253 +#define IDS_FORM_SUPER_A 254 +#define IDS_FORM_SUPER_B 255 +#define IDS_FORM_LETTER_PLUS 256 +#define IDS_FORM_A4_PLUS 257 +#define IDS_FORM_A5_TRANSVERSE 258 +#define IDS_FORM_B5_JIS_TRANSVERSE 259 +#define IDS_FORM_A3_EXTRA 260 +#define IDS_FORM_A5_EXTRA 261 +#define IDS_FORM_B5_ISO_EXTRA 262 +#define IDS_FORM_A2 263 +#define IDS_FORM_A3_TRANSVERSE 264 +#define IDS_FORM_A3_EXTRA_TRANSVERSE 265 +#define IDS_FORM_JAPANESE_DOUBLE_POSTCARD 266 +#define IDS_FORM_A6 267 +#define IDS_FORM_JAPANESE_ENVELOPE_KAKU_2 268 +#define IDS_FORM_JAPANESE_ENVELOPE_KAKU_3 269 +#define IDS_FORM_JAPANESE_ENVELOPE_CHOU_3 270 +#define IDS_FORM_JAPANESE_ENVELOPE_CHOU_4 271 +#define IDS_FORM_LETTER_ROTATED 272 +#define IDS_FORM_A3_ROTATED 273 +#define IDS_FORM_A4_ROTATED 274 +#define IDS_FORM_A5_ROTATED 275 +#define IDS_FORM_B4_JIS_ROTATED 276 +#define IDS_FORM_B5_JIS_ROTATED 277 +#define IDS_FORM_JAPANESE_POSTCARD_ROTATED 278 +#define IDS_FORM_DOUBLE_JAPAN_POSTCARD_ROTATED 279 +#define IDS_FORM_A6_ROTATED 280 +#define IDS_FORM_JAPAN_ENVELOPE_KAKU_2_ROTATED 281 +#define IDS_FORM_JAPAN_ENVELOPE_KAKU_3_ROTATED 282 +#define IDS_FORM_JAPAN_ENVELOPE_CHOU_3_ROTATED 283 +#define IDS_FORM_JAPAN_ENVELOPE_CHOU_4_ROTATED 284 +#define IDS_FORM_B6_JIS 285 +#define IDS_FORM_B6_JIS_ROTATED 286 +#define IDS_FORM_12x11 287 +#define IDS_FORM_JAPAN_ENVELOPE_YOU_4 288 +#define IDS_FORM_JAPAN_ENVELOPE_YOU_4_ROTATED 289 +#define IDS_FORM_PRC_16K 290 +#define IDS_FORM_PRC_32K 291 +#define IDS_FORM_PRC_32K_BIG 292 +#define IDS_FORM_PRC_ENVELOPE_1 293 +#define IDS_FORM_PRC_ENVELOPE_2 294 +#define IDS_FORM_PRC_ENVELOPE_3 295 +#define IDS_FORM_PRC_ENVELOPE_4 296 +#define IDS_FORM_PRC_ENVELOPE_5 297 +#define IDS_FORM_PRC_ENVELOPE_6 298 +#define IDS_FORM_PRC_ENVELOPE_7 299 +#define IDS_FORM_PRC_ENVELOPE_8 300 +#define IDS_FORM_PRC_ENVELOPE_9 301 +#define IDS_FORM_PRC_ENVELOPE_10 302 +#define IDS_FORM_PRC_16K_ROTATED 303 +#define IDS_FORM_PRC_32K_ROTATED 304 +#define IDS_FORM_PRC_32K_BIG_ROTATED 305 +#define IDS_FORM_PRC_ENVELOPE_1_ROTATED 306 +#define IDS_FORM_PRC_ENVELOPE_2_ROTATED 307 +#define IDS_FORM_PRC_ENVELOPE_3_ROTATED 308 +#define IDS_FORM_PRC_ENVELOPE_4_ROTATED 309 +#define IDS_FORM_PRC_ENVELOPE_5_ROTATED 310 +#define IDS_FORM_PRC_ENVELOPE_6_ROTATED 311 +#define IDS_FORM_PRC_ENVELOPE_7_ROTATED 312 +#define IDS_FORM_PRC_ENVELOPE_8_ROTATED 313 +#define IDS_FORM_PRC_ENVELOPE_9_ROTATED 314 +#define IDS_FORM_PRC_ENVELOPE_10_ROTATED 315 + #define IDS_LOCALPORT 500 #define IDS_LOCALMONITOR 507
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c index 51e0cedadb1..69f70cdf541 100644 --- a/dlls/localspl/provider.c +++ b/dlls/localspl/provider.c @@ -26,6 +26,7 @@ #include "winbase.h" #include "wingdi.h" #include "winreg.h" +#include "winnls.h" #include "winspool.h" #include "winuser.h" #include "ddk/winddiui.h" @@ -38,6 +39,132 @@
WINE_DEFAULT_DEBUG_CHANNEL(localspl);
+static const struct builtin_form +{ + const WCHAR *name; + SIZEL size; + DWORD res_id; +} builtin_forms[] = +{ + { L"Letter", { 215900, 279400 }, IDS_FORM_LETTER }, + { L"Letter Small", { 215900, 279400 }, IDS_FORM_LETTER_SMALL }, + { L"Tabloid", { 279400, 431800 }, IDS_FORM_TABLOID }, + { L"Ledger", { 431800, 279400 }, IDS_FORM_LEDGER }, + { L"Legal", { 215900, 355600 }, IDS_FORM_LEGAL }, + { L"Statement", { 139700, 215900 }, IDS_FORM_STATEMENT }, + { L"Executive", { 184150, 266700 }, IDS_FORM_EXECUTIVE }, + { L"A3", { 297000, 420000 }, IDS_FORM_A3 }, + { L"A4", { 210000, 297000 }, IDS_FORM_A4 }, + { L"A4 Small", { 210000, 297000 }, IDS_FORM_A4_SMALL }, + { L"A5", { 148000, 210000 }, IDS_FORM_A5 }, + { L"B4 (JIS)", { 257000, 364000 }, IDS_FORM_B4_JIS }, + { L"B5 (JIS)", { 182000, 257000 }, IDS_FORM_B5_JIS }, + { L"Folio", { 215900, 330200 }, IDS_FORM_FOLIO }, + { L"Quarto", { 215000, 275000 }, IDS_FORM_QUARTO }, + { L"10x14", { 254000, 355600 }, IDS_FORM_10x14 }, + { L"11x17", { 279400, 431800 }, IDS_FORM_11x17 }, + { L"Note", { 215900, 279400 }, IDS_FORM_NOTE }, + { L"Envelope #9", { 98425, 225425 }, IDS_FORM_ENVELOPE_9 }, + { L"Envelope #10", { 104775, 241300 }, IDS_FORM_ENVELOPE_10 }, + { L"Envelope #11", { 114300, 263525 }, IDS_FORM_ENVELOPE_11 }, + { L"Envelope #12", { 120650, 279400 }, IDS_FORM_ENVELOPE_12 }, + { L"Envelope #14", { 127000, 292100 }, IDS_FORM_ENVELOPE_14 }, + { L"C size sheet", { 431800, 558800 }, IDS_FORM_C_SIZE_SHEET }, + { L"D size sheet", { 558800, 863600 }, IDS_FORM_D_SIZE_SHEET }, + { L"E size sheet", { 863600, 1117600 }, IDS_FORM_E_SIZE_SHEET }, + { L"Envelope DL", { 110000, 220000 }, IDS_FORM_ENVELOPE_DL }, + { L"Envelope C5", { 162000, 229000 }, IDS_FORM_ENVELOPE_C5 }, + { L"Envelope C3", { 324000, 458000 }, IDS_FORM_ENVELOPE_C3 }, + { L"Envelope C4", { 229000, 324000 }, IDS_FORM_ENVELOPE_C4 }, + { L"Envelope C6", { 114000, 162000 }, IDS_FORM_ENVELOPE_C6 }, + { L"Envelope C65", { 114000, 229000 }, IDS_FORM_ENVELOPE_C65 }, + { L"Envelope B4", { 250000, 353000 }, IDS_FORM_ENVELOPE_B4 }, + { L"Envelope B5", { 176000, 250000 }, IDS_FORM_ENVELOPE_B5 }, + { L"Envelope B6", { 176000, 125000 }, IDS_FORM_ENVELOPE_B6 }, + { L"Envelope", { 110000, 230000 }, IDS_FORM_ENVELOPE }, + { L"Envelope Monarch", { 98425, 190500 }, IDS_FORM_ENVELOPE_MONARCH }, + { L"6 3/4 Envelope", { 92075, 165100 }, IDS_FORM_6_34_ENVELOPE }, + { L"US Std Fanfold", { 377825, 279400 }, IDS_FORM_US_STD_FANFOLD }, + { L"German Std Fanfold", { 215900, 304800 }, IDS_FORM_GERMAN_STD_FANFOLD }, + { L"German Legal Fanfold", { 215900, 330200 }, IDS_FORM_GERMAN_LEGAL_FANFOLD }, + { L"B4 (ISO)", { 250000, 353000 }, IDS_FORM_B4_ISO }, + { L"Japanese Postcard", { 100000, 148000 }, IDS_FORM_JAPANESE_POSTCARD }, + { L"9x11", { 228600, 279400 }, IDS_FORM_9x11 }, + { L"10x11", { 254000, 279400 }, IDS_FORM_10x11 }, + { L"15x11", { 381000, 279400 }, IDS_FORM_15x11 }, + { L"Envelope Invite", { 220000, 220000 }, IDS_FORM_ENVELOPE_INVITE }, + { L"Letter Extra", { 241300, 304800 }, IDS_FORM_LETTER_EXTRA }, + { L"Legal Extra", { 241300, 381000 }, IDS_FORM_LEGAL_EXTRA }, + { L"Tabloid Extra", { 304800, 457200 }, IDS_FORM_TABLOID_EXTRA }, + { L"A4 Extra", { 235458, 322326 }, IDS_FORM_A4_EXTRA }, + { L"Letter Transverse", { 215900, 279400 }, IDS_FORM_LETTER_TRANSVERSE }, + { L"A4 Transverse", { 210000, 297000 }, IDS_FORM_A4_TRANSVERSE }, + { L"Letter Extra Transverse", { 241300, 304800 }, IDS_FORM_LETTER_EXTRA_TRANSVERSE }, + { L"Super A", { 227000, 356000 }, IDS_FORM_SUPER_A }, + { L"Super B", { 305000, 487000 }, IDS_FORM_SUPER_B }, + { L"Letter Plus", { 215900, 322326 }, IDS_FORM_LETTER_PLUS }, + { L"A4 Plus", { 210000, 330000 }, IDS_FORM_A4_PLUS }, + { L"A5 Transverse", { 148000, 210000 }, IDS_FORM_A5_TRANSVERSE }, + { L"B5 (JIS) Transverse", { 182000, 257000 }, IDS_FORM_B5_JIS_TRANSVERSE }, + { L"A3 Extra", { 322000, 445000 }, IDS_FORM_A3_EXTRA }, + { L"A5 Extra", { 174000, 235000 }, IDS_FORM_A5_EXTRA }, + { L"B5 (ISO) Extra", { 201000, 276000 }, IDS_FORM_B5_ISO_EXTRA }, + { L"A2", { 420000, 594000 }, IDS_FORM_A2 }, + { L"A3 Transverse", { 297000, 420000 }, IDS_FORM_A3_TRANSVERSE }, + { L"A3 Extra Transverse", { 322000, 445000 }, IDS_FORM_A3_EXTRA_TRANSVERSE }, + { L"Japanese Double Postcard", { 200000, 148000 }, IDS_FORM_JAPANESE_DOUBLE_POSTCARD }, + { L"A6", { 105000, 148000 }, IDS_FORM_A6 }, + { L"Japanese Envelope Kaku #2", { 240000, 332000 }, IDS_FORM_JAPANESE_ENVELOPE_KAKU_2 }, + { L"Japanese Envelope Kaku #3", { 216000, 277000 }, IDS_FORM_JAPANESE_ENVELOPE_KAKU_3 }, + { L"Japanese Envelope Chou #3", { 120000, 235000 }, IDS_FORM_JAPANESE_ENVELOPE_CHOU_3 }, + { L"Japanese Envelope Chou #4", { 90000, 205000 }, IDS_FORM_JAPANESE_ENVELOPE_CHOU_4 }, + { L"Letter Rotated", { 279400, 215900 }, IDS_FORM_LETTER_ROTATED }, + { L"A3 Rotated", { 420000, 297000 }, IDS_FORM_A3_ROTATED }, + { L"A4 Rotated", { 297000, 210000 }, IDS_FORM_A4_ROTATED }, + { L"A5 Rotated", { 210000, 148000 }, IDS_FORM_A5_ROTATED }, + { L"B4 (JIS) Rotated", { 364000, 257000 }, IDS_FORM_B4_JIS_ROTATED }, + { L"B5 (JIS) Rotated", { 257000, 182000 }, IDS_FORM_B5_JIS_ROTATED }, + { L"Japanese Postcard Rotated", { 148000, 100000 }, IDS_FORM_JAPANESE_POSTCARD_ROTATED }, + { L"Double Japan Postcard Rotated", { 148000, 200000 }, IDS_FORM_DOUBLE_JAPAN_POSTCARD_ROTATED }, + { L"A6 Rotated", { 148000, 105000 }, IDS_FORM_A6_ROTATED }, + { L"Japan Envelope Kaku #2 Rotated", { 332000, 240000 }, IDS_FORM_JAPAN_ENVELOPE_KAKU_2_ROTATED }, + { L"Japan Envelope Kaku #3 Rotated", { 277000, 216000 }, IDS_FORM_JAPAN_ENVELOPE_KAKU_3_ROTATED }, + { L"Japan Envelope Chou #3 Rotated", { 235000, 120000 }, IDS_FORM_JAPAN_ENVELOPE_CHOU_3_ROTATED }, + { L"Japan Envelope Chou #4 Rotated", { 205000, 90000 }, IDS_FORM_JAPAN_ENVELOPE_CHOU_4_ROTATED }, + { L"B6 (JIS)", { 128000, 182000 }, IDS_FORM_B6_JIS }, + { L"B6 (JIS) Rotated", { 182000, 128000 }, IDS_FORM_B6_JIS_ROTATED }, + { L"12x11", { 304932, 279521 }, IDS_FORM_12x11 }, + { L"Japan Envelope You #4", { 105000, 235000 }, IDS_FORM_JAPAN_ENVELOPE_YOU_4 }, + { L"Japan Envelope You #4 Rotated", { 235000, 105000 }, IDS_FORM_JAPAN_ENVELOPE_YOU_4_ROTATED }, + { L"PRC 16K", { 188000, 260000 }, IDS_FORM_PRC_16K }, + { L"PRC 32K", { 130000, 184000 }, IDS_FORM_PRC_32K }, + { L"PRC 32K(Big)", { 140000, 203000 }, IDS_FORM_PRC_32K_BIG }, + { L"PRC Envelope #1", { 102000, 165000 }, IDS_FORM_PRC_ENVELOPE_1 }, + { L"PRC Envelope #2", { 102000, 176000 }, IDS_FORM_PRC_ENVELOPE_2 }, + { L"PRC Envelope #3", { 125000, 176000 }, IDS_FORM_PRC_ENVELOPE_3 }, + { L"PRC Envelope #4", { 110000, 208000 }, IDS_FORM_PRC_ENVELOPE_4 }, + { L"PRC Envelope #5", { 110000, 220000 }, IDS_FORM_PRC_ENVELOPE_5 }, + { L"PRC Envelope #6", { 120000, 230000 }, IDS_FORM_PRC_ENVELOPE_6 }, + { L"PRC Envelope #7", { 160000, 230000 }, IDS_FORM_PRC_ENVELOPE_7 }, + { L"PRC Envelope #8", { 120000, 309000 }, IDS_FORM_PRC_ENVELOPE_8 }, + { L"PRC Envelope #9", { 229000, 324000 }, IDS_FORM_PRC_ENVELOPE_9 }, + { L"PRC Envelope #10", { 324000, 458000 }, IDS_FORM_PRC_ENVELOPE_10 }, + { L"PRC 16K Rotated", { 260000, 188000 }, IDS_FORM_PRC_16K_ROTATED }, + { L"PRC 32K Rotated", { 184000, 130000 }, IDS_FORM_PRC_32K_ROTATED }, + { L"PRC 32K(Big) Rotated", { 203000, 140000 }, IDS_FORM_PRC_32K_BIG_ROTATED }, + { L"PRC Envelope #1 Rotated", { 165000, 102000 }, IDS_FORM_PRC_ENVELOPE_1_ROTATED }, + { L"PRC Envelope #2 Rotated", { 176000, 102000 }, IDS_FORM_PRC_ENVELOPE_2_ROTATED }, + { L"PRC Envelope #3 Rotated", { 176000, 125000 }, IDS_FORM_PRC_ENVELOPE_3_ROTATED }, + { L"PRC Envelope #4 Rotated", { 208000, 110000 }, IDS_FORM_PRC_ENVELOPE_4_ROTATED }, + { L"PRC Envelope #5 Rotated", { 220000, 110000 }, IDS_FORM_PRC_ENVELOPE_5_ROTATED }, + { L"PRC Envelope #6 Rotated", { 230000, 120000 }, IDS_FORM_PRC_ENVELOPE_6_ROTATED }, + { L"PRC Envelope #7 Rotated", { 230000, 160000 }, IDS_FORM_PRC_ENVELOPE_7_ROTATED }, + { L"PRC Envelope #8 Rotated", { 309000, 120000 }, IDS_FORM_PRC_ENVELOPE_8_ROTATED }, + { L"PRC Envelope #9 Rotated", { 324000, 229000 }, IDS_FORM_PRC_ENVELOPE_9_ROTATED }, + { L"PRC Envelope #10 Rotated", { 458000, 324000 }, IDS_FORM_PRC_ENVELOPE_10_ROTATED } +}; + + /* ############################### */
static CRITICAL_SECTION monitor_handles_cs; @@ -2506,6 +2633,73 @@ static BOOL WINAPI fpXcvData(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInputData, return TRUE; }
+static inline size_t form_struct_size( DWORD level ) +{ + if (level == 1) return sizeof(FORM_INFO_1W); + if (level == 2) return sizeof(FORM_INFO_2W); + + SetLastError( ERROR_INVALID_LEVEL ); + return 0; +} + +static void fill_builtin_form_info( BYTE **base, WCHAR **strings, const struct builtin_form *form, DWORD level, + DWORD size, DWORD *used ) +{ + FORM_INFO_2W *info = *(FORM_INFO_2W**)base; + DWORD name_len = lstrlenW( form->name ) + 1, res_len, keyword_len, total_size; + static const WCHAR dll_name[] = L"localspl.dll"; + const WCHAR *resource; + + total_size = name_len * sizeof(WCHAR); + + if (level > 1) + { + keyword_len = WideCharToMultiByte( CP_ACP, 0, form->name, -1, NULL, 0, NULL, NULL ); + keyword_len = (keyword_len + 1) & ~1; + total_size += keyword_len; + res_len = LoadStringW( localspl_instance, form->res_id, (WCHAR *)&resource, 0 ); + if (res_len && resource[res_len - 1]) res_len++; + total_size += (res_len + ARRAY_SIZE(dll_name)) * sizeof(WCHAR); + } + + if (*used + total_size <= size) + { + info->Flags = FORM_BUILTIN; + info->pName = memcpy( *strings, form->name, name_len * sizeof(WCHAR) ); + *strings += name_len; + info->Size = form->size; + info->ImageableArea.left = info->ImageableArea.top = 0; + info->ImageableArea.right = info->Size.cx; + info->ImageableArea.bottom = info->Size.cy; + if (level > 1) + { + info->pKeyword = (char *)*strings; + WideCharToMultiByte( CP_ACP, 0, form->name, -1, (char *)info->pKeyword, keyword_len, NULL, NULL ); + *strings += keyword_len / sizeof(WCHAR); + info->StringType = STRING_MUIDLL; + info->pMuiDll = memcpy( *strings, dll_name, sizeof(dll_name) ); + *strings += ARRAY_SIZE(dll_name); + info->dwResourceId = form->res_id; + if (res_len) + { + info->StringType |= STRING_LANGPAIR; + info->pDisplayName = memcpy( *strings, resource, (res_len - 1) * sizeof(WCHAR) ); + info->pDisplayName[res_len - 1] = '\0'; + *strings += res_len; + info->wLangId = GetUserDefaultLangID(); + } + else + { + info->pDisplayName = NULL; + info->wLangId = 0; + } + } + } + + *base += form_struct_size( level ); + *used += total_size; +} + static BOOL WINAPI fpAddForm( HANDLE printer, DWORD level, BYTE *form ) { FIXME( "(%p, %d, %p): stub\n", printer, level, form ); @@ -2532,9 +2726,31 @@ static BOOL WINAPI fpSetForm( HANDLE printer, WCHAR *name, DWORD level, BYTE *fo
static BOOL WINAPI fpEnumForms( HANDLE printer, DWORD level, BYTE *form, DWORD size, DWORD *needed, DWORD *count ) { - FIXME( "(%p, %d, %p, %d, %p, %p): stub\n", printer, level, form, size, needed, count ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return FALSE; + DWORD num = ARRAY_SIZE(builtin_forms), i; + WCHAR *strings = NULL; + BYTE *base = form; + size_t struct_size = form_struct_size( level ); + + TRACE( "(%p, %d, %p, %d, %p, %p)\n", printer, level, form, size, needed, count ); + + *count = *needed = 0; + + if (!struct_size) return FALSE; + + *needed = num * struct_size; + if (*needed < size) strings = (WCHAR *)(form + *needed); + + for (i = 0; i < ARRAY_SIZE(builtin_forms); i++) + fill_builtin_form_info( &base, &strings, builtin_forms + i, level, size, needed ); + + if (*needed > size) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + *count = i; + return TRUE; }
static const PRINTPROVIDOR backend = { diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 368584c2382..b42a1af8dcb 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -7415,6 +7415,18 @@ BOOL WINAPI EnumFormsW( HANDLE printer, DWORD level, BYTE *form, DWORD size, DWO return FALSE; }
+ if (!needed || !count) + { + SetLastError( RPC_X_NULL_REF_POINTER ); + return FALSE; + } + + if (!form && size) + { + SetLastError( ERROR_INVALID_USER_BUFFER ); + return FALSE; + } + return backend->fpEnumForms( handle, level, form, size, needed, count ); }