Nikolay Sivov : scrrun: Added IFileSystem3_FileExists implementation.
Alexandre Julliard
julliard at winehq.org
Thu Jul 12 18:00:34 CDT 2012
Module: wine
Branch: master
Commit: 1ca6cacdb348746fbc3a8b56e9285593dcc7c437
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1ca6cacdb348746fbc3a8b56e9285593dcc7c437
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Jul 12 02:00:42 2012 +0400
scrrun: Added IFileSystem3_FileExists implementation.
---
dlls/scrrun/filesystem.c | 10 ++++++----
dlls/scrrun/tests/Makefile.in | 2 +-
dlls/scrrun/tests/filesystem.c | 21 ++++++++++++++++++++-
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index cd397a4..5c8fb7d 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -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,
diff --git a/dlls/scrrun/tests/Makefile.in b/dlls/scrrun/tests/Makefile.in
index 44cef8a..326eb1a 100644
--- a/dlls/scrrun/tests/Makefile.in
+++ b/dlls/scrrun/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = scrrun.dll
-IMPORTS = ole32 shlwapi uuid
+IMPORTS = ole32 shlwapi uuid oleaut32
C_SRCS = \
filesystem.c
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index c48baa4..ff1856e 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -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);
}
More information about the wine-cvs
mailing list