Module: wine Branch: oldstable Commit: 9574248ea5e406e9aba9dcd8a2ae0ca52deae736 URL: https://gitlab.winehq.org/wine/wine/-/commit/9574248ea5e406e9aba9dcd8a2ae0ca...
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 (cherry picked from commit 8eb7843d206d014acf93239d6782a199228472e7) Conflicts: dlls/scrrun/tests/filesystem.c Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
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 5d7d42850ab..290a643c29a 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -2820,11 +2820,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 da1ca316382..0d2cc39bad9 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -632,6 +632,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_DateCreated(file, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + date = 0.0; + hr = IFile_get_DateCreated(file, &date); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(date > 0.0, "got %f\n", date); + hr = IFile_get_DateLastModified(file, NULL); ok(hr == E_POINTER, "got 0x%08x\n", hr);