scrrun: Correct FileExists for directories.
This commit is contained in:
parent
3d845b1242
commit
50fe9b87ed
|
@ -215,11 +215,13 @@ static HRESULT WINAPI filesys_DriveExists(IFileSystem3 *iface, BSTR DriveSpec,
|
|||
|
||||
static HRESULT WINAPI filesys_FileExists(IFileSystem3 *iface, BSTR path, VARIANT_BOOL *ret)
|
||||
{
|
||||
DWORD attrs;
|
||||
TRACE("%p %s %p\n", iface, debugstr_w(path), ret);
|
||||
|
||||
if (!ret) return E_POINTER;
|
||||
|
||||
*ret = GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
attrs = GetFileAttributesW(path);
|
||||
*ret = attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY) ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,20 @@ static void test_interfaces(void)
|
|||
ok(b == VARIANT_FALSE, "got %x\n", b);
|
||||
SysFreeString(path);
|
||||
|
||||
path = SysAllocString(file_path);
|
||||
b = VARIANT_FALSE;
|
||||
hr = IFileSystem3_FileExists(fs3, path, &b);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(b == VARIANT_TRUE, "got %x\n", b);
|
||||
SysFreeString(path);
|
||||
|
||||
path = SysAllocString(windows_path);
|
||||
b = VARIANT_TRUE;
|
||||
hr = IFileSystem3_FileExists(fs3, path, &b);
|
||||
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
|
||||
ok(b == VARIANT_FALSE, "got %x\n", b);
|
||||
SysFreeString(path);
|
||||
|
||||
/* Folder Exists */
|
||||
hr = IFileSystem3_FolderExists(fs3, NULL, NULL);
|
||||
ok(hr == E_POINTER, "got 0x%08x, expected 0x%08x\n", hr, E_POINTER);
|
||||
|
|
Loading…
Reference in New Issue