Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4a7b3460
Commit
4a7b3460
authored
May 23, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add explicit 32- and 64-bit versions of the utime functions.
parent
8408e3a9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
26 deletions
+147
-26
file.c
dlls/msvcrt/file.c
+100
-17
msvcrt.h
dlls/msvcrt/msvcrt.h
+9
-3
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+6
-0
headers.c
dlls/msvcrt/tests/headers.c
+6
-3
utime.h
include/msvcrt/sys/utime.h
+26
-3
No files found.
dlls/msvcrt/file.c
View file @
4a7b3460
...
...
@@ -141,6 +141,16 @@ static void msvcrt_stat64_to_stati64(const struct MSVCRT__stat64 *buf64, struct
buf
->
st_ctime
=
buf64
->
st_ctime
;
}
static
void
time_to_filetime
(
MSVCRT___time64_t
time
,
FILETIME
*
ft
)
{
/* 1601 to 1970 is 369 years plus 89 leap days */
static
const
__int64
secs_1601_to_1970
=
((
369
*
365
+
89
)
*
(
__int64
)
86400
);
__int64
ticks
=
(
time
+
secs_1601_to_1970
)
*
10000000
;
ft
->
dwHighDateTime
=
ticks
>>
32
;
ft
->
dwLowDateTime
=
ticks
;
}
static
inline
BOOL
msvcrt_is_valid_fd
(
int
fd
)
{
return
fd
>=
0
&&
fd
<
MSVCRT_fdend
&&
(
MSVCRT_fdesc
[
fd
].
wxflag
&
WX_OPEN
);
...
...
@@ -1213,27 +1223,22 @@ int CDECL MSVCRT__fstat(int fd, struct MSVCRT__stat* buf)
}
/*********************************************************************
* _futime (MSVCRT.@)
* _futime
64
(MSVCRT.@)
*/
int
CDECL
_futime
(
int
fd
,
struct
MSVCRT__utimbuf
*
t
)
int
CDECL
_futime
64
(
int
fd
,
struct
MSVCRT___utimbuf64
*
t
)
{
HANDLE
hand
=
msvcrt_fdtoh
(
fd
);
FILETIME
at
,
wt
;
if
(
!
t
)
{
MSVCRT_time_t
currTime
;
MSVCRT_time
(
&
currTime
);
RtlSecondsSince1970ToTime
(
currTime
,
(
LARGE_INTEGER
*
)
&
at
);
wt
=
at
;
time_to_filetime
(
MSVCRT__time64
(
NULL
),
&
at
);
wt
=
at
;
}
else
{
RtlSecondsSince1970ToTime
(
t
->
actime
,
(
LARGE_INTEGER
*
)
&
at
);
if
(
t
->
actime
==
t
->
modtime
)
wt
=
at
;
else
RtlSecondsSince1970ToTime
(
t
->
modtime
,
(
LARGE_INTEGER
*
)
&
wt
);
time_to_filetime
(
t
->
actime
,
&
at
);
time_to_filetime
(
t
->
modtime
,
&
wt
);
}
if
(
!
SetFileTime
(
hand
,
NULL
,
&
at
,
&
wt
))
...
...
@@ -1245,6 +1250,32 @@ int CDECL _futime(int fd, struct MSVCRT__utimbuf *t)
}
/*********************************************************************
* _futime32 (MSVCRT.@)
*/
int
CDECL
_futime32
(
int
fd
,
struct
MSVCRT___utimbuf32
*
t
)
{
struct
MSVCRT___utimbuf64
t64
;
t64
.
actime
=
t
->
actime
;
t64
.
modtime
=
t
->
modtime
;
return
_futime64
(
fd
,
&
t64
);
}
/*********************************************************************
* _futime (MSVCRT.@)
*/
#ifdef _WIN64
int
CDECL
_futime
(
int
fd
,
struct
MSVCRT___utimbuf64
*
t
)
{
return
_futime64
(
fd
,
t
);
}
#else
int
CDECL
_futime
(
int
fd
,
struct
MSVCRT___utimbuf32
*
t
)
{
return
_futime32
(
fd
,
t
);
}
#endif
/*********************************************************************
* _get_osfhandle (MSVCRT.@)
*/
MSVCRT_intptr_t
CDECL
_get_osfhandle
(
int
fd
)
...
...
@@ -2053,15 +2084,15 @@ int CDECL MSVCRT__umask(int umask)
}
/*********************************************************************
* _utime (MSVCRT.@)
* _utime
64
(MSVCRT.@)
*/
int
CDECL
_utime
(
const
char
*
path
,
struct
MSVCRT__utimbuf
*
t
)
int
CDECL
_utime
64
(
const
char
*
path
,
struct
MSVCRT___utimbuf64
*
t
)
{
int
fd
=
MSVCRT__open
(
path
,
MSVCRT__O_WRONLY
|
MSVCRT__O_BINARY
);
if
(
fd
>
0
)
{
int
retVal
=
_futime
(
fd
,
t
);
int
retVal
=
_futime
64
(
fd
,
t
);
MSVCRT__close
(
fd
);
return
retVal
;
}
...
...
@@ -2069,15 +2100,41 @@ int CDECL _utime(const char* path, struct MSVCRT__utimbuf *t)
}
/*********************************************************************
* _wutime (MSVCRT.@)
* _utime32 (MSVCRT.@)
*/
int
CDECL
_utime32
(
const
char
*
path
,
struct
MSVCRT___utimbuf32
*
t
)
{
struct
MSVCRT___utimbuf64
t64
;
t64
.
actime
=
t
->
actime
;
t64
.
modtime
=
t
->
modtime
;
return
_utime64
(
path
,
&
t64
);
}
/*********************************************************************
* _utime (MSVCRT.@)
*/
int
CDECL
_wutime
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__utimbuf
*
t
)
#ifdef _WIN64
int
CDECL
_utime
(
const
char
*
path
,
struct
MSVCRT___utimbuf64
*
t
)
{
return
_utime64
(
path
,
t
);
}
#else
int
CDECL
_utime
(
const
char
*
path
,
struct
MSVCRT___utimbuf32
*
t
)
{
return
_utime32
(
path
,
t
);
}
#endif
/*********************************************************************
* _wutime64 (MSVCRT.@)
*/
int
CDECL
_wutime64
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT___utimbuf64
*
t
)
{
int
fd
=
_wopen
(
path
,
MSVCRT__O_WRONLY
|
MSVCRT__O_BINARY
);
if
(
fd
>
0
)
{
int
retVal
=
_futime
(
fd
,
t
);
int
retVal
=
_futime
64
(
fd
,
t
);
MSVCRT__close
(
fd
);
return
retVal
;
}
...
...
@@ -2085,6 +2142,32 @@ int CDECL _wutime(const MSVCRT_wchar_t* path, struct MSVCRT__utimbuf *t)
}
/*********************************************************************
* _wutime32 (MSVCRT.@)
*/
int
CDECL
_wutime32
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT___utimbuf32
*
t
)
{
struct
MSVCRT___utimbuf64
t64
;
t64
.
actime
=
t
->
actime
;
t64
.
modtime
=
t
->
modtime
;
return
_wutime64
(
path
,
&
t64
);
}
/*********************************************************************
* _wutime (MSVCRT.@)
*/
#ifdef _WIN64
int
CDECL
_wutime
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT___utimbuf64
*
t
)
{
return
_wutime64
(
path
,
t
);
}
#else
int
CDECL
_wutime
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT___utimbuf32
*
t
)
{
return
_wutime32
(
path
,
t
);
}
#endif
/*********************************************************************
* _write (MSVCRT.@)
*/
int
CDECL
MSVCRT__write
(
int
fd
,
const
void
*
buf
,
unsigned
int
count
)
...
...
dlls/msvcrt/msvcrt.h
View file @
4a7b3460
...
...
@@ -335,10 +335,16 @@ struct MSVCRT__wfinddatai64_t {
MSVCRT_wchar_t
name
[
260
];
};
struct
MSVCRT__
utimbuf
struct
MSVCRT__
_utimbuf32
{
MSVCRT_time_t
actime
;
MSVCRT_time_t
modtime
;
MSVCRT___time32_t
actime
;
MSVCRT___time32_t
modtime
;
};
struct
MSVCRT___utimbuf64
{
MSVCRT___time64_t
actime
;
MSVCRT___time64_t
modtime
;
};
/* for FreeBSD */
...
...
dlls/msvcrt/msvcrt.spec
View file @
4a7b3460
...
...
@@ -272,6 +272,8 @@
@ cdecl -ret64 _ftol() ntdll._ftol
@ cdecl _fullpath(ptr str long)
@ cdecl _futime(long ptr)
@ cdecl _futime32(long ptr)
@ cdecl _futime64(long ptr)
@ cdecl _gcvt(double long str)
@ cdecl _get_osfhandle(long)
@ cdecl _get_sbh_threshold()
...
...
@@ -521,6 +523,8 @@
@ cdecl _unlink(str) MSVCRT__unlink
@ cdecl _unloaddll(long)
@ cdecl _unlock(long)
@ cdecl _utime32(str ptr)
@ cdecl _utime64(str ptr)
@ cdecl _utime(str ptr)
@ cdecl _vscprintf(str ptr)
@ cdecl _vscwprintf(wstr ptr)
...
...
@@ -608,6 +612,8 @@
@ cdecl _wtol(wstr) ntdll._wtol
@ cdecl _wunlink(wstr)
@ cdecl _wutime(wstr ptr)
@ cdecl _wutime32(wstr ptr)
@ cdecl _wutime64(wstr ptr)
@ cdecl _y0(double)
@ cdecl _y1(double)
@ cdecl _yn(long double )
...
...
dlls/msvcrt/tests/headers.c
View file @
4a7b3460
...
...
@@ -219,9 +219,12 @@ static void test_structs(void)
CHECK_FIELD
(
_wfinddatai64_t
,
time_write
);
CHECK_FIELD
(
_wfinddatai64_t
,
size
);
CHECK_FIELD
(
_wfinddatai64_t
,
name
[
260
]);
CHECK_STRUCT
(
_utimbuf
);
CHECK_FIELD
(
_utimbuf
,
actime
);
CHECK_FIELD
(
_utimbuf
,
modtime
);
CHECK_STRUCT
(
__utimbuf32
);
CHECK_FIELD
(
__utimbuf32
,
actime
);
CHECK_FIELD
(
__utimbuf32
,
modtime
);
CHECK_STRUCT
(
__utimbuf64
);
CHECK_FIELD
(
__utimbuf64
,
actime
);
CHECK_FIELD
(
__utimbuf64
,
modtime
);
CHECK_STRUCT
(
_stat
);
CHECK_FIELD
(
_stat
,
st_dev
);
CHECK_FIELD
(
_stat
,
st_ino
);
...
...
include/msvcrt/sys/utime.h
View file @
4a7b3460
...
...
@@ -31,15 +31,38 @@ struct _utimbuf
time_t
actime
;
time_t
modtime
;
};
struct
__utimbuf32
{
__time32_t
actime
;
__time32_t
modtime
;
};
struct
__utimbuf64
{
__time64_t
actime
;
__time64_t
modtime
;
};
#endif
/* _UTIMBUF_DEFINED */
#ifdef __cplusplus
extern
"C"
{
#endif
int
__cdecl
_futime
(
int
,
struct
_utimbuf
*
);
int
__cdecl
_utime
(
const
char
*
,
struct
_utimbuf
*
);
int
__cdecl
_wutime
(
const
wchar_t
*
,
struct
_utimbuf
*
);
int
__cdecl
_futime32
(
int
,
struct
__utimbuf32
*
);
int
__cdecl
_futime64
(
int
,
struct
__utimbuf64
*
);
int
__cdecl
_utime32
(
const
char
*
,
struct
__utimbuf32
*
);
int
__cdecl
_utime64
(
const
char
*
,
struct
__utimbuf64
*
);
int
__cdecl
_wutime32
(
const
wchar_t
*
,
struct
__utimbuf32
*
);
int
__cdecl
_wutime64
(
const
wchar_t
*
,
struct
__utimbuf64
*
);
#ifdef _USE_32BIT_TIME_T
static
inline
int
_futime
(
int
fd
,
struct
_utimbuf
*
buf
)
{
return
_futime32
(
fd
,
(
struct
__utimbuf32
*
)
buf
);
}
static
inline
int
_utime
(
const
char
*
s
,
struct
_utimbuf
*
buf
)
{
return
_utime32
(
s
,
(
struct
__utimbuf32
*
)
buf
);
}
static
inline
int
_wutime
(
const
wchar_t
*
s
,
struct
_utimbuf
*
buf
)
{
return
_wutime32
(
s
,
(
struct
__utimbuf32
*
)
buf
);
}
#else
static
inline
int
_futime
(
int
fd
,
struct
_utimbuf
*
buf
)
{
return
_futime64
(
fd
,
(
struct
__utimbuf64
*
)
buf
);
}
static
inline
int
_utime
(
const
char
*
s
,
struct
_utimbuf
*
buf
)
{
return
_utime64
(
s
,
(
struct
__utimbuf64
*
)
buf
);
}
static
inline
int
_wutime
(
const
wchar_t
*
s
,
struct
_utimbuf
*
buf
)
{
return
_wutime64
(
s
,
(
struct
__utimbuf64
*
)
buf
);
}
#endif
#ifdef __cplusplus
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment