shell32: Handle NULL pName in ShellLink fnSetDescription.
This commit is contained in:
parent
8b8e15d812
commit
2554a55b34
|
@ -1469,9 +1469,14 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR p
|
||||||
TRACE("(%p)->(pName=%s)\n", This, pszName);
|
TRACE("(%p)->(pName=%s)\n", This, pszName);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->sDescription);
|
HeapFree(GetProcessHeap(), 0, This->sDescription);
|
||||||
|
if (pszName)
|
||||||
|
{
|
||||||
This->sDescription = HEAP_strdupAtoW( GetProcessHeap(), 0, pszName);
|
This->sDescription = HEAP_strdupAtoW( GetProcessHeap(), 0, pszName);
|
||||||
if ( !This->sDescription )
|
if ( !This->sDescription )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
This->sDescription = NULL;
|
||||||
|
|
||||||
This->bDirty = TRUE;
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
|
@ -1852,12 +1857,17 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR
|
||||||
TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
|
TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->sDescription);
|
HeapFree(GetProcessHeap(), 0, This->sDescription);
|
||||||
|
if (pszName)
|
||||||
|
{
|
||||||
This->sDescription = HeapAlloc( GetProcessHeap(), 0,
|
This->sDescription = HeapAlloc( GetProcessHeap(), 0,
|
||||||
(lstrlenW( pszName )+1)*sizeof(WCHAR) );
|
(lstrlenW( pszName )+1)*sizeof(WCHAR) );
|
||||||
if ( !This->sDescription )
|
if ( !This->sDescription )
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
lstrcpyW( This->sDescription, pszName );
|
lstrcpyW( This->sDescription, pszName );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
This->sDescription = NULL;
|
||||||
This->bDirty = TRUE;
|
This->bDirty = TRUE;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -136,6 +136,15 @@ static void test_get_set(void)
|
||||||
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||||
ok(lstrcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
|
ok(lstrcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
|
||||||
|
|
||||||
|
r = IShellLinkA_SetDescription(sl, NULL);
|
||||||
|
ok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
|
||||||
|
|
||||||
|
strcpy(buffer,"garbage");
|
||||||
|
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
|
||||||
|
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||||
|
ok(*buffer=='\0' || broken(lstrcmp(buffer,str)==0), "GetDescription returned '%s'\n", buffer); /* NT4 */
|
||||||
|
|
||||||
|
|
||||||
/* Test Getting / Setting the work directory */
|
/* Test Getting / Setting the work directory */
|
||||||
strcpy(buffer,"garbage");
|
strcpy(buffer,"garbage");
|
||||||
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
|
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
|
||||||
|
|
Loading…
Reference in New Issue