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
21a14e96
Commit
21a14e96
authored
Aug 18, 2015
by
Carlo Bramini
Committed by
Alexandre Julliard
Aug 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: SEEK_* macros from GLIBC should be replaced with safer MSVCRT_SEEK_* macros.
parent
cfbc37c6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
file.c
dlls/msvcrt/file.c
+20
-20
msvcrt.h
dlls/msvcrt/msvcrt.h
+4
-0
No files found.
dlls/msvcrt/file.c
View file @
21a14e96
...
...
@@ -1224,9 +1224,9 @@ __int64 CDECL MSVCRT__lseeki64(int fd, __int64 offset, int whence)
TRACE
(
":fd (%d) to %s pos %s
\n
"
,
fd
,
wine_dbgstr_longlong
(
offset
),
(
whence
==
SEEK_SET
)
?
"SEEK_SET"
:
(
whence
==
SEEK_CUR
)
?
"SEEK_CUR"
:
(
whence
==
SEEK_END
)
?
"SEEK_END"
:
"UNKNOWN"
);
(
whence
==
MSVCRT_
SEEK_SET
)
?
"SEEK_SET"
:
(
whence
==
MSVCRT_
SEEK_CUR
)
?
"SEEK_CUR"
:
(
whence
==
MSVCRT_
SEEK_END
)
?
"SEEK_END"
:
"UNKNOWN"
);
/* The MoleBox protection scheme expects msvcrt to use SetFilePointer only,
* so a LARGE_INTEGER offset cannot be passed directly via SetFilePointerEx. */
...
...
@@ -1357,8 +1357,8 @@ int CDECL MSVCRT__fseeki64_nolock(MSVCRT_FILE* file, __int64 offset, int whence)
{
int
ret
;
if
(
whence
==
SEEK_CUR
&&
file
->
_flag
&
MSVCRT__IOREAD
)
{
whence
=
SEEK_SET
;
if
(
whence
==
MSVCRT_
SEEK_CUR
&&
file
->
_flag
&
MSVCRT__IOREAD
)
{
whence
=
MSVCRT_
SEEK_SET
;
offset
+=
MSVCRT__ftelli64_nolock
(
file
);
}
...
...
@@ -1409,10 +1409,10 @@ int CDECL MSVCRT__chsize_s(int fd, __int64 size)
if
(
info
->
handle
!=
INVALID_HANDLE_VALUE
)
{
/* save the current file pointer */
cur
=
MSVCRT__lseeki64
(
fd
,
0
,
SEEK_CUR
);
cur
=
MSVCRT__lseeki64
(
fd
,
0
,
MSVCRT_
SEEK_CUR
);
if
(
cur
>=
0
)
{
pos
=
MSVCRT__lseeki64
(
fd
,
size
,
SEEK_SET
);
pos
=
MSVCRT__lseeki64
(
fd
,
size
,
MSVCRT_
SEEK_SET
);
if
(
pos
>=
0
)
{
ret
=
SetEndOfFile
(
info
->
handle
);
...
...
@@ -1420,7 +1420,7 @@ int CDECL MSVCRT__chsize_s(int fd, __int64 size)
}
/* restore the file pointer */
MSVCRT__lseeki64
(
fd
,
cur
,
SEEK_SET
);
MSVCRT__lseeki64
(
fd
,
cur
,
MSVCRT_
SEEK_SET
);
}
}
...
...
@@ -1457,7 +1457,7 @@ void CDECL MSVCRT_rewind(MSVCRT_FILE* file)
TRACE
(
":file (%p) fd (%d)
\n
"
,
file
,
file
->
_file
);
MSVCRT__lock_file
(
file
);
MSVCRT__fseek_nolock
(
file
,
0L
,
SEEK_SET
);
MSVCRT__fseek_nolock
(
file
,
0L
,
MSVCRT_
SEEK_SET
);
MSVCRT_clearerr
(
file
);
MSVCRT__unlock_file
(
file
);
}
...
...
@@ -1623,14 +1623,14 @@ MSVCRT_FILE* CDECL MSVCRT__wfdopen(int fd, const MSVCRT_wchar_t *mode)
*/
LONG
CDECL
MSVCRT__filelength
(
int
fd
)
{
LONG
curPos
=
MSVCRT__lseek
(
fd
,
0
,
SEEK_CUR
);
LONG
curPos
=
MSVCRT__lseek
(
fd
,
0
,
MSVCRT_
SEEK_CUR
);
if
(
curPos
!=
-
1
)
{
LONG
endPos
=
MSVCRT__lseek
(
fd
,
0
,
SEEK_END
);
LONG
endPos
=
MSVCRT__lseek
(
fd
,
0
,
MSVCRT_
SEEK_END
);
if
(
endPos
!=
-
1
)
{
if
(
endPos
!=
curPos
)
MSVCRT__lseek
(
fd
,
curPos
,
SEEK_SET
);
MSVCRT__lseek
(
fd
,
curPos
,
MSVCRT_
SEEK_SET
);
return
endPos
;
}
}
...
...
@@ -1642,14 +1642,14 @@ LONG CDECL MSVCRT__filelength(int fd)
*/
__int64
CDECL
MSVCRT__filelengthi64
(
int
fd
)
{
__int64
curPos
=
MSVCRT__lseeki64
(
fd
,
0
,
SEEK_CUR
);
__int64
curPos
=
MSVCRT__lseeki64
(
fd
,
0
,
MSVCRT_
SEEK_CUR
);
if
(
curPos
!=
-
1
)
{
__int64
endPos
=
MSVCRT__lseeki64
(
fd
,
0
,
SEEK_END
);
__int64
endPos
=
MSVCRT__lseeki64
(
fd
,
0
,
MSVCRT_
SEEK_END
);
if
(
endPos
!=
-
1
)
{
if
(
endPos
!=
curPos
)
MSVCRT__lseeki64
(
fd
,
curPos
,
SEEK_SET
);
MSVCRT__lseeki64
(
fd
,
curPos
,
MSVCRT_
SEEK_SET
);
return
endPos
;
}
}
...
...
@@ -3145,7 +3145,7 @@ int CDECL MSVCRT__wstat64i32(const MSVCRT_wchar_t *path, struct MSVCRT__stat64i3
*/
MSVCRT_long
CDECL
MSVCRT__tell
(
int
fd
)
{
return
MSVCRT__lseek
(
fd
,
0
,
SEEK_CUR
);
return
MSVCRT__lseek
(
fd
,
0
,
MSVCRT_
SEEK_CUR
);
}
/*********************************************************************
...
...
@@ -3153,7 +3153,7 @@ MSVCRT_long CDECL MSVCRT__tell(int fd)
*/
__int64
CDECL
_telli64
(
int
fd
)
{
return
MSVCRT__lseeki64
(
fd
,
0
,
SEEK_CUR
);
return
MSVCRT__lseeki64
(
fd
,
0
,
MSVCRT_
SEEK_CUR
);
}
/*********************************************************************
...
...
@@ -4415,7 +4415,7 @@ int CDECL MSVCRT_fsetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
file
->
_flag
&=
~
(
MSVCRT__IOREAD
|
MSVCRT__IOWRT
);
}
ret
=
(
MSVCRT__lseeki64
(
file
->
_file
,
*
pos
,
SEEK_SET
)
==
-
1
)
?
-
1
:
0
;
ret
=
(
MSVCRT__lseeki64
(
file
->
_file
,
*
pos
,
MSVCRT_
SEEK_SET
)
==
-
1
)
?
-
1
:
0
;
MSVCRT__unlock_file
(
file
);
return
ret
;
}
...
...
@@ -4456,7 +4456,7 @@ __int64 CDECL MSVCRT__ftelli64_nolock(MSVCRT_FILE* file)
pos
++
;
}
}
else
if
(
!
file
->
_cnt
)
{
/* nothing to do */
}
else
if
(
MSVCRT__lseeki64
(
file
->
_file
,
0
,
SEEK_END
)
==
pos
)
{
}
else
if
(
MSVCRT__lseeki64
(
file
->
_file
,
0
,
MSVCRT_
SEEK_END
)
==
pos
)
{
int
i
;
pos
-=
file
->
_cnt
;
...
...
@@ -4468,7 +4468,7 @@ __int64 CDECL MSVCRT__ftelli64_nolock(MSVCRT_FILE* file)
}
else
{
char
*
p
;
if
(
MSVCRT__lseeki64
(
file
->
_file
,
pos
,
SEEK_SET
)
!=
pos
)
if
(
MSVCRT__lseeki64
(
file
->
_file
,
pos
,
MSVCRT_
SEEK_SET
)
!=
pos
)
return
-
1
;
pos
-=
file
->
_bufsiz
;
...
...
dlls/msvcrt/msvcrt.h
View file @
21a14e96
...
...
@@ -666,6 +666,10 @@ struct MSVCRT__stat64 {
#define MSVCRT_RAND_MAX 0x7fff
#define MSVCRT_BUFSIZ 512
#define MSVCRT_SEEK_SET 0
#define MSVCRT_SEEK_CUR 1
#define MSVCRT_SEEK_END 2
#define MSVCRT_STDIN_FILENO 0
#define MSVCRT_STDOUT_FILENO 1
#define MSVCRT_STDERR_FILENO 2
...
...
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