[5/5] comctl32: Implement the TaskDialog function (try 2)

Joachim Priesner joachim.priesner at web.de
Mon Feb 23 06:43:19 CST 2015


Try 2 that fixes issues found by Nikolay Sivov.
---
 dlls/comctl32/comctl32.spec      |  1 +
 dlls/comctl32/taskdialog.c       | 20 ++++++++++++++++++++
 dlls/comctl32/tests/taskdialog.c | 13 +++++++++----
 include/commctrl.h               |  2 ++
 4 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
index 0bd8b13..e6fda68 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 a9053a3..42caff7 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -426,6 +426,26 @@ static INT_PTR CALLBACK TASKDIALOG_DlgProc(HWND hwnd, UINT message,
 }
 
 /***********************************************************************
+ * TaskDialog [COMCTL32.@]
+ */
+HRESULT WINAPI TaskDialog(HWND parent, HINSTANCE instance, PCWSTR windowTitle,
+                          PCWSTR mainInstruction, PCWSTR content,
+                          TASKDIALOG_COMMON_BUTTON_FLAGS commonButtons, PCWSTR icon,
+                          int *button)
+{
+    TASKDIALOGCONFIG config = {0};
+    config.cbSize = sizeof(TASKDIALOGCONFIG);
+    config.hwndParent = parent;
+    config.hInstance = instance;
+    config.pszWindowTitle = windowTitle;
+    config.pszMainInstruction = mainInstruction;
+    config.pszContent = content;
+    config.dwCommonButtons = commonButtons;
+    config.pszMainIcon = icon;
+    return TaskDialogIndirect(&config, button, NULL, NULL);
+}
+
+/***********************************************************************
  * TaskDialogIndirect [COMCTL32.@]
  */
 HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c
index eb44b50..48a8ee2 100644
--- a/dlls/comctl32/tests/taskdialog.c
+++ b/dlls/comctl32/tests/taskdialog.c
@@ -25,14 +25,18 @@
 
 HMODULE hComctl32;
 HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG*, int*, int*, BOOL*);
+HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, PCWSTR, PCWSTR, PCWSTR, TASKDIALOG_COMMON_BUTTON_FLAGS, PCWSTR, int);
 
-static void test_TaskDialogIndirect(void)
+static void test_TaskDialog(void)
 {
     HRESULT result;
     TASKDIALOGCONFIG config;
     int nButton;
     void *ptr;
 
+    ptr = GetProcAddress(hComctl32, (const CHAR*)344);
+    ok(ptr == pTaskDialog, "got wrong pointer for ordinal 344, %p expected %p\n", ptr, pTaskDialog);
+
     ptr = GetProcAddress(hComctl32, (const CHAR*)345);
     ok(ptr == pTaskDialogIndirect, "got wrong pointer for ordinal 345, %p expected %p\n", ptr, pTaskDialogIndirect);
 
@@ -82,13 +86,14 @@ START_TEST(taskdialog)
     }
 
     pTaskDialogIndirect = (void*)GetProcAddress(hComctl32, "TaskDialogIndirect");
-    if (!pTaskDialogIndirect)
+    pTaskDialog = (void*)GetProcAddress(hComctl32, "TaskDialog");
+    if (!pTaskDialogIndirect || !pTaskDialog)
     {
-        win_skip("TaskDialogIndirect() is missing. Skipping the tests\n");
+        win_skip("TaskDialogIndirect() or TaskDialog() is missing. Skipping the tests\n");
         return;
     }
 
-    test_TaskDialogIndirect();
+    test_TaskDialog();
 
     unload_v6_module(ctx_cookie, hCtx);
 }
diff --git a/include/commctrl.h b/include/commctrl.h
index af60ad3..8eadf0d 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -5168,6 +5168,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