[PATCH 1/3] comctl32: Move TaskDialogIndirect function to separate file

Joachim Priesner joachim.priesner at web.de
Wed Oct 1 07:35:01 CDT 2014


This is part of an effort to replace the current TaskDialogIndirect stub (which uses MessageBoxW) with an own implementation.

In this patch, some of the infrastructure (new file taskdialog.c, Makefile and header changes) is set up. The old stub implementation is kept.

Tested on openSuse 13.1.

---
 dlls/comctl32/Makefile.in  |  3 +-
 dlls/comctl32/commctrl.c   | 39 -------------------------
 dlls/comctl32/taskdialog.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++
 include/commctrl.h         |  5 ++++
 4 files changed, 79 insertions(+), 40 deletions(-)
 create mode 100644 dlls/comctl32/taskdialog.c

diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in
index e63f0ac..728b85c 100644
--- a/dlls/comctl32/Makefile.in
+++ b/dlls/comctl32/Makefile.in
@@ -1,7 +1,7 @@
 EXTRADEFS = -D_COMCTL32_
 MODULE    = comctl32.dll
 IMPORTLIB = comctl32
-IMPORTS   = uuid user32 gdi32 advapi32
+IMPORTS   = uuid user32 gdi32 advapi32 shlwapi
 DELAYIMPORTS = winmm uxtheme
 
 C_SRCS = \
@@ -30,6 +30,7 @@ C_SRCS = \
 	string.c \
 	syslink.c \
 	tab.c \
+	taskdialog.c \
 	theme_button.c \
 	theme_combo.c \
 	theme_dialog.c \
diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index 4f4e2b1..b73e6ac 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -1598,42 +1598,3 @@ int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *rect, DWORD
                                                                   crText, crShadow, ixOffset, iyOffset);
     return DrawTextW(hdc, pszText, cch, rect, DT_LEFT);
 }
-
-/***********************************************************************
- * TaskDialogIndirect [COMCTL32.@]
- */
-HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
-                                  int *pnRadioButton, BOOL *pfVerificationFlagChecked)
-{
-    UINT uType = 0;
-    INT  ret;
-    FIXME("%p, %p, %p, %p\n", pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
-
-    if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
-        pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON &&
-        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
-        uType |= MB_YESNOCANCEL;
-    else
-    if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
-        pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON)
-        uType |= MB_YESNO;
-    else
-    if (pTaskConfig->dwCommonButtons & TDCBF_RETRY_BUTTON &&
-        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
-        uType |= MB_RETRYCANCEL;
-    else
-    if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON &&
-        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
-        uType |= MB_OKCANCEL;
-    else
-    if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON)
-        uType |= MB_OK;
-    ret = MessageBoxW(pTaskConfig->hwndParent, pTaskConfig->pszMainInstruction,
-                      pTaskConfig->pszWindowTitle, uType);
-    FIXME("dwCommonButtons=%x uType=%x ret=%x\n", pTaskConfig->dwCommonButtons, uType, ret);
-
-    if (pnButton) *pnButton = ret;
-    if (pnRadioButton) *pnRadioButton = pTaskConfig->nDefaultButton;
-    if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE;
-    return S_OK;
-}
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
new file mode 100644
index 0000000..0036202
--- /dev/null
+++ b/dlls/comctl32/taskdialog.c
@@ -0,0 +1,72 @@
+/*
+ * Task Dialogs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <string.h>
+
+#include "comctl32.h"
+#include "shlwapi.h"
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winternl.h"
+#include "dlgs.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
+
+/***********************************************************************
+ * TaskDialogIndirect [COMCTL32.@]
+ */
+HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
+                                  int *pnRadioButton, BOOL *pfVerificationFlagChecked)
+{
+    UINT uType = 0;
+    INT  ret;
+    FIXME("%p, %p, %p, %p\n", pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
+
+    if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
+        pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON &&
+        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
+        uType |= MB_YESNOCANCEL;
+    else
+    if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON &&
+        pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON)
+        uType |= MB_YESNO;
+    else
+    if (pTaskConfig->dwCommonButtons & TDCBF_RETRY_BUTTON &&
+        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
+        uType |= MB_RETRYCANCEL;
+    else
+    if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON &&
+        pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON)
+        uType |= MB_OKCANCEL;
+    else
+    if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON)
+        uType |= MB_OK;
+    ret = MessageBoxW(pTaskConfig->hwndParent, pTaskConfig->pszMainInstruction,
+                      pTaskConfig->pszWindowTitle, uType);
+    FIXME("dwCommonButtons=%x uType=%x ret=%x\n", pTaskConfig->dwCommonButtons, uType, ret);
+
+    if (pnButton) *pnButton = ret;
+    if (pnRadioButton) *pnRadioButton = pTaskConfig->nDefaultButton;
+    if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE;
+    return S_OK;
+}
diff --git a/include/commctrl.h b/include/commctrl.h
index 9993ec7..73cc136 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -5086,6 +5086,11 @@ static const WCHAR WC_SCROLLBARW[] = { 'S','c','r','o','l','l','B','a','r',0 };
 
 #include <pshpack1.h>
 
+#define TD_WARNING_ICON         MAKEINTRESOURCEW(-1)
+#define TD_ERROR_ICON           MAKEINTRESOURCEW(-2)
+#define TD_INFORMATION_ICON     MAKEINTRESOURCEW(-3)
+#define TD_SHIELD_ICON          MAKEINTRESOURCEW(-4)
+
 enum _TASKDIALOG_FLAGS
 {
     TDF_ENABLE_HYPERLINKS           = 0x0001,
-- 
1.8.4.5




More information about the wine-patches mailing list