From: Francis De Brabandere <francisdb@gmail.com> Return VARIANT_TRUE when the folder has no parent (its path is a drive root), and VARIANT_FALSE otherwise, using the existing get_parent_folder_name() helper. --- dlls/scrrun/filesystem.c | 11 +++++++++-- dlls/scrrun/tests/filesystem.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index 4fcbd23c97d..b523daaa1e2 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -2654,8 +2654,15 @@ static HRESULT WINAPI folder_Move(IFolder *iface, BSTR dest) static HRESULT WINAPI folder_get_IsRootFolder(IFolder *iface, VARIANT_BOOL *isroot) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, isroot); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, isroot); + + if(!isroot) + return E_POINTER; + + *isroot = get_parent_folder_name(This->path, SysStringLen(This->path)) + ? VARIANT_FALSE : VARIANT_TRUE; + return S_OK; } static HRESULT WINAPI folder_get_Size(IFolder *iface, VARIANT *size) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index aa3c37fea4f..7e9dab74987 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -1082,6 +1082,7 @@ static void test_Folder_ParentFolder(void) WCHAR windir[MAX_PATH]; IFolder *folder, *parent, *grandparent; BSTR str, expected; + VARIANT_BOOL isroot; HRESULT hr; GetWindowsDirectoryW(windir, MAX_PATH); @@ -1110,6 +1111,15 @@ static void test_Folder_ParentFolder(void) SysFreeString(str); SysFreeString(expected); + /* Non-root folder: IsRootFolder is FALSE. */ + hr = IFolder_get_IsRootFolder(folder, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + isroot = VARIANT_TRUE; + hr = IFolder_get_IsRootFolder(folder, &isroot); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(isroot == VARIANT_FALSE, "got %d\n", isroot); + IFolder_Release(folder); /* Root folder: ParentFolder returns NULL. */ @@ -1118,6 +1128,12 @@ static void test_Folder_ParentFolder(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(grandparent == NULL, "got %p, expected NULL\n", grandparent); + /* Root folder: IsRootFolder is TRUE. */ + isroot = VARIANT_FALSE; + hr = IFolder_get_IsRootFolder(parent, &isroot); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(isroot == VARIANT_TRUE, "got %d\n", isroot); + IFolder_Release(parent); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10661