From f5a9b401dff0815f3e54f1384806be939d47fb73 Mon Sep 17 00:00:00 2001 From: anders_k Date: Mon, 5 Jun 2017 01:01:28 +0000 Subject: [PATCH] Don't use ShellExecute, only ShellExecuteEx git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6867 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Ui.c | 11 ++++++++++- Source/exehead/exec.c | 4 +--- Source/exehead/util.c | 7 +++++++ Source/exehead/util.h | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index cb36e19e..1fa13c4d 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -103,6 +103,15 @@ static void NSISCALL SetActiveCtl(HWND hCtl) SendMessage(g_hwnd, WM_NEXTDLGCTL, (WPARAM) hCtl, TRUE); } +static BOOL NSISCALL LaunchURL(HWND hOwner, LPCTSTR URL, int ShowMode) +{ + SHELLEXECUTEINFO sei; + sei.fMask = SEE_MASK_FLAG_NO_UI|SEE_MASK_FLAG_DDEWAIT; + sei.hwnd = hOwner, sei.nShow = SW_SHOWNORMAL; + sei.lpVerb = _T("open"), sei.lpFile = URL, sei.lpParameters=NULL, sei.lpDirectory = NULL; + return myShellExecuteEx(&sei); +} + static void NSISCALL NotifyCurWnd(UINT uNotifyCode) { if (m_curwnd) @@ -813,7 +822,7 @@ static INT_PTR CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (tr.chrg.cpMax-tr.chrg.cpMin < COUNTOF(ps_tmpbuf)) { SendMessage(hwLicense,EM_GETTEXTRANGE,0,(LPARAM)&tr); SetCursor(LoadCursor(0, IDC_WAIT)); - ShellExecute(hwndDlg,_T("open"),tr.lpstrText,NULL,NULL,SW_SHOWNORMAL); + LaunchURL(hwndDlg,tr.lpstrText,SW_SHOWNORMAL); SetCursor(LoadCursor(0, IDC_ARROW)); } } diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 40664633..210cd6cb 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -874,12 +874,10 @@ static int NSISCALL ExecuteEntry(entry *entry_) TCHAR *buf2=GetStringFromParm(0x22); // Parameters GetStringFromParm(0x15); // For update_status_text_buf1 update_status_text_buf1(LANG_EXECSHELL); - sei.cbSize=sizeof(SHELLEXECUTEINFO); sei.fMask=parm4; sei.hwnd=g_hwnd, sei.nShow=parm3; sei.lpVerb=buf0[0]?buf0:NULL, sei.lpFile=buf3, sei.lpParameters=buf2[0]?buf2:NULL, sei.lpDirectory=state_output_directory; - sei.lpIDList=NULL; // Must set this because SEE_MASK_INVOKEIDLIST might be set - if (!ShellExecuteEx(&sei)) + if (!myShellExecuteEx(&sei)) { log_printf5(_T("ExecShell: warning: error (\"%s\": file:\"%s\" params:\"%s\")=%d"),buf0,buf3,buf2,GetLastError()); exec_error++; diff --git a/Source/exehead/util.c b/Source/exehead/util.c index ac4fa449..c4db02d4 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -99,6 +99,13 @@ HANDLE NSISCALL myCreateProcess(TCHAR *cmd) return ProcInfo.hProcess; } +BOOL NSISCALL myShellExecuteEx(SHELLEXECUTEINFO*pSEI) +{ + pSEI->cbSize = sizeof(SHELLEXECUTEINFO); + pSEI->lpIDList = NULL; // Must set this because SEE_MASK_INVOKEIDLIST might be set by ExecShell[Wait] + return ShellExecuteEx(pSEI); +} + /*BOOL NSISCALL my_SetWindowText(HWND hWnd, const TCHAR *val) { return SendMessage(hWnd,WM_SETTEXT,0,(LPARAM)val); diff --git a/Source/exehead/util.h b/Source/exehead/util.h index 286f3163..087eee52 100644 --- a/Source/exehead/util.h +++ b/Source/exehead/util.h @@ -109,6 +109,7 @@ DWORD NSISCALL CreateRestrictedDirectory(LPCTSTR path); DWORD NSISCALL CreateNormalDirectory(LPCTSTR path); HANDLE NSISCALL myCreateProcess(TCHAR *cmd); +BOOL NSISCALL myShellExecuteEx(SHELLEXECUTEINFO*pSEI); int NSISCALL my_MessageBox(const TCHAR *text, UINT type); void NSISCALL myDelete(TCHAR *buf, int flags);