From 18fbbd621fd3c80c515e77ef80716705e0247a0a Mon Sep 17 00:00:00 2001 From: rainwater Date: Wed, 4 Sep 2002 01:59:38 +0000 Subject: [PATCH] Fix crash git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@899 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Makensisw/utils.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index 84f3e402..bc5d7468 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -57,7 +57,7 @@ extern BOOL g_warnings; void LogMessage(HWND hwnd,const char *str) { SendDlgItemMessage(hwnd, IDC_LOGWIN, EM_REPLACESEL, 0, (WPARAM)str); - SendDlgItemMessage(hwnd, IDC_LOGWIN, WM_VSCROLL, SB_BOTTOM, 0); + SendDlgItemMessage(hwnd, IDC_LOGWIN, WM_VSCROLL, SB_BOTTOM, 0); } void ErrorMessage(HWND hwnd,const char *str) { @@ -85,7 +85,10 @@ void DisableItems(HWND hwnd) { void EnableItems(HWND hwnd) { int len=SendDlgItemMessage(hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0); if (len>0) { - char *existing_text=(char*)GlobalAlloc(GPTR,len+1); + HGLOBAL memory; + char *existing_text; + memory = GlobalAlloc(GMEM_MOVEABLE,len+1); + existing_text = (char *)GlobalLock(memory); if (!existing_text) return; existing_text[0]=0; GetDlgItemText(hwnd, IDC_LOGWIN, existing_text, len); @@ -109,6 +112,7 @@ void EnableItems(HWND hwnd) { if (my_strstr(existing_text, " warning:") || my_strstr(existing_text, " warnings:")) { g_warnings = TRUE; } + GlobalUnlock(memory); } HMENU m = GetMenu(hwnd); if (g_output_exe[0]) {