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
2cb4361c
Commit
2cb4361c
authored
Nov 01, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Reimplemented SetFilePointerEx on top of ntdll functions.
parent
83a66a98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
31 deletions
+34
-31
file.c
dlls/kernel32/file.c
+34
-31
No files found.
dlls/kernel32/file.c
View file @
2cb4361c
...
...
@@ -47,7 +47,6 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "thread.h"
#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
file
);
...
...
@@ -940,44 +939,48 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, DWORD
BOOL
WINAPI
SetFilePointerEx
(
HANDLE
hFile
,
LARGE_INTEGER
distance
,
LARGE_INTEGER
*
newpos
,
DWORD
method
)
{
static
const
int
whence
[
3
]
=
{
SEEK_SET
,
SEEK_CUR
,
SEEK_END
};
BOOL
ret
=
FALSE
;
NTSTATUS
status
;
int
fd
;
TRACE
(
"handle %p offset %s newpos %p origin %d
\n
"
,
hFile
,
wine_dbgstr_longlong
(
distance
.
QuadPart
),
newpos
,
method
);
LONGLONG
pos
;
IO_STATUS_BLOCK
io
;
FILE_POSITION_INFORMATION
info
;
if
(
method
>
FILE_END
)
switch
(
method
)
{
case
FILE_BEGIN
:
pos
=
distance
.
QuadPart
;
break
;
case
FILE_CURRENT
:
if
(
NtQueryInformationFile
(
hFile
,
&
io
,
&
info
,
sizeof
(
info
),
FilePositionInformation
))
goto
error
;
pos
=
info
.
CurrentByteOffset
.
QuadPart
+
distance
.
QuadPart
;
break
;
case
FILE_END
:
{
FILE_END_OF_FILE_INFORMATION
eof
;
if
(
NtQueryInformationFile
(
hFile
,
&
io
,
&
eof
,
sizeof
(
eof
),
FileEndOfFileInformation
))
goto
error
;
pos
=
eof
.
EndOfFile
.
QuadPart
+
distance
.
QuadPart
;
}
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
ret
;
return
FALSE
;
}
if
(
!
(
status
=
wine_server_handle_to_fd
(
hFile
,
0
,
&
fd
,
NULL
))
)
if
(
pos
<
0
)
{
off_t
pos
,
res
;
pos
=
distance
.
QuadPart
;
if
((
res
=
lseek
(
fd
,
pos
,
whence
[
method
]
))
==
(
off_t
)
-
1
)
{
/* also check EPERM due to SuSE7 2.2.16 lseek() EPERM kernel bug */
if
(((
errno
==
EINVAL
)
||
(
errno
==
EPERM
))
&&
(
method
!=
FILE_BEGIN
)
&&
(
pos
<
0
))
SetLastError
(
ERROR_NEGATIVE_SEEK
);
else
FILE_SetDosError
();
}
else
{
ret
=
TRUE
;
if
(
newpos
)
newpos
->
QuadPart
=
res
;
}
wine_server_release_fd
(
hFile
,
fd
);
SetLastError
(
ERROR_NEGATIVE_SEEK
);
return
FALSE
;
}
else
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
ret
;
info
.
CurrentByteOffset
.
QuadPart
=
pos
;
if
(
NtSetInformationFile
(
hFile
,
&
io
,
&
info
,
sizeof
(
info
),
FilePositionInformation
))
goto
error
;
if
(
newpos
)
newpos
->
QuadPart
=
pos
;
return
TRUE
;
error:
SetLastError
(
RtlNtStatusToDosError
(
io
.
u
.
Status
)
);
return
FALSE
;
}
/***********************************************************************
...
...
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