Module: wine Branch: master Commit: 8eb7843d206d014acf93239d6782a199228472e7 URL: https://gitlab.winehq.org/wine/wine/-/commit/8eb7843d206d014acf93239d6782a19...
Author: Robert Wilhelm robert.wilhelm@gmx.net Date: Mon Aug 22 08:36:10 2022 +0200
scrrun: Added DateCreated property for IFile.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42857
---
dlls/scrrun/filesystem.c | 12 +++++++++--- dlls/scrrun/tests/filesystem.c | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index 37753a84b5e..7a8a7689902 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -2947,11 +2947,17 @@ static HRESULT get_date_from_filetime(const FILETIME *ft, DATE *date) return S_OK; }
-static HRESULT WINAPI file_get_DateCreated(IFile *iface, DATE *pdate) +static HRESULT WINAPI file_get_DateCreated(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.ftCreationTime, date); + + return E_FAIL; }
static HRESULT WINAPI file_get_DateLastModified(IFile *iface, DATE *date) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index 5e88eaec46b..59f5859c556 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -635,6 +635,14 @@ static void test_GetFile(void) hr = IFileSystem3_GetFile(fs3, path, &file); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+ hr = IFile_get_DateCreated(file, NULL); + ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr); + + date = 0.0; + hr = IFile_get_DateCreated(file, &date); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(date > 0.0, "got %f\n", date); + hr = IFile_get_DateLastModified(file, NULL); ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);