scrrun: Added DateLastModified property for IFile.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d4b1938cfb
commit
f6016609e1
|
@ -2712,6 +2712,21 @@ static HRESULT WINAPI file_put_Attributes(IFile *iface, FileAttribute pfa)
|
|||
return SetFileAttributesW(This->path, pfa) ? S_OK : create_error(GetLastError());
|
||||
}
|
||||
|
||||
static HRESULT get_date_from_filetime(const FILETIME *ft, DATE *date)
|
||||
{
|
||||
FILETIME ftlocal;
|
||||
SYSTEMTIME st;
|
||||
|
||||
if (!date)
|
||||
return E_POINTER;
|
||||
|
||||
FileTimeToLocalFileTime(ft, &ftlocal);
|
||||
FileTimeToSystemTime(&ftlocal, &st);
|
||||
SystemTimeToVariantTime(&st, date);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI file_get_DateCreated(IFile *iface, DATE *pdate)
|
||||
{
|
||||
struct file *This = impl_from_IFile(iface);
|
||||
|
@ -2719,11 +2734,17 @@ static HRESULT WINAPI file_get_DateCreated(IFile *iface, DATE *pdate)
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI file_get_DateLastModified(IFile *iface, DATE *pdate)
|
||||
static HRESULT WINAPI file_get_DateLastModified(IFile *iface, DATE *date)
|
||||
{
|
||||
struct file *This = impl_from_IFile(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pdate);
|
||||
return E_NOTIMPL;
|
||||
WIN32_FILE_ATTRIBUTE_DATA attrs;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, date);
|
||||
|
||||
if (GetFileAttributesExW(This->path, GetFileExInfoStandard, &attrs))
|
||||
return get_date_from_filetime(&attrs.ftLastWriteTime, date);
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI file_get_DateLastAccessed(IFile *iface, DATE *pdate)
|
||||
|
|
|
@ -624,6 +624,7 @@ static void test_GetFile(void)
|
|||
HRESULT hr;
|
||||
HANDLE hf;
|
||||
BOOL ret;
|
||||
DATE date;
|
||||
|
||||
get_temp_path(NULL, pathW);
|
||||
|
||||
|
@ -649,6 +650,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_DateLastModified(file, NULL);
|
||||
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
||||
|
||||
date = 0.0;
|
||||
hr = IFile_get_DateLastModified(file, &date);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(date > 0.0, "got %f\n", date);
|
||||
|
||||
hr = IFile_get_Path(file, NULL);
|
||||
ok(hr == E_POINTER, "got 0x%08x\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue