Index: boot/bootdata/hivedef_i386.inf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: dll/win32/user32/windows/messagebox.c =================================================================== --- dll/win32/user32/windows/messagebox.c (revision 50896) +++ dll/win32/user32/windows/messagebox.c (working copy) @@ -34,7 +34,12 @@ #include #include +#include +#include +static LPCTSTR s_szRegistryKey = _T("Software\\Microsoft\\User32"); +BOOL UseEditControl; + WINE_DEFAULT_DEBUG_CHANNEL(user32); /* DEFINES *******************************************************************/ @@ -180,6 +185,51 @@ return 0; } +static BOOL QueryGeneric(HKEY hKey, LPCTSTR pszValueNameT, DWORD dwExpectedType, + LPVOID pvResult, DWORD dwResultSize) +{ + DWORD dwType, cbData; + LPVOID *pTemp = _alloca(dwResultSize); + + ZeroMemory(pTemp, dwResultSize); + + cbData = dwResultSize; + if (RegQueryValueEx(hKey, pszValueNameT, NULL, &dwType, (LPBYTE) pTemp, &cbData) != ERROR_SUCCESS) + return FALSE; + + if (dwType != dwExpectedType) + return FALSE; + + memcpy(pvResult, pTemp, cbData); + return TRUE; +} + +static BOOL QueryDword(HKEY hKey, LPCTSTR pszValueName, DWORD *pdwResult) +{ + return QueryGeneric(hKey, pszValueName, REG_DWORD, pdwResult, sizeof(*pdwResult)); +} + +static BOOL QueryBool(HKEY hKey, LPCTSTR pszValueName, BOOL *pbResult) +{ + DWORD dwResult; + if (!QueryDword(hKey, pszValueName, &dwResult)) + return FALSE; + *pbResult = dwResult ? TRUE : FALSE; + return TRUE; +} + +void LoadSettings(void) +{ + HKEY hKey = NULL; + + if (RegOpenKey(HKEY_CURRENT_USER, s_szRegistryKey, &hKey) == ERROR_SUCCESS) + { + QueryBool(hKey, _T("blUseEditControl"), &UseEditControl); + + RegCloseKey(hKey); + } +} + static int MessageBoxTimeoutIndirectW( CONST MSGBOXPARAMSW *lpMsgBoxParams, UINT Timeout) @@ -421,11 +471,23 @@ *(WORD*)dest = 0; dest += sizeof(WORD); } + + LoadSettings(); - /* create static for text */ + /* TODO: delete ALL new line characters at the end of the text if ANY. + Create static/edit control for text */ dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3); itxt = (DLGITEMTEMPLATE *)dest; - itxt->style = WS_CHILD | WS_VISIBLE | SS_NOPREFIX; + + if (UseEditControl == TRUE) + { + itxt->style = WS_VISIBLE | ES_READONLY | ES_MULTILINE; + } + else + { + itxt->style = WS_VISIBLE | WS_CHILD | SS_NOPREFIX; + } + if(lpMsgBoxParams->dwStyle & MB_RIGHT) itxt->style |= SS_RIGHT; else @@ -435,14 +497,25 @@ dest += sizeof(DLGITEMTEMPLATE); *(WORD*)dest = 0xFFFF; dest += sizeof(WORD); - *(WORD*)dest = 0x0082; /* static control */ + + if (UseEditControl == TRUE) + { + *(WORD*)dest = 0x0081; /* static control = 0x0082, edit control = 0x0081 */ + } + else + { + *(WORD*)dest = 0x0082; + } + dest += sizeof(WORD); memcpy(dest, text, textlen * sizeof(WCHAR)); dest += textlen * sizeof(WCHAR); *(WCHAR*)dest = 0; dest += sizeof(WCHAR); + *(WCHAR*)dest = '\0'; /* Need to terminate it for static */ *(WORD*)dest = 0; - dest += sizeof(WORD); + dest += sizeof(WORD); + *(WORD*)dest = '\0'; /* Need to terminate it for static */ /* create buttons */ btnsize.cx = BTN_CX; @@ -579,14 +652,24 @@ btnleft = max(btnleft - MSGBOXEX_BUTTONSPACING, rc.left + txtrect.right); btnleft += MSGBOXEX_MARGIN; btntop += btnsize.cy + MSGBOXEX_MARGIN; - /* set size and position of the message static */ + /* set size and position of the message static/edit */ itxt->x = (rc.left * 4) / LOWORD(units); itxt->y = (rc.top * 8) / HIWORD(units); - itxt->cx = (((btnleft - rc.left - MSGBOXEX_MARGIN) * 4) / LOWORD(units)); - itxt->cy = ((txtrect.bottom * 8) / HIWORD(units)); - /* set size of the window */ - tpl->cx = (btnleft * 4) / LOWORD(units); + + if (UseEditControl == TRUE) + { + itxt->cx = ((((btnleft - rc.left - MSGBOXEX_MARGIN) * 4)+50) / LOWORD(units)); /* +50 for edit control */ + /* set size of the window */ + tpl->cx = ((btnleft * 4)+60) / LOWORD(units); /* +60 for edit control */ + } + else + { + itxt->cx = (((btnleft - rc.left - MSGBOXEX_MARGIN) * 4) / LOWORD(units)); + tpl->cx = (btnleft * 4) / LOWORD(units); + } + itxt->cy = ((txtrect.bottom * 8) / HIWORD(units)); tpl->cy = (btntop * 8) / HIWORD(units); + /* finally show the messagebox */ mbi.Icon = Icon;