shell32: Fix setting of NULL arguments in IShellLink.
This commit is contained in:
parent
d51b4e19fb
commit
61a4200162
|
@ -1497,9 +1497,13 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR psz
|
|||
TRACE("(%p)->(args=%s)\n",This, pszArgs);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->sArgs);
|
||||
This->sArgs = HEAP_strdupAtoW( GetProcessHeap(), 0, pszArgs);
|
||||
if( !This->sArgs )
|
||||
return E_OUTOFMEMORY;
|
||||
if (pszArgs)
|
||||
{
|
||||
This->sArgs = HEAP_strdupAtoW( GetProcessHeap(), 0, pszArgs);
|
||||
if( !This->sArgs )
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
else This->sArgs = NULL;
|
||||
|
||||
This->bDirty = TRUE;
|
||||
|
||||
|
@ -1877,11 +1881,16 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps
|
|||
TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->sArgs);
|
||||
This->sArgs = HeapAlloc( GetProcessHeap(), 0,
|
||||
(lstrlenW( pszArgs )+1)*sizeof (WCHAR) );
|
||||
if ( !This->sArgs )
|
||||
return E_OUTOFMEMORY;
|
||||
lstrcpyW( This->sArgs, pszArgs );
|
||||
if (pszArgs)
|
||||
{
|
||||
This->sArgs = HeapAlloc( GetProcessHeap(), 0,
|
||||
(lstrlenW( pszArgs )+1)*sizeof (WCHAR) );
|
||||
if ( !This->sArgs )
|
||||
return E_OUTOFMEMORY;
|
||||
lstrcpyW( This->sArgs, pszArgs );
|
||||
}
|
||||
else This->sArgs = NULL;
|
||||
|
||||
This->bDirty = TRUE;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -275,6 +275,20 @@ static void test_get_set(void)
|
|||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_SetArguments(sl, NULL);
|
||||
ok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(!buffer[0] || lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_SetArguments(sl, "");
|
||||
ok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(!buffer[0], "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
/* Test Getting / Setting showcmd */
|
||||
i=0xdeadbeef;
|
||||
r = IShellLinkA_GetShowCmd(sl, &i);
|
||||
|
|
Loading…
Reference in New Issue