diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 6779e618faf..bd770312781 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3222,8 +3222,20 @@ static HRESULT WINAPI knownfolder_GetCategory( IKnownFolder *iface, KF_CATEGORY *pCategory) { - FIXME("%p\n", pCategory); - return E_NOTIMPL; + struct knownfolder *knownfolder = impl_from_IKnownFolder(iface); + HRESULT hr = S_OK; + DWORD dwSize, dwType; + + TRACE("%p, %p\n", knownfolder, pCategory); + + /* we can not get category for folder which is not registered */ + if(!knownfolder->registryPath) + hr = E_FAIL; + + if(SUCCEEDED(hr)) + hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE, knownfolder->registryPath, szCategory, RRF_RT_DWORD, &dwType, pCategory, &dwSize)); + + return hr; } static HRESULT WINAPI knownfolder_GetShellItem( diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 2240630e5d6..b58b5c2b2d5 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -1176,9 +1176,7 @@ static void test_knownFolders(void) if(SUCCEEDED(hr)) { hr = IKnownFolder_GetCategory(folder, &cat); - todo_wine ok(hr == S_OK, "failed to get folder category: hr=0x%0x\n", hr); - todo_wine ok(cat == KF_CATEGORY_PERUSER, "invalid category returned: %d, while %d (KF_CATEGORY_PERUSER) expected\n", cat, KF_CATEGORY_PERUSER); hr = IKnownFolder_GetId(folder, &folderId);