Commit f76f34ca authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

scrrun: Implement GetFolder().

parent 2ca39611
......@@ -1410,11 +1410,24 @@ static HRESULT WINAPI filesys_GetFile(IFileSystem3 *iface, BSTR FilePath,
}
static HRESULT WINAPI filesys_GetFolder(IFileSystem3 *iface, BSTR FolderPath,
IFolder **ppfolder)
IFolder **folder)
{
FIXME("%p %s %p\n", iface, debugstr_w(FolderPath), ppfolder);
DWORD attrs;
return E_NOTIMPL;
TRACE("%p %s %p\n", iface, debugstr_w(FolderPath), folder);
if(!folder)
return E_POINTER;
*folder = NULL;
if(!FolderPath)
return E_INVALIDARG;
attrs = GetFileAttributesW(FolderPath);
if((attrs == INVALID_FILE_ATTRIBUTES) || !(attrs & FILE_ATTRIBUTE_DIRECTORY))
return CTL_E_PATHNOTFOUND;
return create_folder(FolderPath, folder);
}
static HRESULT WINAPI filesys_GetSpecialFolder(IFileSystem3 *iface,
......
......@@ -739,6 +739,42 @@ static void test_BuildPath(void)
}
}
static void test_GetFolder(void)
{
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
WCHAR buffW[MAX_PATH];
IFolder *folder;
HRESULT hr;
BSTR str;
folder = (void*)0xdeadbeef;
hr = IFileSystem3_GetFolder(fs3, NULL, &folder);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
ok(folder == NULL, "got %p\n", folder);
hr = IFileSystem3_GetFolder(fs3, NULL, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
/* something that doesn't exist */
str = SysAllocString(dummyW);
hr = IFileSystem3_GetFolder(fs3, str, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
folder = (void*)0xdeadbeef;
hr = IFileSystem3_GetFolder(fs3, str, &folder);
ok(hr == CTL_E_PATHNOTFOUND, "got 0x%08x\n", hr);
ok(folder == NULL, "got %p\n", folder);
SysFreeString(str);
GetWindowsDirectoryW(buffW, MAX_PATH);
str = SysAllocString(buffW);
hr = IFileSystem3_GetFolder(fs3, str, &folder);
ok(hr == S_OK, "got 0x%08x\n", hr);
SysFreeString(str);
IFolder_Release(folder);
}
START_TEST(filesystem)
{
HRESULT hr;
......@@ -763,6 +799,7 @@ START_TEST(filesystem)
test_GetFile();
test_CopyFolder();
test_BuildPath();
test_GetFolder();
IFileSystem3_Release(fs3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment