From 4135874f0f2d72d62298eac4ad725eb629d33286 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 30 Jul 2013 11:31:07 +0200 Subject: [PATCH] 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 3c9e1d25333..1074ea5b983 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 101c396fae3..cc94a82d504 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);