1 /* Unit tests for the task dialog control.
2  *
3  * Copyright 2017 Fabian Maurer for the Wine project
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #include "precomp.h"
21 
22 static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, int *, BOOL *);
23 static HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, const WCHAR *, const WCHAR *, const WCHAR *,
24         TASKDIALOG_COMMON_BUTTON_FLAGS, const WCHAR *, int *);
25 
26 START_TEST(taskdialog)
27 {
28     ULONG_PTR ctx_cookie;
29     void *ptr_ordinal;
30     HINSTANCE hinst;
31     HANDLE hCtx;
32 
33     if (!load_v6_module(&ctx_cookie, &hCtx))
34         return;
35 
36     /* Check if task dialogs are available */
37     hinst = LoadLibraryA("comctl32.dll");
38 
39     pTaskDialogIndirect = (void *)GetProcAddress(hinst, "TaskDialogIndirect");
40     if (!pTaskDialogIndirect)
41     {
42         win_skip("TaskDialogIndirect not exported by name\n");
43         unload_v6_module(ctx_cookie, hCtx);
44         return;
45     }
46 
47     pTaskDialog = (void *)GetProcAddress(hinst, "TaskDialog");
48 
49     ptr_ordinal = GetProcAddress(hinst, (const char *)344);
50     ok(pTaskDialog == ptr_ordinal, "got wrong pointer for ordinal 344, %p expected %p\n",
51                                             ptr_ordinal, pTaskDialog);
52 
53     ptr_ordinal = GetProcAddress(hinst, (const char *)345);
54     ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n",
55                                             ptr_ordinal, pTaskDialogIndirect);
56 
57     unload_v6_module(ctx_cookie, hCtx);
58 }
59