static void MessageBoxIndirectFree(MSGBOXPARAMSA *mbp) { MessageBoxIndirectA(mbp); mir_free((char*)mbp->lpszCaption); /* does NULL check */ mir_free((char*)mbp->lpszText); /* does NULL check */ mir_free(mbp); }
int BBMessageBox(int flg, const char *fmt, ...) { const char *caption = BBAPPNAME; const char *message; char *p, *q; int r; va_list args; static int (WINAPI *pMessageBoxIndirectW)(CONST MSGBOXPARAMSW*); va_start(args, fmt); message = p = m_formatv(fmt, args); if ('#' == p[0] && NULL != (q = strchr(p+1, p[0]))) // "#Title#Message" is wanted *q = 0, caption = p+1, message = q+1; #ifdef BBTINY r = MessageBox (NULL, message, caption, flg | MB_SYSTEMMODAL); #else MessageBeep(0); if (usingNT && load_imp(&pMessageBoxIndirectW, "user32.dll", "MessageBoxIndirectW")) { MSGBOXPARAMSW mp; int lc = 1+strlen(caption); int lm = 1+strlen(message); WCHAR *wcaption = (WCHAR*)m_alloc(lc * sizeof (WCHAR)); WCHAR *wmessage = (WCHAR*)m_alloc(lm * sizeof (WCHAR)); bbMB2WC(caption, wcaption, lc); bbMB2WC(message, wmessage, lm); memset(&mp, 0, sizeof mp); mp.cbSize = sizeof mp; mp.hInstance = hMainInstance; //mp.hwndOwner = NULL; mp.lpszText = wmessage; mp.lpszCaption = wcaption; mp.dwStyle = flg | MB_USERICON | MB_SYSTEMMODAL; mp.lpszIcon = MAKEINTRESOURCEW(IDI_BLACKBOX); r = pMessageBoxIndirectW(&mp); m_free(wcaption); m_free(wmessage); } else { MSGBOXPARAMSA mp; memset(&mp, 0, sizeof mp); mp.cbSize = sizeof mp; mp.hInstance = hMainInstance; //mp.hwndOwner = NULL; mp.lpszText = message; mp.lpszCaption = caption; mp.dwStyle = flg | MB_USERICON | MB_SYSTEMMODAL; mp.lpszIcon = MAKEINTRESOURCE(IDI_BLACKBOX); r = MessageBoxIndirectA(&mp); } #endif m_free(p); return r; }
static void on_add_click(HWND dialog) { static const char dotDll[] = ".dll"; char buffer[1024], *ptr; ZeroMemory(buffer, sizeof(buffer)); SendDlgItemMessageA(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); if (lstrlenA(buffer) >= sizeof(dotDll)) { ptr = buffer + lstrlenA(buffer) - sizeof(dotDll) + 1; if (!lstrcmpiA(ptr, dotDll)) { WINE_TRACE("Stripping dll extension\n"); *ptr = '\0'; } } /* check if dll is in the builtin-only list */ if (!(ptr = strrchr( buffer, '\\' ))) { ptr = buffer; if (*ptr == '*') ptr++; } else ptr++; if (is_builtin_only( ptr )) { MSGBOXPARAMSA params; params.cbSize = sizeof(params); params.hwndOwner = dialog; params.hInstance = GetModuleHandleA( NULL ); params.lpszText = MAKEINTRESOURCEA( IDS_DLL_WARNING ); params.lpszCaption = MAKEINTRESOURCEA( IDS_DLL_WARNING_CAPTION ); params.dwStyle = MB_ICONWARNING | MB_YESNO; params.lpszIcon = NULL; params.dwContextHelpId = 0; params.lpfnMsgBoxCallback = NULL; params.dwLanguageId = 0; if (MessageBoxIndirectA( ¶ms ) != IDYES) return; } SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM)emptyW); disable(IDC_DLLS_ADDDLL); SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0); WINE_TRACE("Adding %s as native, builtin\n", buffer); SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0); set_reg_key(config_key, keypath("DllOverrides"), buffer, "native,builtin"); load_library_settings(dialog); SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer); set_controls_from_selection(dialog); }
/* MAKE_EXPORT MessageBoxIndirectW_new=MessageBoxIndirectW */ int WINAPI MessageBoxIndirectW_new(const LPMSGBOXPARAMSW lpMsgBoxParams) { LPSTR lpszText = NULL; LPSTR lpszCaption = NULL; LPSTR lpszIcon = NULL; MSGBOXPARAMSA mbp; if(IsBadReadPtr(lpMsgBoxParams, sizeof(MSGBOXPARAMSW))) return 0; memcpy(&mbp, lpMsgBoxParams, sizeof(MSGBOXPARAMSA)); STACK_WtoA(lpMsgBoxParams->lpszText, lpszText); STACK_WtoA(lpMsgBoxParams->lpszCaption, lpszCaption); STACK_WtoA(lpMsgBoxParams->lpszIcon, lpszIcon); mbp.lpszText = lpszText; mbp.lpszCaption = lpszCaption; mbp.lpszIcon = lpszIcon; return MessageBoxIndirectA(&mbp); }