From: Joachim Priesner Subject: [1/5] comctl32: Move TaskDialogIndirect function and its test to separate files (try 3) Message-Id: <201502261656.00941.joachim.priesner@web.de> Date: Thu, 26 Feb 2015 16:55:58 +0100 This is in preparation of a new implementation of TaskDialogIndirect. No new code is added in this commit. --- dlls/comctl32/Makefile.in | 1 + dlls/comctl32/commctrl.c | 39 ------------------------- dlls/comctl32/taskdialog.c | 62 ++++++++++++++++++++++++++++++++++++++++ dlls/comctl32/tests/Makefile.in | 1 + dlls/comctl32/tests/misc.c | 29 ------------------- dlls/comctl32/tests/taskdialog.c | 55 +++++++++++++++++++++++++++++++++++ 6 files changed, 119 insertions(+), 68 deletions(-) create mode 100644 dlls/comctl32/taskdialog.c create mode 100644 dlls/comctl32/tests/taskdialog.c diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in index 27f9741..e1a6812 100644 --- a/dlls/comctl32/Makefile.in +++ b/dlls/comctl32/Makefile.in @@ -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 e18c27d..3d036e0 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -1600,45 +1600,6 @@ int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *rect, DWORD } /*********************************************************************** - * 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; -} - -/*********************************************************************** * LoadIconWithScaleDown [COMCTL32.@] */ HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int cy, HICON *icon) diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c new file mode 100644 index 0000000..760a984 --- /dev/null +++ b/dlls/comctl32/taskdialog.c @@ -0,0 +1,62 @@ +/* + * 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 "comctl32.h" +#include "winuser.h" +#include "wine/debug.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/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in index 1a4ce23..7752612 100644 --- a/dlls/comctl32/tests/Makefile.in +++ b/dlls/comctl32/tests/Makefile.in @@ -21,6 +21,7 @@ C_SRCS = \ subclass.c \ syslink.c \ tab.c \ + taskdialog.c \ toolbar.c \ tooltips.c \ trackbar.c \ diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 280b46c..17657c2 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -22,7 +22,6 @@ #include #include "wine/test.h" -#include "v6util.h" static PVOID (WINAPI * pAlloc)(LONG); static PVOID (WINAPI * pReAlloc)(PVOID, LONG); @@ -187,39 +186,11 @@ static void test_Alloc(void) ok(res == TRUE, "Expected TRUE, got %d\n", res); } -static void test_TaskDialogIndirect(void) -{ - HINSTANCE hinst; - void *ptr, *ptr2; - - hinst = LoadLibraryA("comctl32.dll"); - - ptr = GetProcAddress(hinst, "TaskDialogIndirect"); - if (!ptr) - { - win_skip("TaskDialogIndirect not exported by name\n"); - return; - } - - ptr2 = GetProcAddress(hinst, (const CHAR*)345); - ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); -} - START_TEST(misc) { - ULONG_PTR ctx_cookie; - HANDLE hCtx; - if(!InitFunctionPtrs()) return; test_GetPtrAW(); test_Alloc(); - - if (!load_v6_module(&ctx_cookie, &hCtx)) - return; - - test_TaskDialogIndirect(); - - unload_v6_module(ctx_cookie, hCtx); } diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c new file mode 100644 index 0000000..81260a3 --- /dev/null +++ b/dlls/comctl32/tests/taskdialog.c @@ -0,0 +1,55 @@ +/* + * Task dialog tests + * + * 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 +#include +#include + +#include "wine/test.h" +#include "v6util.h" + +static void test_TaskDialogIndirect(void) +{ + HINSTANCE hinst; + void *ptr, *ptr2; + + hinst = LoadLibraryA("comctl32.dll"); + + ptr = GetProcAddress(hinst, "TaskDialogIndirect"); + if (!ptr) + { + win_skip("TaskDialogIndirect not exported by name\n"); + return; + } + + ptr2 = GetProcAddress(hinst, (const CHAR*)345); + ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); +} + +START_TEST(taskdialog) +{ + ULONG_PTR ctx_cookie; + HANDLE hCtx; + + if (!load_v6_module(&ctx_cookie, &hCtx)) + return; + + test_TaskDialogIndirect(); + + unload_v6_module(ctx_cookie, hCtx); +} -- 1.8.4.5