Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7ecc283b
Commit
7ecc283b
authored
Feb 14, 2007
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Feb 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implemented stat64, wstat64 and fstat64.
Change all other variations of stat use the stat64 family, since it is the most general.
parent
cbb6da2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
35 deletions
+106
-35
file.c
dlls/msvcrt/file.c
+90
-33
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+3
-2
headers.c
dlls/msvcrt/tests/headers.c
+13
-0
No files found.
dlls/msvcrt/file.c
View file @
7ecc283b
...
@@ -111,19 +111,34 @@ static CRITICAL_SECTION MSVCRT_file_cs;
...
@@ -111,19 +111,34 @@ static CRITICAL_SECTION MSVCRT_file_cs;
#define LOCK_FILES() do { EnterCriticalSection(&MSVCRT_file_cs); } while (0)
#define LOCK_FILES() do { EnterCriticalSection(&MSVCRT_file_cs); } while (0)
#define UNLOCK_FILES() do { LeaveCriticalSection(&MSVCRT_file_cs); } while (0)
#define UNLOCK_FILES() do { LeaveCriticalSection(&MSVCRT_file_cs); } while (0)
static
void
msvcrt_cp_from_stati64
(
const
struct
MSVCRT__stati64
*
bufi64
,
struct
MSVCRT__stat
*
buf
)
static
void
msvcrt_stat64_to_stat
(
const
struct
MSVCRT__stat64
*
buf64
,
struct
MSVCRT__stat
*
buf
)
{
{
buf
->
st_dev
=
bufi64
->
st_dev
;
buf
->
st_dev
=
buf64
->
st_dev
;
buf
->
st_ino
=
bufi64
->
st_ino
;
buf
->
st_ino
=
buf64
->
st_ino
;
buf
->
st_mode
=
bufi64
->
st_mode
;
buf
->
st_mode
=
buf64
->
st_mode
;
buf
->
st_nlink
=
bufi64
->
st_nlink
;
buf
->
st_nlink
=
buf64
->
st_nlink
;
buf
->
st_uid
=
bufi64
->
st_uid
;
buf
->
st_uid
=
buf64
->
st_uid
;
buf
->
st_gid
=
bufi64
->
st_gid
;
buf
->
st_gid
=
buf64
->
st_gid
;
buf
->
st_rdev
=
bufi64
->
st_rdev
;
buf
->
st_rdev
=
buf64
->
st_rdev
;
buf
->
st_size
=
bufi64
->
st_size
;
buf
->
st_size
=
buf64
->
st_size
;
buf
->
st_atime
=
bufi64
->
st_atime
;
buf
->
st_atime
=
buf64
->
st_atime
;
buf
->
st_mtime
=
bufi64
->
st_mtime
;
buf
->
st_mtime
=
buf64
->
st_mtime
;
buf
->
st_ctime
=
bufi64
->
st_ctime
;
buf
->
st_ctime
=
buf64
->
st_ctime
;
}
static
void
msvcrt_stat64_to_stati64
(
const
struct
MSVCRT__stat64
*
buf64
,
struct
MSVCRT__stati64
*
buf
)
{
buf
->
st_dev
=
buf64
->
st_dev
;
buf
->
st_ino
=
buf64
->
st_ino
;
buf
->
st_mode
=
buf64
->
st_mode
;
buf
->
st_nlink
=
buf64
->
st_nlink
;
buf
->
st_uid
=
buf64
->
st_uid
;
buf
->
st_gid
=
buf64
->
st_gid
;
buf
->
st_rdev
=
buf64
->
st_rdev
;
buf
->
st_size
=
buf64
->
st_size
;
buf
->
st_atime
=
buf64
->
st_atime
;
buf
->
st_mtime
=
buf64
->
st_mtime
;
buf
->
st_ctime
=
buf64
->
st_ctime
;
}
}
static
inline
BOOL
msvcrt_is_valid_fd
(
int
fd
)
static
inline
BOOL
msvcrt_is_valid_fd
(
int
fd
)
...
@@ -1106,9 +1121,9 @@ int CDECL MSVCRT__fileno(MSVCRT_FILE* file)
...
@@ -1106,9 +1121,9 @@ int CDECL MSVCRT__fileno(MSVCRT_FILE* file)
}
}
/*********************************************************************
/*********************************************************************
* _fstat
i
64 (MSVCRT.@)
* _fstat64 (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__fstat
i64
(
int
fd
,
struct
MSVCRT__stati
64
*
buf
)
int
CDECL
MSVCRT__fstat
64
(
int
fd
,
struct
MSVCRT__stat
64
*
buf
)
{
{
DWORD
dw
;
DWORD
dw
;
BY_HANDLE_FILE_INFORMATION
hfi
;
BY_HANDLE_FILE_INFORMATION
hfi
;
...
@@ -1126,7 +1141,7 @@ int CDECL MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf)
...
@@ -1126,7 +1141,7 @@ int CDECL MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf)
}
}
memset
(
&
hfi
,
0
,
sizeof
(
hfi
));
memset
(
&
hfi
,
0
,
sizeof
(
hfi
));
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat
i
64
));
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat64
));
if
(
!
GetFileInformationByHandle
(
hand
,
&
hfi
))
if
(
!
GetFileInformationByHandle
(
hand
,
&
hfi
))
{
{
WARN
(
":failed-last error (%d)
\n
"
,
GetLastError
());
WARN
(
":failed-last error (%d)
\n
"
,
GetLastError
());
...
@@ -1156,15 +1171,29 @@ int CDECL MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf)
...
@@ -1156,15 +1171,29 @@ int CDECL MSVCRT__fstati64(int fd, struct MSVCRT__stati64* buf)
}
}
/*********************************************************************
/*********************************************************************
* _fstati64 (MSVCRT.@)
*/
int
CDECL
MSVCRT__fstati64
(
int
fd
,
struct
MSVCRT__stati64
*
buf
)
{
int
ret
;
struct
MSVCRT__stat64
buf64
;
ret
=
MSVCRT__fstat64
(
fd
,
&
buf64
);
if
(
!
ret
)
msvcrt_stat64_to_stati64
(
&
buf64
,
buf
);
return
ret
;
}
/*********************************************************************
* _fstat (MSVCRT.@)
* _fstat (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__fstat
(
int
fd
,
struct
MSVCRT__stat
*
buf
)
int
CDECL
MSVCRT__fstat
(
int
fd
,
struct
MSVCRT__stat
*
buf
)
{
int
ret
;
{
int
ret
;
struct
MSVCRT__stat
i64
bufi
64
;
struct
MSVCRT__stat
64
buf
64
;
ret
=
MSVCRT__fstat
i64
(
fd
,
&
bufi
64
);
ret
=
MSVCRT__fstat
64
(
fd
,
&
buf
64
);
if
(
!
ret
)
if
(
!
ret
)
msvcrt_
cp_from_stati64
(
&
bufi
64
,
buf
);
msvcrt_
stat64_to_stat
(
&
buf
64
,
buf
);
return
ret
;
return
ret
;
}
}
...
@@ -1692,9 +1721,9 @@ int CDECL _setmode(int fd,int mode)
...
@@ -1692,9 +1721,9 @@ int CDECL _setmode(int fd,int mode)
}
}
/*********************************************************************
/*********************************************************************
* _stat
i
64 (MSVCRT.@)
* _stat64 (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__stat
i64
(
const
char
*
path
,
struct
MSVCRT__stati
64
*
buf
)
int
CDECL
MSVCRT__stat
64
(
const
char
*
path
,
struct
MSVCRT__stat
64
*
buf
)
{
{
DWORD
dw
;
DWORD
dw
;
WIN32_FILE_ATTRIBUTE_DATA
hfi
;
WIN32_FILE_ATTRIBUTE_DATA
hfi
;
...
@@ -1710,7 +1739,7 @@ int CDECL MSVCRT__stati64(const char* path, struct MSVCRT__stati64 * buf)
...
@@ -1710,7 +1739,7 @@ int CDECL MSVCRT__stati64(const char* path, struct MSVCRT__stati64 * buf)
return
-
1
;
return
-
1
;
}
}
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat
i
64
));
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat64
));
/* FIXME: rdev isn't drive num, despite what the docs say-what is it?
/* FIXME: rdev isn't drive num, despite what the docs say-what is it?
Bon 011120: This FIXME seems incorrect
Bon 011120: This FIXME seems incorrect
...
@@ -1753,27 +1782,41 @@ int CDECL MSVCRT__stati64(const char* path, struct MSVCRT__stati64 * buf)
...
@@ -1753,27 +1782,41 @@ int CDECL MSVCRT__stati64(const char* path, struct MSVCRT__stati64 * buf)
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
TRACE
(
"%d %d 0x%08lx%08lx %ld %ld %ld
\n
"
,
buf
->
st_mode
,
buf
->
st_nlink
,
TRACE
(
"%d %d 0x%08lx%08lx %ld %ld %ld
\n
"
,
buf
->
st_mode
,
buf
->
st_nlink
,
(
long
)(
buf
->
st_size
>>
32
),(
long
)
buf
->
st_size
,
(
long
)(
buf
->
st_size
>>
32
),(
long
)
buf
->
st_size
,
buf
->
st_atime
,
buf
->
st_mtime
,
buf
->
st_ctime
);
(
long
)
buf
->
st_atime
,(
long
)
buf
->
st_mtime
,(
long
)
buf
->
st_ctime
);
return
0
;
return
0
;
}
}
/*********************************************************************
/*********************************************************************
* _stati64 (MSVCRT.@)
*/
int
CDECL
MSVCRT__stati64
(
const
char
*
path
,
struct
MSVCRT__stati64
*
buf
)
{
int
ret
;
struct
MSVCRT__stat64
buf64
;
ret
=
MSVCRT__stat64
(
path
,
&
buf64
);
if
(
!
ret
)
msvcrt_stat64_to_stati64
(
&
buf64
,
buf
);
return
ret
;
}
/*********************************************************************
* _stat (MSVCRT.@)
* _stat (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__stat
(
const
char
*
path
,
struct
MSVCRT__stat
*
buf
)
int
CDECL
MSVCRT__stat
(
const
char
*
path
,
struct
MSVCRT__stat
*
buf
)
{
int
ret
;
{
int
ret
;
struct
MSVCRT__stat
i64
bufi
64
;
struct
MSVCRT__stat
64
buf
64
;
ret
=
MSVCRT__stat
i64
(
path
,
&
bufi
64
);
ret
=
MSVCRT__stat
64
(
path
,
&
buf
64
);
if
(
!
ret
)
if
(
!
ret
)
msvcrt_
cp_from_stati64
(
&
bufi
64
,
buf
);
msvcrt_
stat64_to_stat
(
&
buf
64
,
buf
);
return
ret
;
return
ret
;
}
}
/*********************************************************************
/*********************************************************************
* _wstat
i
64 (MSVCRT.@)
* _wstat64 (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__wstat
i64
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__stati
64
*
buf
)
int
CDECL
MSVCRT__wstat
64
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__stat
64
*
buf
)
{
{
DWORD
dw
;
DWORD
dw
;
WIN32_FILE_ATTRIBUTE_DATA
hfi
;
WIN32_FILE_ATTRIBUTE_DATA
hfi
;
...
@@ -1789,7 +1832,7 @@ int CDECL MSVCRT__wstati64(const MSVCRT_wchar_t* path, struct MSVCRT__stati64 *
...
@@ -1789,7 +1832,7 @@ int CDECL MSVCRT__wstati64(const MSVCRT_wchar_t* path, struct MSVCRT__stati64 *
return
-
1
;
return
-
1
;
}
}
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat
));
memset
(
buf
,
0
,
sizeof
(
struct
MSVCRT__stat
64
));
/* FIXME: rdev isn't drive num, despite what the docs says-what is it? */
/* FIXME: rdev isn't drive num, despite what the docs says-what is it? */
if
(
MSVCRT_iswalpha
(
*
path
))
if
(
MSVCRT_iswalpha
(
*
path
))
...
@@ -1828,20 +1871,34 @@ int CDECL MSVCRT__wstati64(const MSVCRT_wchar_t* path, struct MSVCRT__stati64 *
...
@@ -1828,20 +1871,34 @@ int CDECL MSVCRT__wstati64(const MSVCRT_wchar_t* path, struct MSVCRT__stati64 *
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
TRACE
(
"%d %d 0x%08lx%08lx %ld %ld %ld
\n
"
,
buf
->
st_mode
,
buf
->
st_nlink
,
TRACE
(
"%d %d 0x%08lx%08lx %ld %ld %ld
\n
"
,
buf
->
st_mode
,
buf
->
st_nlink
,
(
long
)(
buf
->
st_size
>>
32
),(
long
)
buf
->
st_size
,
(
long
)(
buf
->
st_size
>>
32
),(
long
)
buf
->
st_size
,
buf
->
st_atime
,
buf
->
st_mtime
,
buf
->
st_ctime
);
(
long
)
buf
->
st_atime
,(
long
)
buf
->
st_mtime
,(
long
)
buf
->
st_ctime
);
return
0
;
return
0
;
}
}
/*********************************************************************
/*********************************************************************
* _wstati64 (MSVCRT.@)
*/
int
CDECL
MSVCRT__wstati64
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__stati64
*
buf
)
{
int
ret
;
struct
MSVCRT__stat64
buf64
;
ret
=
MSVCRT__wstat64
(
path
,
&
buf64
);
if
(
!
ret
)
msvcrt_stat64_to_stati64
(
&
buf64
,
buf
);
return
ret
;
}
/*********************************************************************
* _wstat (MSVCRT.@)
* _wstat (MSVCRT.@)
*/
*/
int
CDECL
MSVCRT__wstat
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__stat
*
buf
)
int
CDECL
MSVCRT__wstat
(
const
MSVCRT_wchar_t
*
path
,
struct
MSVCRT__stat
*
buf
)
{
{
int
ret
;
int
ret
;
struct
MSVCRT__stat
i64
bufi
64
;
struct
MSVCRT__stat
64
buf
64
;
ret
=
MSVCRT__wstat
i64
(
path
,
&
bufi
64
);
ret
=
MSVCRT__wstat
64
(
path
,
&
buf
64
);
if
(
!
ret
)
msvcrt_
cp_from_stati64
(
&
bufi
64
,
buf
);
if
(
!
ret
)
msvcrt_
stat64_to_stat
(
&
buf
64
,
buf
);
return
ret
;
return
ret
;
}
}
...
...
dlls/msvcrt/msvcrt.spec
View file @
7ecc283b
...
@@ -243,7 +243,7 @@
...
@@ -243,7 +243,7 @@
@ cdecl _fputwchar(long)
@ cdecl _fputwchar(long)
@ cdecl _fsopen(str str long) MSVCRT__fsopen
@ cdecl _fsopen(str str long) MSVCRT__fsopen
@ cdecl _fstat(long ptr) MSVCRT__fstat
@ cdecl _fstat(long ptr) MSVCRT__fstat
@
stub
_fstat64
@
cdecl _fstat64(long ptr) MSVCRT_
_fstat64
@ cdecl _fstati64(long ptr) MSVCRT__fstati64
@ cdecl _fstati64(long ptr) MSVCRT__fstati64
@ cdecl _ftime(ptr)
@ cdecl _ftime(ptr)
@ cdecl -ret64 _ftol() ntdll._ftol
@ cdecl -ret64 _ftol() ntdll._ftol
...
@@ -451,7 +451,7 @@
...
@@ -451,7 +451,7 @@
@ cdecl _spawnvpe(long str ptr ptr)
@ cdecl _spawnvpe(long str ptr ptr)
@ cdecl _splitpath(str ptr ptr ptr ptr) ntdll._splitpath
@ cdecl _splitpath(str ptr ptr ptr ptr) ntdll._splitpath
@ cdecl _stat(str ptr) MSVCRT__stat
@ cdecl _stat(str ptr) MSVCRT__stat
@
stub _stat64
@
cdecl _stat64(str ptr) MSVCRT__stat64
@ cdecl _stati64(str ptr) MSVCRT__stati64
@ cdecl _stati64(str ptr) MSVCRT__stati64
@ cdecl _statusfp()
@ cdecl _statusfp()
@ cdecl _strcmpi(str str) ntdll._strcmpi
@ cdecl _strcmpi(str str) ntdll._strcmpi
...
@@ -560,6 +560,7 @@
...
@@ -560,6 +560,7 @@
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr)
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr)
@ cdecl _wstat(wstr ptr) MSVCRT__wstat
@ cdecl _wstat(wstr ptr) MSVCRT__wstat
@ cdecl _wstati64(wstr ptr) MSVCRT__wstati64
@ cdecl _wstati64(wstr ptr) MSVCRT__wstati64
@ cdecl _wstat64(wstr ptr) MSVCRT__wstat64
@ cdecl _wstrdate(ptr)
@ cdecl _wstrdate(ptr)
@ cdecl _wstrtime(ptr)
@ cdecl _wstrtime(ptr)
@ stub _wsystem #(wstr)
@ stub _wsystem #(wstr)
...
...
dlls/msvcrt/tests/headers.c
View file @
7ecc283b
...
@@ -88,6 +88,7 @@ static void test_types(void)
...
@@ -88,6 +88,7 @@ static void test_types(void)
CHECK_TYPE
(
_off_t
);
CHECK_TYPE
(
_off_t
);
CHECK_TYPE
(
clock_t
);
CHECK_TYPE
(
clock_t
);
CHECK_TYPE
(
time_t
);
CHECK_TYPE
(
time_t
);
CHECK_TYPE
(
__time64_t
);
CHECK_TYPE
(
fpos_t
);
CHECK_TYPE
(
fpos_t
);
CHECK_SIZE
(
FILE
);
CHECK_SIZE
(
FILE
);
CHECK_TYPE
(
terminate_handler
);
CHECK_TYPE
(
terminate_handler
);
...
@@ -295,6 +296,18 @@ static void test_structs(void)
...
@@ -295,6 +296,18 @@ static void test_structs(void)
CHECK_FIELD
(
_stati64
,
st_atime
);
CHECK_FIELD
(
_stati64
,
st_atime
);
CHECK_FIELD
(
_stati64
,
st_mtime
);
CHECK_FIELD
(
_stati64
,
st_mtime
);
CHECK_FIELD
(
_stati64
,
st_ctime
);
CHECK_FIELD
(
_stati64
,
st_ctime
);
CHECK_STRUCT
(
_stat64
);
CHECK_FIELD
(
_stat64
,
st_dev
);
CHECK_FIELD
(
_stat64
,
st_ino
);
CHECK_FIELD
(
_stat64
,
st_mode
);
CHECK_FIELD
(
_stat64
,
st_nlink
);
CHECK_FIELD
(
_stat64
,
st_uid
);
CHECK_FIELD
(
_stat64
,
st_gid
);
CHECK_FIELD
(
_stat64
,
st_rdev
);
CHECK_FIELD
(
_stat64
,
st_size
);
CHECK_FIELD
(
_stat64
,
st_atime
);
CHECK_FIELD
(
_stat64
,
st_mtime
);
CHECK_FIELD
(
_stat64
,
st_ctime
);
}
}
/************* Checking defines ***************/
/************* Checking defines ***************/
...
...
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