Thomas Weidenmueller : shell32:
Set current directory when executing files in a shell view.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jul 9 10:24:54 CDT 2007
Module: wine
Branch: master
Commit: 042bdefe5e07ef4f174fa23f43c6d338afc68b52
URL: http://source.winehq.org/git/wine.git/?a=commit;h=042bdefe5e07ef4f174fa23f43c6d338afc68b52
Author: Thomas Weidenmueller <wine-patches at reactsoft.com>
Date: Sat Jul 7 21:06:44 2007 +0200
shell32: Set current directory when executing files in a shell view.
---
dlls/shell32/shlview.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 0efd18d..6dd27da 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -854,6 +854,9 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
STGMEDIUM stgm;
LPIDA pIDList;
LPCITEMIDLIST parent_pidl;
+ WCHAR parent_path[MAX_PATH];
+ LPCWSTR parent_dir = NULL;
+ SFGAOF attribs;
int i;
if (0 == ShellView_GetSelections(This))
@@ -887,10 +890,16 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
pIDList = GlobalLock(stgm.u.hGlobal);
parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pIDList+pIDList->aoffset[0]);
+ hr = IShellFolder_GetAttributesOf(This->pSFParent, 1, &parent_pidl, &attribs);
+ if (SUCCEEDED(hr) && (attribs & SFGAO_FILESYSTEM) &&
+ SHGetPathFromIDListW(parent_pidl, parent_path))
+ {
+ parent_dir = parent_path;
+ }
+
for (i = pIDList->cidl; i > 0; --i)
{
LPCITEMIDLIST pidl;
- SFGAOF attribs;
pidl = (LPCITEMIDLIST)((LPBYTE)pIDList+pIDList->aoffset[i]);
@@ -899,19 +908,19 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
if (SUCCEEDED(hr) && ! (attribs & SFGAO_FOLDER))
{
- SHELLEXECUTEINFOA shexinfo;
+ SHELLEXECUTEINFOW shexinfo;
- shexinfo.cbSize = sizeof(SHELLEXECUTEINFOA);
+ shexinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
shexinfo.fMask = SEE_MASK_INVOKEIDLIST; /* SEE_MASK_IDLIST is also possible. */
shexinfo.hwnd = NULL;
shexinfo.lpVerb = NULL;
shexinfo.lpFile = NULL;
shexinfo.lpParameters = NULL;
- shexinfo.lpDirectory = NULL;
+ shexinfo.lpDirectory = parent_dir;
shexinfo.nShow = SW_NORMAL;
shexinfo.lpIDList = ILCombine(parent_pidl, pidl);
- ShellExecuteExA(&shexinfo); /* Discard error/success info */
+ ShellExecuteExW(&shexinfo); /* Discard error/success info */
ILFree((LPITEMIDLIST)shexinfo.lpIDList);
}
More information about the wine-cvs
mailing list