mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
shell32: Zero-init the out parameter and fix the error if the folder id is invalid.
This commit is contained in:
parent
154aef98d8
commit
8272045cd8
2 changed files with 9 additions and 1 deletions
|
@ -3041,8 +3041,10 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t
|
|||
|
||||
TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid), flags, token, path);
|
||||
|
||||
*path = NULL;
|
||||
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
return HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND );
|
||||
|
||||
if (flags & KF_FLAG_CREATE)
|
||||
index |= CSIDL_FLAG_CREATE;
|
||||
|
|
|
@ -860,6 +860,12 @@ if (0) { /* crashes */
|
|||
hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, NULL);
|
||||
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
|
||||
}
|
||||
/* non-existent folder id */
|
||||
path = (void *)0xdeadbeef;
|
||||
hr = pSHGetKnownFolderPath(&IID_IOleObject, 0, NULL, &path);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08x\n", hr);
|
||||
ok(path == NULL, "got %p\n", path);
|
||||
|
||||
path = NULL;
|
||||
hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path);
|
||||
ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
|
||||
|
|
Loading…
Reference in a new issue