- Fix bug with incorrect a working directory. Patch by Evgeny Boltik (bstsoft@narod...
authorDmitry Chapyshev <dmitry@reactos.org>
Thu, 8 Jan 2009 10:29:19 +0000 (10:29 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Thu, 8 Jan 2009 10:29:19 +0000 (10:29 +0000)
See issue #4006 for more details.

svn path=/trunk/; revision=38640

reactos/dll/win32/shell32/shv_def_cmenu.c

index 45705e1..b199e54 100644 (file)
@@ -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)))
             {