From 73b2556b86120370c280eb30c0985cf5e8bfafa9 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Thu, 8 Jan 2009 10:29:19 +0000 Subject: [PATCH] - Fix bug with incorrect a working directory. Patch by Evgeny Boltik (bstsoft@narod.ru) with my small changes See issue #4006 for more details. svn path=/trunk/; revision=38640 --- reactos/dll/win32/shell32/shv_def_cmenu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/shell32/shv_def_cmenu.c b/reactos/dll/win32/shell32/shv_def_cmenu.c index 45705e15734..b199e54833c 100644 --- a/reactos/dll/win32/shell32/shv_def_cmenu.c +++ b/reactos/dll/win32/shell32/shv_def_cmenu.c @@ -1186,6 +1186,8 @@ DoCreateLink( { WCHAR szPath[MAX_PATH]; WCHAR szTarget[MAX_PATH] = {0}; + WCHAR szDirPath[MAX_PATH]; + LPWSTR pszFile; STRRET strFile; LPWSTR pszExt; HRESULT hr; @@ -1230,7 +1232,11 @@ DoCreateLink( return E_FAIL; } - if (SUCCEEDED(IShellLinkW_SetPath(nLink, szPath))) + GetFullPathName(szPath, MAX_PATH, szDirPath, &pszFile); + if (pszFile) pszFile[0] = 0; + + if (SUCCEEDED(IShellLinkW_SetPath(nLink, szPath)) && + SUCCEEDED(IShellLinkW_SetWorkingDirectory(nLink, szDirPath))) { if (SUCCEEDED(IShellLinkW_QueryInterface(nLink, &IID_IPersistFile, (LPVOID*)&ipf))) { -- 2.17.1