c9371278977897cd1c0f3c5ddfbf7545504e6643
[reactos.git] / rostests / winetests / comctl32 / taskdialog.c
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 <stdarg.h>
21
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winuser.h"
25 #include "commctrl.h"
26
27 #include "wine/test.h"
28 #include "v6util.h"
29
30 static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, int *, BOOL *);
31 static HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, const WCHAR *, const WCHAR *, const WCHAR *,
32 TASKDIALOG_COMMON_BUTTON_FLAGS, const WCHAR *, int *);
33
34 START_TEST(taskdialog)
35 {
36 ULONG_PTR ctx_cookie;
37 void *ptr_ordinal;
38 HINSTANCE hinst;
39 HANDLE hCtx;
40
41 if (!load_v6_module(&ctx_cookie, &hCtx))
42 return;
43
44 /* Check if task dialogs are available */
45 hinst = LoadLibraryA("comctl32.dll");
46
47 pTaskDialogIndirect = (void *)GetProcAddress(hinst, "TaskDialogIndirect");
48 if (!pTaskDialogIndirect)
49 {
50 win_skip("TaskDialogIndirect not exported by name\n");
51 unload_v6_module(ctx_cookie, hCtx);
52 return;
53 }
54
55 pTaskDialog = (void *)GetProcAddress(hinst, "TaskDialog");
56
57 ptr_ordinal = GetProcAddress(hinst, (const char *)344);
58 ok(pTaskDialog == ptr_ordinal, "got wrong pointer for ordinal 344, %p expected %p\n",
59 ptr_ordinal, pTaskDialog);
60
61 ptr_ordinal = GetProcAddress(hinst, (const char *)345);
62 ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n",
63 ptr_ordinal, pTaskDialogIndirect);
64
65 unload_v6_module(ctx_cookie, hCtx);
66 }