From c035f4648ba3aa610fb9ab77645103931e7e02dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 17 Aug 2018 21:46:50 +0200 Subject: [PATCH] [ROSTESTS] Add a test for the MB_SERVICE_NOTIFICATION flag of the MessageBox*() APIs. --- .../win32/user32/messagebox/messagebox.c | 39 +++++++++++++++---- .../win32/user32/messagebox/resource.h | 4 +- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/modules/rostests/win32/user32/messagebox/messagebox.c b/modules/rostests/win32/user32/messagebox/messagebox.c index 40913e61426..ce4fcebd165 100644 --- a/modules/rostests/win32/user32/messagebox/messagebox.c +++ b/modules/rostests/win32/user32/messagebox/messagebox.c @@ -1,7 +1,8 @@ /* * PROJECT: ReactOS Tests * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) - * PURPOSE: Tests the undocumented user32.dll API SoftModalMessageBox(). + * PURPOSE: Tests the undocumented user32.dll API SoftModalMessageBox() + * and the MB_SERVICE_NOTIFICATION flag of the MessageBox*() APIs. * COPYRIGHT: Copyright 2018 Hermes Belusca-Maito */ @@ -63,16 +64,16 @@ C_ASSERT(sizeof(MSGBOXDATA) == 0x4C); #endif -typedef int (WINAPI *SOFTMODALMESSAGEBOX)(LPMSGBOXDATA lpMsgBoxData); -// int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData); -SOFTMODALMESSAGEBOX SoftModalMessageBox = NULL; - // // Example taken from http://rsdn.org/forum/winapi/3273168.1 // See also http://www.vbforums.com/showthread.php?840593-Message-Box-with-Four-Buttons // -int wmain(int argc, WCHAR* argv[]) +void TestSoftModalMsgBox(void) { + typedef int (WINAPI *SOFTMODALMESSAGEBOX)(LPMSGBOXDATA lpMsgBoxData); + // int WINAPI SoftModalMessageBox(IN LPMSGBOXDATA lpMsgBoxData); + SOFTMODALMESSAGEBOX SoftModalMessageBox = NULL; + MSGBOXDATA data; int res = 0; @@ -113,8 +114,32 @@ int wmain(int argc, WCHAR* argv[]) else { res = SoftModalMessageBox(&data); - printf("Returned value = %i\n\n", res); + printf("Returned value = %i\n", res); } +} + +void TestMsgBoxServiceNotification(void) +{ + int res; + + res = MessageBoxW(NULL, L"Hello World!", L"MB_SERVICE_NOTIFICATION", + MB_YESNOCANCEL | MB_DEFBUTTON3 | MB_ICONINFORMATION | /* MB_DEFAULT_DESKTOP_ONLY | */ MB_SERVICE_NOTIFICATION); + printf("Returned value = %i\n", res); +} + +int wmain(int argc, WCHAR* argv[]) +{ + printf("Testing SoftModalMessageBox()...\n"); + TestSoftModalMsgBox(); + printf("\n"); + + printf("Press any key to continue...\n"); + _getch(); + printf("\n"); + + printf("Testing MB_SERVICE_NOTIFICATION...\n"); + TestMsgBoxServiceNotification(); + printf("\n"); printf("Press any key to quit...\n"); _getch(); diff --git a/modules/rostests/win32/user32/messagebox/resource.h b/modules/rostests/win32/user32/messagebox/resource.h index 6e6ee36e092..f914328d68c 100644 --- a/modules/rostests/win32/user32/messagebox/resource.h +++ b/modules/rostests/win32/user32/messagebox/resource.h @@ -1,2 +1,2 @@ -#define IDS_RES_CAPTION 101 -#define IDS_RES_MESSAGE 102 +#define IDS_RES_CAPTION 101 +#define IDS_RES_MESSAGE 102