Author: cwittich Date: Thu Jul 28 15:24:44 2016 New Revision: 72034
URL: http://svn.reactos.org/svn/reactos?rev=72034&view=rev Log: [SHELL32] apply similar fixes to SetWorkingDirectory, SetArguments, SetIconLocation and SetRelativePath
Modified: trunk/reactos/dll/win32/shell32/CShellLink.cpp
Modified: trunk/reactos/dll/win32/shell32/CShellLink.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CShellLin... ============================================================================== --- trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] Thu Jul 28 15:24:44 2016 @@ -1342,7 +1342,8 @@ wcscpy(sDescription, pszName); } else - sDescription = NULL; + sDescription = NULL; + bDirty = TRUE;
return S_OK; @@ -1365,11 +1366,17 @@ TRACE("(%p)->(dir=%s)\n", this, debugstr_w(pszDir));
HeapFree(GetProcessHeap(), 0, sWorkDir); - sWorkDir = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - (wcslen(pszDir) + 1) * sizeof (WCHAR)); - if (!sWorkDir) - return E_OUTOFMEMORY; - wcscpy(sWorkDir, pszDir); + if (pszDir) + { + sWorkDir = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + (wcslen(pszDir) + 1) * sizeof (WCHAR)); + if (!sWorkDir) + return E_OUTOFMEMORY; + wcscpy(sWorkDir, pszDir); + } + else + sWorkDir = NULL; + bDirty = TRUE;
return S_OK; @@ -1392,12 +1399,18 @@ TRACE("(%p)->(args=%s)\n", this, debugstr_w(pszArgs));
HeapFree(GetProcessHeap(), 0, sArgs); - sArgs = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - (wcslen(pszArgs) + 1) * sizeof (WCHAR)); - if (!sArgs) - return E_OUTOFMEMORY; - - wcscpy(sArgs, pszArgs); + if (pszArgs) + { + sArgs = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + (wcslen(pszArgs) + 1) * sizeof (WCHAR)); + if (!sArgs) + return E_OUTOFMEMORY; + + wcscpy(sArgs, pszArgs); + } + else + sArgs = NULL; + bDirty = TRUE;
return S_OK; @@ -1478,11 +1491,16 @@ TRACE("(%p)->(path=%s iicon=%u)\n", this, debugstr_w(pszIconPath), iIcon);
HeapFree(GetProcessHeap(), 0, sIcoPath); - sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - (wcslen(pszIconPath) + 1) * sizeof (WCHAR)); - if (!sIcoPath) - return E_OUTOFMEMORY; - wcscpy(sIcoPath, pszIconPath); + if (pszIconPath) + { + sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + (wcslen(pszIconPath) + 1) * sizeof (WCHAR)); + if (!sIcoPath) + return E_OUTOFMEMORY; + wcscpy(sIcoPath, pszIconPath); + } + else + sIcoPath = NULL;
iIcoNdx = iIcon; bDirty = TRUE; @@ -1495,11 +1513,17 @@ TRACE("(%p)->(path=%s %x)\n", this, debugstr_w(pszPathRel), dwReserved);
HeapFree(GetProcessHeap(), 0, sPathRel); - sPathRel = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - (wcslen(pszPathRel) + 1) * sizeof (WCHAR)); - if (!sPathRel) - return E_OUTOFMEMORY; - wcscpy(sPathRel, pszPathRel); + if (pszPathRel) + { + sPathRel = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + (wcslen(pszPathRel) + 1) * sizeof (WCHAR)); + if (!sPathRel) + return E_OUTOFMEMORY; + wcscpy(sPathRel, pszPathRel); + } + else + sPathRel = NULL; + bDirty = TRUE;
return ShellLink_UpdatePath(sPathRel, sPath, sWorkDir, &sPath);