Piotr Caban : scrrun: Add IFile::get_Attributes implementation.

Alexandre Julliard julliard at winehq.org
Tue Jul 30 14:14:21 CDT 2013


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Jul 30 11:31:07 2013 +0200

scrrun: Add IFile::get_Attributes implementation.

---

 dlls/scrrun/filesystem.c       |   15 +++++++++++++--
 dlls/scrrun/tests/filesystem.c |    7 +++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c
index 3c9e1d2..1074ea5 100644
--- a/dlls/scrrun/filesystem.c
+++ b/dlls/scrrun/filesystem.c
@@ -778,8 +778,19 @@ static HRESULT WINAPI file_get_ParentFolder(IFile *iface, IFolder **ppfolder)
 static HRESULT WINAPI file_get_Attributes(IFile *iface, FileAttribute *pfa)
 {
     struct file *This = impl_from_IFile(iface);
-    FIXME("(%p)->(%p)\n", This, pfa);
-    return E_NOTIMPL;
+    DWORD fa;
+
+    TRACE("(%p)->(%p)\n", This, pfa);
+
+    if(!pfa)
+        return E_POINTER;
+
+    fa = GetFileAttributesW(This->path);
+    if(fa == INVALID_FILE_ATTRIBUTES)
+        return create_error(GetLastError());
+
+    *pfa = fa & ~FILE_ATTRIBUTE_NORMAL;
+    return S_OK;
 }
 
 static HRESULT WINAPI file_put_Attributes(IFile *iface, FileAttribute pfa)
diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c
index 101c396..cc94a82 100644
--- a/dlls/scrrun/tests/filesystem.c
+++ b/dlls/scrrun/tests/filesystem.c
@@ -466,6 +466,8 @@ static void test_GetFile(void)
     static const WCHAR get_file[] = {'g','e','t','_','f','i','l','e','.','t','s','t',0};
 
     BSTR path = SysAllocString(get_file);
+    FileAttribute fa;
+    DWORD gfa;
     IFile *file;
     HRESULT hr;
     HANDLE hf;
@@ -498,6 +500,11 @@ 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_Attributes(file, &fa);
+    gfa = GetFileAttributesW(get_file) & ~FILE_ATTRIBUTE_NORMAL;
+    ok(hr == S_OK, "get_Attributes returned %x, expected S_OK\n", hr);
+    ok(fa == gfa, "fa = %x, expected %x\n", fa, gfa);
     IFile_Release(file);
 
     DeleteFileW(path);




More information about the wine-cvs mailing list