Module: wine Branch: master Commit: 6350cfd8c7aa70b7168adc569d0184231cfbf9eb URL: http://source.winehq.org/git/wine.git/?a=commit;h=6350cfd8c7aa70b7168adc569d...
Author: Hugh McMaster hugh.mcmaster@outlook.com Date: Wed Feb 1 12:56:15 2017 +0000
regedit: Remove unnecessary error handling from message box functions in edit.c.
Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/regedit/edit.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index e211ff8..a223535 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -48,15 +48,12 @@ struct edit_params
static INT vmessagebox(HWND hwnd, INT buttons, INT titleId, INT resId, va_list ap) { - static const WCHAR errorW[] = {'E','r','r','o','r',0}; - static const WCHAR unknownW[] = {'U','n','k','n','o','w','n',' ','e','r','r','o','r',' ','s','t','r','i','n','g','!',0}; - WCHAR title[256]; WCHAR errfmt[1024]; WCHAR errstr[1024];
- if (!LoadStringW(hInst, titleId, title, COUNT_OF(title))) lstrcpyW(title, errorW); - if (!LoadStringW(hInst, resId, errfmt, COUNT_OF(errfmt))) lstrcpyW(errfmt, unknownW); + LoadStringW(hInst, titleId, title, COUNT_OF(title)); + LoadStringW(hInst, resId, errfmt, COUNT_OF(errfmt));
vsnprintfW(errstr, COUNT_OF(errstr), errfmt, ap);
@@ -87,20 +84,14 @@ void error(HWND hwnd, INT resId, ...) static void error_code_messagebox(HWND hwnd, DWORD error_code) { LPWSTR lpMsgBuf; - DWORD status; WCHAR title[256]; - static WCHAR fallback[] = {'E','r','r','o','r',' ','d','i','s','p','l','a','y','i','n','g',' ','e','r','r','o','r',' ','m','e','s','s','a','g','e','.','\n',0}; - static const WCHAR title_error[] = {'E','r','r','o','r',0}; - - if (!LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title))) - lstrcpyW(title, title_error); - status = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error_code, 0, (LPWSTR)&lpMsgBuf, 0, NULL); - if (!status) - lpMsgBuf = fallback; + + LoadStringW(hInst, IDS_ERROR, title, COUNT_OF(title)); + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error_code, 0, (LPWSTR)&lpMsgBuf, 0, NULL); + MessageBoxW(hwnd, lpMsgBuf, title, MB_OK | MB_ICONERROR); - if (lpMsgBuf != fallback) - LocalFree(lpMsgBuf); + LocalFree(lpMsgBuf); }
static BOOL change_dword_base(HWND hwndDlg, BOOL toHex)