[PATCH 3/3] comctl32: Implement the TaskDialog function
Joachim Priesner
joachim.priesner at web.de
Wed Oct 1 07:35:49 CDT 2014
This is part of an effort to replace the current TaskDialogIndirect stub (which uses MessageBoxW) with an own implementation.
Here the TaskDialog function is added, as well as a simple test to ensure the function is being exported.
Tested on openSuse 13.1 and Windows 8.1 x64.
---
dlls/comctl32/comctl32.spec | 1 +
dlls/comctl32/taskdialog.c | 20 ++++++++++++++++++++
dlls/comctl32/tests/misc.c | 19 +++++++++++++++++++
include/commctrl.h | 2 ++
4 files changed, 42 insertions(+)
diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
index 0dff369..5d59221 100644
--- a/dlls/comctl32/comctl32.spec
+++ b/dlls/comctl32/comctl32.spec
@@ -61,6 +61,7 @@
340 stdcall -ordinal DPA_CreateEx(long long)
341 stdcall -noname SendNotify(long long long ptr)
342 stdcall -noname SendNotifyEx(long long long ptr long)
+344 stdcall -ordinal TaskDialog(long long ptr ptr ptr long ptr ptr)
345 stdcall -ordinal TaskDialogIndirect(ptr ptr ptr ptr)
350 stdcall -noname -private StrChrA(str str)
351 stdcall -noname -private StrRChrA(str str long)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index a92a461..c25718f 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -447,6 +447,26 @@ static INT_PTR CALLBACK TASKDIALOG_DlgProc(HWND hwnd, UINT message,
}
/***********************************************************************
+ * TaskDialog [COMCTL32.@]
+ */
+HRESULT WINAPI TaskDialog(HWND hWndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle,
+ PCWSTR pszMainInstruction, PCWSTR pszContent,
+ TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon,
+ int *pnButton)
+{
+ TASKDIALOGCONFIG config = {0};
+ config.cbSize = sizeof(TASKDIALOGCONFIG);
+ config.hwndParent = hWndParent;
+ config.hInstance = hInstance;
+ config.pszWindowTitle = pszWindowTitle;
+ config.pszMainInstruction = pszMainInstruction;
+ config.pszContent = pszContent;
+ config.dwCommonButtons = dwCommonButtons;
+ config.pszMainIcon = pszIcon;
+ return TaskDialogIndirect(&config, pnButton, NULL, NULL);
+}
+
+/***********************************************************************
* TaskDialogIndirect [COMCTL32.@]
*/
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
index 69a7db4..b13c81a 100644
--- a/dlls/comctl32/tests/misc.c
+++ b/dlls/comctl32/tests/misc.c
@@ -187,6 +187,24 @@ static void test_Alloc(void)
ok(res == TRUE, "Expected TRUE, got %d\n", res);
}
+static void test_TaskDialog(void)
+{
+ HINSTANCE hinst;
+ void *ptr, *ptr2;
+
+ hinst = LoadLibraryA("comctl32.dll");
+
+ ptr = GetProcAddress(hinst, "TaskDialog");
+ if (!ptr)
+ {
+ win_skip("TaskDialog not exported by name\n");
+ return;
+ }
+
+ ptr2 = GetProcAddress(hinst, (const CHAR*)344);
+ ok(ptr == ptr2, "got wrong pointer for ordinal 344, %p expected %p\n", ptr2, ptr);
+}
+
static void test_TaskDialogIndirect(void)
{
HINSTANCE hinst;
@@ -219,6 +237,7 @@ START_TEST(misc)
if (!load_v6_module(&ctx_cookie, &hCtx))
return;
+ test_TaskDialog();
test_TaskDialogIndirect();
unload_v6_module(ctx_cookie, hCtx);
diff --git a/include/commctrl.h b/include/commctrl.h
index 73cc136..897fa1e 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -5167,6 +5167,8 @@ typedef struct _TASKDIALOGCONFIG
UINT cxWidth;
} TASKDIALOGCONFIG;
+HRESULT WINAPI TaskDialog(HWND, HINSTANCE, PCWSTR, PCWSTR, PCWSTR,
+ TASKDIALOG_COMMON_BUTTON_FLAGS, PCWSTR, int *);
HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *, int *, int *, BOOL *);
#include <poppack.h>
--
1.8.4.5
More information about the wine-patches
mailing list