Commit efb6b373 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp110: Add _Last_write_time(wchar_t) implementation.

parent 2e39f014
...@@ -1561,12 +1561,12 @@ ...@@ -1561,12 +1561,12 @@
@ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) num_put_wchar__Iput @ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) num_put_wchar__Iput
@ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) tr2_sys__Last_write_time_set @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) tr2_sys__Last_write_time_set
@ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) tr2_sys__Last_write_time_set @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) tr2_sys__Last_write_time_set
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z(wstr int64) tr2_sys__Last_write_time_set_wchar
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z(wstr int64) tr2_sys__Last_write_time_set_wchar
@ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) tr2_sys__Last_write_time @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) tr2_sys__Last_write_time
@ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) tr2_sys__Last_write_time @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) tr2_sys__Last_write_time
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z(wstr) tr2_sys__Last_write_time_wchar
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z(wstr) tr2_sys__Last_write_time_wchar
@ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
@ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
@ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
......
...@@ -1522,12 +1522,12 @@ ...@@ -1522,12 +1522,12 @@
@ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) num_put_wchar__Iput @ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) num_put_wchar__Iput
@ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) tr2_sys__Last_write_time_set @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) tr2_sys__Last_write_time_set
@ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) tr2_sys__Last_write_time_set @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) tr2_sys__Last_write_time_set
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z(wstr int64) tr2_sys__Last_write_time_set_wchar
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z(wstr int64) tr2_sys__Last_write_time_set_wchar
@ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) tr2_sys__Last_write_time @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) tr2_sys__Last_write_time
@ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) tr2_sys__Last_write_time @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) tr2_sys__Last_write_time
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z(wstr) tr2_sys__Last_write_time_wchar
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z(wstr) tr2_sys__Last_write_time_wchar
@ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
@ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
@ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch @ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) _Pad__Launch
......
...@@ -1522,12 +1522,12 @@ ...@@ -1522,12 +1522,12 @@
@ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) msvcp120.?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z @ cdecl -arch=win64 ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z(ptr ptr ptr ptr long ptr long) msvcp120.?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z
@ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z(str int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z
@ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z(str int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPEBD_J@Z
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z @ cdecl -arch=win32 ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z(wstr int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z @ cdecl -arch=win64 ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z(wstr int64) msvcp120.?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z
@ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPBD@Z @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z(str) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPBD@Z
@ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z(str) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z
@ stub -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z @ cdecl -ret64 -arch=win32 ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z(wstr) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z
@ stub -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z @ cdecl -ret64 -arch=win64 ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z(wstr) msvcp120.?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z
@ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z @ cdecl -arch=arm ?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QAAXPAU_Thrd_imp_t@@@Z
@ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z @ thiscall -arch=i386 ?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QAEXPAU_Thrd_imp_t@@@Z
@ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z @ cdecl -arch=win64 ?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z(ptr ptr) msvcp120.?_Launch@_Pad@std@@QEAAXPEAU_Thrd_imp_t@@@Z
......
...@@ -14845,14 +14845,26 @@ enum file_type __cdecl tr2_sys__Lstat(char const* path, int* err_code) ...@@ -14845,14 +14845,26 @@ enum file_type __cdecl tr2_sys__Lstat(char const* path, int* err_code)
return tr2_sys__Stat(path, err_code); return tr2_sys__Stat(path, err_code);
} }
static __int64 get_last_write_time(HANDLE h)
{
FILETIME wt;
__int64 ret;
if(!GetFileTime(h, 0, 0, &wt))
return 0;
ret = (((__int64)wt.dwHighDateTime)<< 32) + wt.dwLowDateTime;
ret -= TICKS_1601_TO_1970;
return ret;
}
/* ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z */ /* ?_Last_write_time@sys@tr2@std@@YA_JPBD@Z */
/* ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z */ /* ?_Last_write_time@sys@tr2@std@@YA_JPEBD@Z */
__int64 __cdecl tr2_sys__Last_write_time(char const* path) __int64 __cdecl tr2_sys__Last_write_time(char const* path)
{ {
HANDLE handle; HANDLE handle;
FILETIME lwt; __int64 ret;
int ret;
__int64 last_write_time;
TRACE("(%s)\n", debugstr_a(path)); TRACE("(%s)\n", debugstr_a(path));
handle = CreateFileA(path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, handle = CreateFileA(path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
...@@ -14860,15 +14872,38 @@ __int64 __cdecl tr2_sys__Last_write_time(char const* path) ...@@ -14860,15 +14872,38 @@ __int64 __cdecl tr2_sys__Last_write_time(char const* path)
if(handle == INVALID_HANDLE_VALUE) if(handle == INVALID_HANDLE_VALUE)
return 0; return 0;
ret = GetFileTime(handle, 0, 0, &lwt); ret = get_last_write_time(handle);
CloseHandle(handle); CloseHandle(handle);
if(!ret) return ret / TICKSPERSEC;
}
/* ?_Last_write_time@sys@tr2@std@@YA_JPB_W@Z */
/* ?_Last_write_time@sys@tr2@std@@YA_JPEB_W@Z */
__int64 __cdecl tr2_sys__Last_write_time_wchar(const wchar_t *path)
{
HANDLE handle;
__int64 ret;
TRACE("(%s)\n", debugstr_w(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 0;
last_write_time = (((__int64)lwt.dwHighDateTime)<< 32) + lwt.dwLowDateTime; ret = get_last_write_time(handle);
last_write_time -= TICKS_1601_TO_1970; CloseHandle(handle);
last_write_time /= TICKSPERSEC; return ret / TICKSPERSEC;
return last_write_time; }
static int set_last_write_time(HANDLE h, __int64 time)
{
FILETIME wt;
time += TICKS_1601_TO_1970;
wt.dwLowDateTime = (DWORD)time;
wt.dwHighDateTime = (DWORD)(time >> 32);
return SetFileTime(h, 0, 0, &wt);
} }
/* ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z */ /* ?_Last_write_time@sys@tr2@std@@YAXPBD_J@Z */
...@@ -14876,7 +14911,7 @@ __int64 __cdecl tr2_sys__Last_write_time(char const* path) ...@@ -14876,7 +14911,7 @@ __int64 __cdecl tr2_sys__Last_write_time(char const* path)
void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime) void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime)
{ {
HANDLE handle; HANDLE handle;
FILETIME lwt;
TRACE("(%s)\n", debugstr_a(path)); TRACE("(%s)\n", debugstr_a(path));
handle = CreateFileA(path, FILE_WRITE_ATTRIBUTES, handle = CreateFileA(path, FILE_WRITE_ATTRIBUTES,
...@@ -14889,12 +14924,25 @@ void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime) ...@@ -14889,12 +14924,25 @@ void __cdecl tr2_sys__Last_write_time_set(char const* path, __int64 newtime)
* According to the test of msvcp120, * According to the test of msvcp120,
* msvcp120's implementation does nothing. Obviously, this is a bug of windows. * msvcp120's implementation does nothing. Obviously, this is a bug of windows.
*/ */
set_last_write_time(handle, newtime * TICKSPERSEC);
CloseHandle(handle);
}
/* ?_Last_write_time@sys@tr2@std@@YAXPB_W_J@Z */
/* ?_Last_write_time@sys@tr2@std@@YAXPEB_W_J@Z */
void __cdecl tr2_sys__Last_write_time_set_wchar(const wchar_t *path, __int64 time)
{
HANDLE handle;
TRACE("(%s)\n", debugstr_w(path));
handle = CreateFileW(path, FILE_WRITE_ATTRIBUTES,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
if(handle == INVALID_HANDLE_VALUE)
return;
newtime *= TICKSPERSEC; set_last_write_time(handle, time * TICKSPERSEC);
newtime += TICKS_1601_TO_1970;
lwt.dwLowDateTime = (DWORD)(newtime);
lwt.dwHighDateTime = (DWORD)(newtime >> 32);
SetFileTime(handle, 0, 0, &lwt);
CloseHandle(handle); CloseHandle(handle);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment