Piotr Caban : msvcp140: Add _Last_write_time implementation.

Alexandre Julliard julliard at winehq.org
Thu Nov 29 15:09:37 CST 2018


Module: wine
Branch: stable
Commit: 65e6059b2149180f9becb2844512724850a7acb0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=65e6059b2149180f9becb2844512724850a7acb0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Aug 15 12:43:34 2018 +0200

msvcp140: Add _Last_write_time implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit a9c5ab9da6a94d56516548ead274dd5bd145a78c)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msvcp140/msvcp140.spec |  4 ++--
 dlls/msvcp90/ios.c          | 38 +++++++++++++++++++++++++++-----------
 2 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index f4bdbd1..0efd785 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3666,7 +3666,7 @@
 @ extern _LNan _LNan
 @ stub _LSinh
 @ extern _LSnan _LSnan
-@ stub _Last_write_time
+@ cdecl _Last_write_time(int64)
 @ cdecl _Link(wstr wstr) tr2_sys__Link_wchar
 @ cdecl _Lock_shared_ptr_spin_lock()
 @ cdecl _Lstat(wstr ptr)
@@ -3696,7 +3696,7 @@
 @ cdecl _Remove_dir(wstr) tr2_sys__Remove_dir_wchar
 @ stub _Rename
 @ stub _Resize
-@ stub _Set_last_write_time
+@ cdecl _Set_last_write_time(wstr int64)
 @ stub _Sinh
 @ extern _Snan _Snan
 @ cdecl _Stat(wstr ptr)
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index d7de542..cafc85d 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14851,7 +14851,7 @@ static __int64 get_last_write_time(HANDLE h)
     __int64 ret;
 
     if(!GetFileTime(h, 0, 0, &wt))
-        return 0;
+        return -1;
 
     ret = (((__int64)wt.dwHighDateTime)<< 32) + wt.dwLowDateTime;
     ret -= TICKS_1601_TO_1970;
@@ -14877,9 +14877,8 @@ __int64 __cdecl tr2_sys__Last_write_time(char const* path)
     return ret / TICKSPERSEC;
 }
 
-/* ?_Last_write_time at sys@tr2 at std@@YA_JPB_W at Z */
-/* ?_Last_write_time at sys@tr2 at std@@YA_JPEB_W at Z */
-__int64 __cdecl tr2_sys__Last_write_time_wchar(const wchar_t *path)
+/* _Last_write_time */
+__int64 __cdecl _Last_write_time(const wchar_t *path)
 {
     HANDLE handle;
     __int64 ret;
@@ -14889,11 +14888,19 @@ __int64 __cdecl tr2_sys__Last_write_time_wchar(const wchar_t *path)
     handle = CreateFileW(path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
             NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
     if(handle == INVALID_HANDLE_VALUE)
-        return 0;
+        return -1;
 
     ret = get_last_write_time(handle);
     CloseHandle(handle);
-    return ret / TICKSPERSEC;
+    return ret;
+}
+
+/* ?_Last_write_time at sys@tr2 at std@@YA_JPB_W at Z */
+/* ?_Last_write_time at sys@tr2 at std@@YA_JPEB_W at Z */
+__int64 __cdecl tr2_sys__Last_write_time_wchar(const wchar_t *path)
+{
+    TRACE("(%s)\n", debugstr_w(path));
+    return _Last_write_time(path) / TICKSPERSEC;
 }
 
 static int set_last_write_time(HANDLE h, __int64 time)
@@ -14928,11 +14935,11 @@ void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime)
     CloseHandle(handle);
 }
 
-/* ?_Last_write_time at sys@tr2 at std@@YAXPB_W_J at Z */
-/* ?_Last_write_time at sys@tr2 at std@@YAXPEB_W_J at Z */
-void __cdecl tr2_sys__Last_write_time_set_wchar(const wchar_t *path, __int64 time)
+/* _Set_last_write_time */
+int __cdecl _Set_last_write_time(const wchar_t *path, __int64 time)
 {
     HANDLE handle;
+    int ret;
 
     TRACE("(%s)\n", debugstr_w(path));
 
@@ -14940,10 +14947,19 @@ void __cdecl tr2_sys__Last_write_time_set_wchar(const wchar_t *path, __int64 tim
             FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
             NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
     if(handle == INVALID_HANDLE_VALUE)
-        return;
+        return 0;
 
-    set_last_write_time(handle, time * TICKSPERSEC);
+    ret = set_last_write_time(handle, time);
     CloseHandle(handle);
+    return ret;
+}
+
+/* ?_Last_write_time at sys@tr2 at std@@YAXPB_W_J at Z */
+/* ?_Last_write_time at sys@tr2 at std@@YAXPEB_W_J at Z */
+void __cdecl tr2_sys__Last_write_time_set_wchar(const wchar_t *path, __int64 time)
+{
+    TRACE("(%s)\n", debugstr_w(path));
+    _Set_last_write_time(path, time * TICKSPERSEC);
 }
 
 /* ??_Open_dir at sys@tr2 at std@@YAPAXPA_WPB_WAAHAAW4file_type at 123@@Z */




More information about the wine-cvs mailing list