ReactOS 0.4.17-dev-970-gcf0f1a6
printdlg.c
Go to the documentation of this file.
1/*
2 * Unit test suite for comdlg32 API functions: printer dialogs
3 *
4 * Copyright 2006-2007 Detlef Riekenberg
5 * Copyright 2013 Dmitry Timoshkov
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 *
21 */
22
23#define COBJMACROS
24#define CONST_VTABLE
25
26#include <stdarg.h>
27#include <stdio.h>
28
29#include "windef.h"
30#include "winbase.h"
31#include "winerror.h"
32#include "wingdi.h"
33#include "winuser.h"
34#include "objbase.h"
35
36#include "cderr.h"
37#include "commdlg.h"
38#include "dlgs.h"
39#include "winspool.h"
40
41#include "wine/test.h"
42
43/* ########################### */
44
45extern const IID IID_IObjectWithSite;
46
48static HRESULT (WINAPI * pPrintDlgExW)(LPPRINTDLGEXW);
49
50/* ########################### */
51
52static const CHAR emptyA[] = "";
53static const CHAR PrinterPortsA[] = "PrinterPorts";
54
55/* ########################### */
56
57static void test_PageSetupDlgA(void)
58{
59 LPPAGESETUPDLGA pDlg;
60 DWORD res;
61
62 pDlg = malloc((sizeof(PAGESETUPDLGA)) * 2);
63 if (!pDlg) return;
64
65 SetLastError(0xdeadbeef);
68 "returned %lu with %lu and 0x%lx (expected '0' and "
69 "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
70
71 ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));
72 pDlg->lStructSize = sizeof(PAGESETUPDLGA) -1;
73 SetLastError(0xdeadbeef);
74 res = PageSetupDlgA(pDlg);
76 "returned %lu with %lu and 0x%lx (expected '0' and "
77 "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
78
79 ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));
80 pDlg->lStructSize = sizeof(PAGESETUPDLGA) +1;
82 SetLastError(0xdeadbeef);
83 res = PageSetupDlgA(pDlg);
85 "returned %lu with %lu and 0x%lx (expected '0' and CDERR_STRUCTSIZE)\n",
87
88
89 ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));
90 pDlg->lStructSize = sizeof(PAGESETUPDLGA);
92 SetLastError(0xdeadbeef);
93 res = PageSetupDlgA(pDlg);
95 "returned %lu with %lu and 0x%lx (expected '!= 0' or '0' and "
96 "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());
97
99 skip("No printer configured.\n");
100 free(pDlg);
101 return;
102 }
103
104 ok( pDlg->hDevMode && pDlg->hDevNames,
105 "got %p and %p (expected '!= NULL' for both)\n",
106 pDlg->hDevMode, pDlg->hDevNames);
107
108 GlobalFree(pDlg->hDevMode);
109 GlobalFree(pDlg->hDevNames);
110
111 free(pDlg);
112}
113
114/* ########################### */
115
117{
118 if (msg == WM_INITDIALOG)
119 {
120 /* some driver popup a dialog and hung the test or silently limit the number of copies,
121 when trying to set more than 999 copies */
122 SetDlgItemInt(hdlg, edt3, 123, FALSE);
124 }
125 return 0;
126}
127
128static void test_PrintDlgA(void)
129{
130 DWORD res, n_copies = 0;
131 LPPRINTDLGA pDlg;
132 DEVNAMES *pDevNames;
135 LPCSTR port;
137 LPSTR ptr;
138 DEVMODEA *dm;
139
140 pDlg = malloc((sizeof(PRINTDLGA)) * 2);
141 if (!pDlg) return;
142
143
144 /* will crash with unpatched wine */
145 SetLastError(0xdeadbeef);
146 res = PrintDlgA(NULL);
148 "returned %ld with 0x%lx and 0x%lx (expected '0' and "
149 "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
150
151 ZeroMemory(pDlg, sizeof(PRINTDLGA));
152 pDlg->lStructSize = sizeof(PRINTDLGA) - 1;
153 SetLastError(0xdeadbeef);
154 res = PrintDlgA(pDlg);
156 "returned %ld with 0x%lx and 0x%lx (expected '0' and "
157 "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
158
159 ZeroMemory(pDlg, sizeof(PRINTDLGA));
160 pDlg->lStructSize = sizeof(PRINTDLGA) + 1;
161 pDlg->Flags = PD_RETURNDEFAULT;
162 SetLastError(0xdeadbeef);
163 res = PrintDlgA(pDlg);
165 "returned %lu with %lu and 0x%lx (expected '0' and "
166 "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
167
168
169 ZeroMemory(pDlg, sizeof(PRINTDLGA));
170 pDlg->lStructSize = sizeof(PRINTDLGA);
171 pDlg->Flags = PD_RETURNDEFAULT;
172 SetLastError(0xdeadbeef);
173 res = PrintDlgA(pDlg);
175 "returned %ld with 0x%lx and 0x%lx (expected '!= 0' or '0' and "
176 "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());
177
179 skip("No printer configured.\n");
180 free(pDlg);
181 return;
182 }
183
184 ok(pDlg->hDevNames != NULL, "(expected '!= NULL')\n");
185 pDevNames = GlobalLock(pDlg->hDevNames);
186 ok(pDevNames != NULL, "(expected '!= NULL')\n");
187
188 if (pDevNames) {
189 ok(pDevNames->wDriverOffset, "(expected '!= 0' for wDriverOffset)\n");
190 ok(pDevNames->wDeviceOffset, "(expected '!= 0' for wDeviceOffset)\n");
191 ok(pDevNames->wOutputOffset, "(expected '!= 0' for wOutputOffset)\n");
192 ok(pDevNames->wDefault == DN_DEFAULTPRN, "got 0x%x (expected DN_DEFAULTPRN)\n", pDevNames->wDefault);
193
194 driver = (LPCSTR)pDevNames + pDevNames->wDriverOffset;
195 device = (LPCSTR)pDevNames + pDevNames->wDeviceOffset;
196 port = (LPCSTR)pDevNames + pDevNames->wOutputOffset;
197 trace("driver '%s' device '%s' port '%s'\n", driver, device, port);
198
199 /* The Driver Entry does not include a Path */
200 ptr = strrchr(driver, '\\');
201 ok( ptr == NULL, "got %p for '%s' (expected NULL for a simple name)\n", ptr, driver);
202
203 /* The Driver Entry does not have an extension (fixed to ".drv") */
204 ptr = strrchr(driver, '.');
205 todo_wine {
206 ok( ptr == NULL, "got %p for '%s' (expected NULL for no extension)\n", ptr, driver);
207 }
208
209
210 buffer[0] = '\0';
211 SetLastError(0xdeadbeef);
213 ptr = strchr(buffer, ',');
214 ok( (res > 1) && (ptr != NULL),
215 "got %lu with %lu and %p for '%s' (expected '>1' and '!= NULL')\n",
217
218 if (ptr) ptr[0] = '\0';
219 ok( lstrcmpiA(driver, buffer) == 0,
220 "got driver '%s' (expected '%s')\n", driver, buffer);
221
223 ok(n_copies > 0, "DeviceCapabilities(DC_COPIES) failed\n");
224 }
225
226 GlobalUnlock(pDlg->hDevNames);
227 GlobalFree(pDlg->hDevMode);
228 GlobalFree(pDlg->hDevNames);
229
230 /* if device doesn't support printing of multiple copies then
231 * an attempt to set number of copies > 1 in print dialog would
232 * cause the PrintDlg under Windows display the MessageBox and
233 * the test will hang waiting for user response.
234 */
235 if (n_copies > 1)
236 {
237 ZeroMemory(pDlg, sizeof(*pDlg));
238 pDlg->lStructSize = sizeof(*pDlg);
241 res = PrintDlgA(pDlg);
242 ok(res, "PrintDlg error %#lx\n", CommDlgExtendedError());
243 /* Version of Microsoft XPS Document Writer driver shipped before Win7
244 * reports that it can print multiple copies, but returns 1.
245 */
246 ok(pDlg->nCopies == 123 || broken(pDlg->nCopies == 1), "expected nCopies 123, got %d\n", pDlg->nCopies);
247 ok(pDlg->hDevMode != 0, "hDevMode should not be 0\n");
248 dm = GlobalLock(pDlg->hDevMode);
249 /* some broken drivers use always PD_USEDEVMODECOPIES */
250 ok((dm->dmCopies == 1) || broken(dm->dmCopies == 123),
251 "expected dm->dmCopies 1, got %d\n", dm->dmCopies);
252 GlobalUnlock(pDlg->hDevMode);
253 GlobalFree(pDlg->hDevMode);
254 GlobalFree(pDlg->hDevNames);
255
256 ZeroMemory(pDlg, sizeof(*pDlg));
257 pDlg->lStructSize = sizeof(*pDlg);
260 res = PrintDlgA(pDlg);
261 ok(res, "PrintDlg error %#lx\n", CommDlgExtendedError());
262 ok(pDlg->nCopies == 1, "expected nCopies 1, got %d\n", pDlg->nCopies);
263 ok(pDlg->hDevMode != 0, "hDevMode should not be 0\n");
264 dm = GlobalLock(pDlg->hDevMode);
265 ok(dm->dmCopies == 123, "expected dm->dmCopies 123, got %d\n", dm->dmCopies);
266 GlobalUnlock(pDlg->hDevMode);
267 GlobalFree(pDlg->hDevMode);
268 GlobalFree(pDlg->hDevNames);
269 }
270
271 free(pDlg);
272}
273
274/* ########################### */
275
276static HRESULT WINAPI callback_QueryInterface(IPrintDialogCallback *iface,
277 REFIID riid, void **ppv)
278{
279 ok(0, "callback_QueryInterface(%s): unexpected call\n", wine_dbgstr_guid(riid));
280 return E_NOINTERFACE;
281}
282
283static ULONG WINAPI callback_AddRef(IPrintDialogCallback *iface)
284{
285 trace("callback_AddRef\n");
286 return 2;
287}
288
289static ULONG WINAPI callback_Release(IPrintDialogCallback *iface)
290{
291 trace("callback_Release\n");
292 return 1;
293}
294
295static HRESULT WINAPI callback_InitDone(IPrintDialogCallback *iface)
296{
297 trace("callback_InitDone\n");
298 return S_OK;
299}
300
301static HRESULT WINAPI callback_SelectionChange(IPrintDialogCallback *iface)
302{
303 trace("callback_SelectionChange\n");
304 return S_OK;
305}
306
307static HRESULT WINAPI callback_HandleMessage(IPrintDialogCallback *iface,
308 HWND hdlg, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res)
309{
310 trace("callback_HandleMessage %p,%04x,%Ix,%Ix,%p\n", hdlg, msg, wp, lp, res);
311 /* *res = PD_RESULT_PRINT; */
312 return S_OK;
313}
314
315static const IPrintDialogCallbackVtbl callback_Vtbl =
316{
323};
324
325static IPrintDialogCallback callback = { &callback_Vtbl };
326
328{
329 trace("unknown_QueryInterface %s\n", wine_dbgstr_guid(riid));
330
331 if (IsEqualGUID(riid, &IID_IPrintDialogCallback))
332 {
333 *ppv = &callback;
334 return S_OK;
335 }
337 {
338 *ppv = NULL;
339 return E_NOINTERFACE;
340 }
341
342 ok(0, "unexpected IID %s\n", wine_dbgstr_guid(riid));
343 *ppv = NULL;
344 return E_NOINTERFACE;
345}
346
348{
349 trace("unknown_AddRef\n");
350 return 2;
351}
352
354{
355 trace("unknown_Release\n");
356 return 1;
357}
358
359static const IUnknownVtbl unknown_Vtbl =
360{
364};
365
367
368static void test_PrintDlgExW(void)
369{
370 PRINTPAGERANGE pagerange[2];
371 LPPRINTDLGEXW pDlg;
372 DEVNAMES *dn;
373 HRESULT res;
374
375 /* PrintDlgEx not present before w2k */
376 if (!pPrintDlgExW) {
377 win_skip("PrintDlgExW not available\n");
378 return;
379 }
380
381 if (0) /* Crashes on Win10 */
382 {
383 /* Set CommDlgExtendedError != 0 */
385 SetLastError(0xdeadbeef);
386 res = pPrintDlgExW(NULL);
387 ok( (res == E_INVALIDARG),
388 "got 0x%lx with %lu and %lu (expected 'E_INVALIDARG')\n",
390 }
391
392 pDlg = malloc(sizeof(PRINTDLGEXW) + 8);
393 if (!pDlg) return;
394
395 /* lStructSize must be exact */
396 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
397 pDlg->lStructSize = sizeof(PRINTDLGEXW) - 1;
399 SetLastError(0xdeadbeef);
400 res = pPrintDlgExW(pDlg);
401 ok( (res == E_INVALIDARG),
402 "got 0x%lx with %lu and %lu (expected 'E_INVALIDARG')\n",
404
405
406 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
407 pDlg->lStructSize = sizeof(PRINTDLGEXW) + 1;
409 SetLastError(0xdeadbeef);
410 res = pPrintDlgExW(pDlg);
411 ok( (res == E_INVALIDARG),
412 "got 0x%lx with %lu and %lu (expected 'E_INVALIDARG')\n",
414
415
416 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
417 pDlg->lStructSize = sizeof(PRINTDLGEXW);
418 SetLastError(0xdeadbeef);
419 res = pPrintDlgExW(pDlg);
420 ok( (res == E_HANDLE),
421 "got 0x%lx with %lu and %lu (expected 'E_HANDLE')\n",
423
424 /* nStartPage must be START_PAGE_GENERAL for the general page or a valid property sheet index */
425 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
426 pDlg->lStructSize = sizeof(PRINTDLGEXW);
427 pDlg->hwndOwner = GetDesktopWindow();
429 res = pPrintDlgExW(pDlg);
430 ok((res == E_INVALIDARG), "got 0x%lx (expected 'E_INVALIDARG')\n", res);
431
432 /* Use PD_NOPAGENUMS or set nMaxPageRanges and lpPageRanges */
433 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
434 pDlg->lStructSize = sizeof(PRINTDLGEXW);
435 pDlg->hwndOwner = GetDesktopWindow();
436 pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
437 pDlg->nStartPage = START_PAGE_GENERAL;
438 res = pPrintDlgExW(pDlg);
439 ok((res == E_INVALIDARG), "got 0x%lx (expected 'E_INVALIDARG')\n", res);
440
441 /* this is invalid: a valid lpPageRanges with 0 for nMaxPageRanges */
442 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
443 pDlg->lStructSize = sizeof(PRINTDLGEXW);
444 pDlg->hwndOwner = GetDesktopWindow();
445 pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
446 pDlg->lpPageRanges = pagerange;
447 pDlg->nStartPage = START_PAGE_GENERAL;
448 res = pPrintDlgExW(pDlg);
449 ok((res == E_INVALIDARG), "got 0x%lx (expected 'E_INVALIDARG')\n", res);
450
451 /* this is invalid: NULL for lpPageRanges with a valid nMaxPageRanges */
452 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
453 pDlg->lStructSize = sizeof(PRINTDLGEXW);
454 pDlg->hwndOwner = GetDesktopWindow();
455 pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
456 pDlg->nMaxPageRanges = 1;
457 pDlg->nStartPage = START_PAGE_GENERAL;
458 res = pPrintDlgExW(pDlg);
459 ok((res == E_INVALIDARG), "got 0x%lx (expected 'E_INVALIDARG')\n", res);
460
461 /* this works: lpPageRanges with a valid nMaxPageRanges */
462 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
463 pDlg->lStructSize = sizeof(PRINTDLGEXW);
464 pDlg->hwndOwner = GetDesktopWindow();
465 pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
466 pDlg->nMaxPageRanges = 1;
467 pDlg->lpPageRanges = pagerange;
468 pDlg->nStartPage = START_PAGE_GENERAL;
469 res = pPrintDlgExW(pDlg);
470 if (res == E_FAIL)
471 {
472 skip("No printer configured.\n");
473 free(pDlg);
474 return;
475 }
476
477 ok(res == S_OK, "got 0x%lx (expected S_OK)\n", res);
478
479 dn = GlobalLock(pDlg->hDevNames);
480 ok(dn != NULL, "expected '!= NULL' for GlobalLock(%p)\n",pDlg->hDevNames);
481 if (dn)
482 {
483 ok(dn->wDriverOffset, "(expected '!= 0' for wDriverOffset)\n");
484 ok(dn->wDeviceOffset, "(expected '!= 0' for wDeviceOffset)\n");
485 ok(dn->wOutputOffset, "(expected '!= 0' for wOutputOffset)\n");
486 ok(dn->wDefault == DN_DEFAULTPRN, "got 0x%x (expected DN_DEFAULTPRN)\n", dn->wDefault);
487
488 GlobalUnlock(pDlg->hDevNames);
489 }
490 GlobalFree(pDlg->hDevMode);
491 GlobalFree(pDlg->hDevNames);
492
493 /* this works also: PD_NOPAGENUMS */
494 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
495 pDlg->lStructSize = sizeof(PRINTDLGEXW);
496 pDlg->hwndOwner = GetDesktopWindow();
498 pDlg->nStartPage = START_PAGE_GENERAL;
499 res = pPrintDlgExW(pDlg);
500 ok(res == S_OK, "got 0x%lx (expected S_OK)\n", res);
501 GlobalFree(pDlg->hDevMode);
502 GlobalFree(pDlg->hDevNames);
503
504 /* this works: PD_RETURNDC with PD_RETURNDEFAULT */
505 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
506 pDlg->lStructSize = sizeof(PRINTDLGEXW);
507 pDlg->hwndOwner = GetDesktopWindow();
509 pDlg->nStartPage = START_PAGE_GENERAL;
510 res = pPrintDlgExW(pDlg);
511 ok(res == S_OK, "got 0x%lx (expected S_OK)\n", res);
512 ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNDC\n");
513 GlobalFree(pDlg->hDevMode);
514 GlobalFree(pDlg->hDevNames);
515 DeleteDC(pDlg->hDC);
516
517 /* this works: PD_RETURNIC with PD_RETURNDEFAULT */
518 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
519 pDlg->lStructSize = sizeof(PRINTDLGEXW);
520 pDlg->hwndOwner = GetDesktopWindow();
522 pDlg->nStartPage = START_PAGE_GENERAL;
523 res = pPrintDlgExW(pDlg);
524 ok(res == S_OK, "got 0x%lx (expected S_OK)\n", res);
525 ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNIC\n");
526 GlobalFree(pDlg->hDevMode);
527 GlobalFree(pDlg->hDevNames);
528 DeleteDC(pDlg->hDC);
529
530 /* interactive PrintDlgEx tests */
531
533 {
534 skip("interactive PrintDlgEx tests (set WINETEST_INTERACTIVE=1)\n");
535 free(pDlg);
536 return;
537 }
538
539 ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
540 pDlg->lStructSize = sizeof(PRINTDLGEXW);
541 pDlg->hwndOwner = GetDesktopWindow();
542 pDlg->Flags = PD_NOPAGENUMS | PD_RETURNIC;
543 pDlg->nStartPage = START_PAGE_GENERAL;
544 pDlg->lpCallback = &unknown;
545 pDlg->dwResultAction = S_OK;
546 res = pPrintDlgExW(pDlg);
547 ok(res == S_OK, "got 0x%lx (expected S_OK)\n", res);
548 ok(pDlg->dwResultAction == PD_RESULT_PRINT, "expected PD_RESULT_PRINT, got %#lx\n", pDlg->dwResultAction);
549 ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNIC\n");
550 GlobalFree(pDlg->hDevMode);
551 GlobalFree(pDlg->hDevNames);
552 DeleteDC(pDlg->hDC);
553
554 free(pDlg);
555}
556
559static void test_abort_proc(void)
560{
561 HDC print_dc;
562 RECT rect = {0, 0, 100, 100};
563 DOCINFOA doc_info = {0};
564 PRINTDLGA pd = {0};
565 char filename[MAX_PATH];
566 int job_id;
567
568 if (!GetTempFileNameA(".", "prn", 0, filename))
569 {
570 skip("Failed to create a temporary file name\n");
571 return;
572 }
573
574 pd.lStructSize = sizeof(pd);
576 pd.nFromPage = 1;
577 pd.nToPage = 1;
578 pd.nCopies = 1;
579
580 if (!PrintDlgA(&pd))
581 {
582 skip("No default printer available.\n");
583 goto end;
584 }
587
588 ok(pd.hDC != NULL, "PrintDlg didn't return a DC.\n");
589 if (!(print_dc = pd.hDC))
590 goto end;
591
592 ok(SetAbortProc(print_dc, abort_proc) > 0, "SetAbortProc failed\n");
593 ok(!abort_proc_called, "AbortProc got called unexpectedly by SetAbortProc.\n");
595
596 doc_info.cbSize = sizeof(doc_info);
597 doc_info.lpszDocName = "Some document";
598 doc_info.lpszOutput = filename;
599
600 job_id = StartDocA(print_dc, &doc_info);
601
602 ok(job_id > 0 ||
603 GetLastError() == ERROR_SPL_NO_STARTDOC, /* Vista can fail with this error when using the XPS driver */
604 "StartDocA failed ret %d gle %ld\n", job_id, GetLastError());
605
606 if(job_id <= 0)
607 {
608 skip("StartDoc failed\n");
609 goto end;
610 }
611
612 /* StartDoc may or may not call abort proc */
613
615 ok(StartPage(print_dc) > 0, "StartPage failed\n");
616 ok(!abort_proc_called, "AbortProc got called unexpectedly by StartPage.\n");
618
619 /* following functions sometimes call abort proc too */
620 ok(FillRect(print_dc, &rect, (HBRUSH)(COLOR_BACKGROUND + 1)), "FillRect failed\n");
621 ok(EndPage(print_dc) > 0, "EndPage failed\n");
622 ok(EndDoc(print_dc) > 0, "EndDoc failed\n");
623
625 ok(DeleteDC(print_dc), "DeleteDC failed\n");
626 ok(!abort_proc_called, "AbortProc got called unexpectedly by DeleteDC.\n");
628
629end:
630 SetLastError(0xdeadbeef);
632 trace("Failed to delete temporary file (err = %lx)\n", GetLastError());
633}
634
635/* ########################### */
636
637START_TEST(printdlg)
638{
639 hcomdlg32 = GetModuleHandleA("comdlg32.dll");
640 pPrintDlgExW = (void *) GetProcAddress(hcomdlg32, "PrintDlgExW");
641
646}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define msg(x)
Definition: auth_time.c:54
#define PDERR_NODEFAULTPRN
Definition: cderr.h:26
#define CDERR_INITIALIZATION
Definition: cderr.h:7
#define CDERR_STRUCTSIZE
Definition: cderr.h:6
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:144
RECT rect
Definition: combotst.c:67
#define DN_DEFAULTPRN
Definition: commdlg.h:199
#define PD_RETURNIC
Definition: commdlg.h:156
struct tagPSDA PAGESETUPDLGA
#define START_PAGE_GENERAL
Definition: commdlg.h:205
#define PD_USEDEVMODECOPIES
Definition: commdlg.h:165
#define PD_RETURNDC
Definition: commdlg.h:155
#define PD_ENABLEPRINTHOOK
Definition: commdlg.h:159
#define PD_RETURNDEFAULT
Definition: commdlg.h:157
struct tagPDA PRINTDLGA
#define PD_PRINTTOFILE
Definition: commdlg.h:152
#define PD_ALLPAGES
Definition: commdlg.h:146
#define PSD_RETURNDEFAULT
Definition: commdlg.h:181
#define PD_NOWARNING
Definition: commdlg.h:154
#define PSD_NOWARNING
Definition: commdlg.h:178
#define PD_RESULT_PRINT
Definition: commdlg.h:202
#define PD_NOPAGENUMS
Definition: commdlg.h:150
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define edt3
Definition: dlgs.h:72
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg)
Definition: printdlg.c:3975
BOOL WINAPI PrintDlgA(LPPRINTDLGA lppd)
Definition: printdlg.c:2310
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
INT WINAPI GetProfileStringA(LPCSTR section, LPCSTR entry, LPCSTR def_val, LPSTR buffer, UINT len)
Definition: profile.c:1252
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3303
USHORT port
Definition: uri.c:210
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint end
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
unsigned int UINT
Definition: sysinfo.c:13
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define win_skip
Definition: minitest.h:67
int winetest_interactive
#define todo_wine
Definition: minitest.h:80
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define error(str)
Definition: mkdosfs.c:1605
static PVOID ptr
Definition: dispmode.c:27
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static IPrintDialogCallback callback
Definition: printdlg.c:325
static const IPrintDialogCallbackVtbl callback_Vtbl
Definition: printdlg.c:315
static BOOL CALLBACK abort_proc(HDC hdc, int error)
Definition: printdlg.c:558
static HRESULT WINAPI callback_InitDone(IPrintDialogCallback *iface)
Definition: printdlg.c:295
static HRESULT WINAPI callback_SelectionChange(IPrintDialogCallback *iface)
Definition: printdlg.c:301
static const CHAR PrinterPortsA[]
Definition: printdlg.c:53
static IUnknown unknown
Definition: printdlg.c:366
static HMODULE hcomdlg32
Definition: printdlg.c:47
static const IUnknownVtbl unknown_Vtbl
Definition: printdlg.c:359
static ULONG WINAPI unknown_AddRef(IUnknown *iface)
Definition: printdlg.c:347
static HRESULT WINAPI callback_HandleMessage(IPrintDialogCallback *iface, HWND hdlg, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res)
Definition: printdlg.c:307
static UINT_PTR CALLBACK print_hook_proc(HWND hdlg, UINT msg, WPARAM wp, LPARAM lp)
Definition: printdlg.c:116
static HRESULT WINAPI unknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: printdlg.c:327
static void test_PrintDlgExW(void)
Definition: printdlg.c:368
static ULONG WINAPI callback_AddRef(IPrintDialogCallback *iface)
Definition: printdlg.c:283
static void test_PageSetupDlgA(void)
Definition: printdlg.c:57
static BOOL abort_proc_called
Definition: printdlg.c:557
static ULONG WINAPI unknown_Release(IUnknown *iface)
Definition: printdlg.c:353
static const CHAR emptyA[]
Definition: printdlg.c:52
static ULONG WINAPI callback_Release(IPrintDialogCallback *iface)
Definition: printdlg.c:289
static HRESULT WINAPI callback_QueryInterface(IPrintDialogCallback *iface, REFIID riid, void **ppv)
Definition: printdlg.c:276
static void test_abort_proc(void)
Definition: printdlg.c:559
const IID IID_IObjectWithSite
static void test_PrintDlgA(void)
Definition: printdlg.c:128
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
char CHAR
Definition: pedump.c:57
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_INITDIALOG
Definition: winuser.h:1767
#define IDOK
Definition: winuser.h:841
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_BACKGROUND
Definition: winuser.h:924
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
Definition: dcommon.idl:28
int cbSize
Definition: wingdi.h:2122
LPCSTR lpszOutput
Definition: wingdi.h:2124
LPCSTR lpszDocName
Definition: wingdi.h:2123
short dmCopies
Definition: wingdi.h:2024
Definition: devices.h:37
WORD wDeviceOffset
Definition: commdlg.h:298
WORD wDriverOffset
Definition: commdlg.h:297
WORD wDefault
Definition: commdlg.h:300
WORD wOutputOffset
Definition: commdlg.h:299
HDC hDC
Definition: commdlg.h:469
DWORD Flags
Definition: commdlg.h:470
WORD nCopies
Definition: commdlg.h:475
LPPRINTHOOKPROC lpfnPrintHook
Definition: commdlg.h:478
WORD nFromPage
Definition: commdlg.h:471
HGLOBAL hDevMode
Definition: commdlg.h:467
WORD nToPage
Definition: commdlg.h:472
HGLOBAL hDevNames
Definition: commdlg.h:468
DWORD lStructSize
Definition: commdlg.h:465
HGLOBAL hDevMode
Definition: commdlg.h:435
DWORD Flags
Definition: commdlg.h:437
DWORD lStructSize
Definition: commdlg.h:433
HGLOBAL hDevNames
Definition: commdlg.h:436
const char * LPCSTR
Definition: typedefs.h:52
char * LPSTR
Definition: typedefs.h:51
uint32_t ULONG
Definition: typedefs.h:59
static WORD const char * driver
Definition: odbccp32.c:56
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DC_COPIES
Definition: windef.h:173
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_HANDLE
Definition: winerror.h:4117
#define ERROR_SPL_NO_STARTDOC
Definition: winerror.h:1573
DWORD WINAPI DeviceCapabilitiesA(_In_ LPCSTR pDevice, _In_opt_ LPCSTR pPort, _In_ WORD fwCapability, _Out_writes_opt_(_Inexpressible_(1)) LPSTR pOutput, _In_opt_ const DEVMODEA *pDevMode)
int WINAPI EndPage(_In_ HDC)
int WINAPI EndDoc(_In_ HDC)
int WINAPI StartDocA(_In_ HDC, _In_ const DOCINFOA *)
int WINAPI StartPage(_In_ HDC)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetAbortProc(_In_ HDC, _In_ ABORTPROC)
BOOL WINAPI DeleteDC(_In_ HDC)