Mercurial > trustbridge
diff packaging/desktopshellrun.cpp @ 1134:f1384bf9d4a4
Mergerd
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 17 Sep 2014 15:01:19 +0200 |
parents | 4a17c9f977d0 |
children | ffdc8cba139a |
line wrap: on
line diff
--- a/packaging/desktopshellrun.cpp Wed Sep 17 13:13:33 2014 +0200 +++ b/packaging/desktopshellrun.cpp Wed Sep 17 15:01:19 2014 +0200 @@ -75,11 +75,12 @@ * * @param[in] disp The shell dispatcher to use for shell execute. * @param[in] fName The file that should be exectued. + * @param[in] param Optinal parameters to add. * * @returns true on success. */ static bool -shellexecute(IShellDispatch2 *disp, wchar_t *fName) +shellexecute(IShellDispatch2 *disp, wchar_t *fName, wchar_t *param) { BSTR bName = NULL, bParam = NULL, @@ -95,7 +96,7 @@ } bName = SysAllocString(fName); - bParam = SysAllocString(L""); + bParam = SysAllocString(param ? param : L""); bDir = SysAllocString(L""); bOp = SysAllocString(L""); @@ -163,7 +164,8 @@ UNUSED(hwndParent); UNUSED(string_size); HRESULT hr; - wchar_t *wbuf = NULL; + wchar_t *wbuf = NULL, + *params = NULL; IShellWindows *shellWindows = NULL; IShellBrowser *shellBrowser = NULL; IShellView *shellView = NULL; @@ -278,11 +280,17 @@ goto done; } - if (!shellexecute(shellDispatch, wbuf)) + if ((*stacktop)->next && (*stacktop)->next->text) + { + params = utf8_to_wchar((*stacktop)->next->text, strlen((*stacktop)->next->text)); + } + + if (!shellexecute(shellDispatch, wbuf, params)) { ERRORPRINTF ("Failed to execute."); } xfree (wbuf); + xfree (params); done: if (folderView) {