scrrun: Add IFile::get_Attributes implementation.

This commit is contained in:
Piotr Caban 2013-07-30 11:31:07 +02:00 committed by Alexandre Julliard
parent 1257db2109
commit 4135874f0f
2 changed files with 20 additions and 2 deletions

View File

@ -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)

View File

@ -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);