Nikolay Sivov : scrrun: Implement Path() property for IFile.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 16 10:34:24 CDT 2015


Module: wine
Branch: master
Commit: 574350d838da872d6e9d4cdbcb03128ddb86db59
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=574350d838da872d6e9d4cdbcb03128ddb86db59

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Mar 13 23:31:04 2015 +0300

scrrun: Implement Path() property for IFile.

---

 dlls/scrrun/filesystem.c       | 15 ++++++++++++---
 dlls/scrrun/tests/filesystem.c | 10 +++++++++-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 74e5432..5e0fc28 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -2546,11 +2546,20 @@ static HRESULT WINAPI file_Invoke(IFile *iface, DISPID dispIdMember, REFIID riid
     return hr;
 }
 
-static HRESULT WINAPI file_get_Path(IFile *iface, BSTR *pbstrPath)
+static HRESULT WINAPI file_get_Path(IFile *iface, BSTR *path)
 {
     struct file *This = impl_from_IFile(iface);
-    FIXME("(%p)->(%p)\n", This, pbstrPath);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, path);
+
+    if (!path)
+        return E_POINTER;
+
+    *path = SysAllocString(This->path);
+    if (!*path)
+        return E_OUTOFMEMORY;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *name)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index 210b90c..987ecba 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -538,7 +538,7 @@ static void test_GetAbsolutePathName(void)
 static void test_GetFile(void)
 {
     static const WCHAR slW[] = {'\\',0};
-    BSTR path;
+    BSTR path, str;
     WCHAR pathW[MAX_PATH];
     FileAttribute fa;
     VARIANT size;
@@ -572,6 +572,14 @@ static void test_GetFile(void)
     hr = IFileSystem3_GetFile(fs3, path, &file);
     ok(hr == S_OK, "GetFile returned %x, expected S_OK\n", hr);
 
+    hr = IFile_get_Path(file, NULL);
+    ok(hr == E_POINTER, "got 0x%08x\n", hr);
+
+    hr = IFile_get_Path(file, &str);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(!lstrcmpW(str, pathW), "got %s\n", wine_dbgstr_w(str));
+    SysFreeString(str);
+
     hr = IFile_get_Attributes(file, &fa);
     gfa = GetFileAttributesW(pathW) & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN |
             FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_ARCHIVE |




More information about the wine-cvs mailing list