scrrun: Implement GetFolder().

This commit is contained in:
Nikolay Sivov 2014-01-02 21:27:45 +04:00 committed by Alexandre Julliard
parent 2ca39611e1
commit f76f34ca23
2 changed files with 53 additions and 3 deletions

View file

@ -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,

View file

@ -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);