scrrun: Added IFileSystem3_FileExists implementation.

This commit is contained in:
Nikolay Sivov 2012-07-12 02:00:42 +04:00 committed by Alexandre Julliard
parent 6c5588f95d
commit 1ca6cacdb3
3 changed files with 27 additions and 6 deletions

View File

@ -213,12 +213,14 @@ static HRESULT WINAPI filesys_DriveExists(IFileSystem3 *iface, BSTR DriveSpec,
return E_NOTIMPL;
}
static HRESULT WINAPI filesys_FileExists(IFileSystem3 *iface, BSTR FileSpec,
VARIANT_BOOL *pfExists)
static HRESULT WINAPI filesys_FileExists(IFileSystem3 *iface, BSTR path, VARIANT_BOOL *ret)
{
FIXME("%p %s %p\n", iface, debugstr_w(FileSpec), pfExists);
TRACE("%p %s %p\n", iface, debugstr_w(path), ret);
return E_NOTIMPL;
if (!ret) return E_POINTER;
*ret = GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
static HRESULT WINAPI filesys_FolderExists(IFileSystem3 *iface, BSTR FolderSpec,

View File

@ -1,5 +1,5 @@
TESTDLL = scrrun.dll
IMPORTS = ole32 shlwapi uuid
IMPORTS = ole32 shlwapi uuid oleaut32
C_SRCS = \
filesystem.c

View File

@ -22,6 +22,7 @@
#include "windows.h"
#include "ole2.h"
#include "oleauto.h"
#include "dispex.h"
#include "wine/test.h"
@ -31,11 +32,14 @@
static void test_interfaces(void)
{
static const WCHAR pathW[] = {'p','a','t','h',0};
HRESULT hr;
IDispatch *disp;
IDispatchEx *dispex;
IFileSystem3 *fs3;
IObjectWithSite *site;
VARIANT_BOOL b;
BSTR path;
hr = CoCreateInstance(&CLSID_FileSystemObject, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IDispatch, (void**)&disp);
@ -46,7 +50,6 @@ static void test_interfaces(void)
hr = IDispatch_QueryInterface(disp, &IID_IFileSystem3, (void**)&fs3);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
IFileSystem3_Release(fs3);
hr = IDispatch_QueryInterface(disp, &IID_IObjectWithSite, (void**)&site);
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
@ -54,6 +57,22 @@ static void test_interfaces(void)
hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
b = VARIANT_TRUE;
hr = IFileSystem3_FileExists(fs3, NULL, &b);
ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK);
ok(b == VARIANT_FALSE, "got %x\n", b);
hr = IFileSystem3_FileExists(fs3, NULL, NULL);
ok(hr == E_POINTER, "got 0x%08x, expected 0x%08x\n", hr, E_POINTER);
path = SysAllocString(pathW);
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);
IFileSystem3_Release(fs3);
IDispatch_Release(disp);
}