scrrun: Added IFileSystem3_FileExists implementation
Nikolay Sivov
nsivov at codeweavers.com
Wed Jul 11 17:03:09 CDT 2012
http://bugs.winehq.org/show_bug.cgi?id=31187
-------------- next part --------------
>From d8e2d298715c34dc225566926d60a62d226ac651 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu, 12 Jul 2012 02:00:42 +0400
Subject: [PATCH 1/1] 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 a14d926..75c84da 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -194,12 +194,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);
}
--
1.5.6.5
More information about the wine-patches
mailing list