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
4752e252
Commit
4752e252
authored
Jul 21, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a syscall thunk for NtClose().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5eefbc6d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
98 deletions
+12
-98
Makefile.in
dlls/ntdll/Makefile.in
+0
-1
ntdll.spec
dlls/ntdll/ntdll.spec
+2
-2
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+0
-2
om.c
dlls/ntdll/om.c
+0
-90
loader.c
dlls/ntdll/unix/loader.c
+0
-1
server.c
dlls/ntdll/unix/server.c
+9
-0
unixlib.h
dlls/ntdll/unixlib.h
+1
-2
No files found.
dlls/ntdll/Makefile.in
View file @
4752e252
...
...
@@ -24,7 +24,6 @@ C_SRCS = \
locale.c
\
misc.c
\
nt.c
\
om.c
\
path.c
\
printf.c
\
process.c
\
...
...
dlls/ntdll/ntdll.spec
View file @
4752e252
...
...
@@ -150,7 +150,7 @@
@ stdcall -syscall NtCancelTimer(long ptr)
@ stdcall -syscall NtClearEvent(long)
@ stdcall -syscall NtClearPowerRequest(long long)
@ stdcall NtClose(long)
@ stdcall
-syscall
NtClose(long)
@ stub NtCloseObjectAuditAlarm
# @ stub NtCompactKeys
# @ stub NtCompareTokens
...
...
@@ -1139,7 +1139,7 @@
@ stdcall -private -syscall ZwCancelTimer(long ptr) NtCancelTimer
@ stdcall -private -syscall ZwClearEvent(long) NtClearEvent
@ stdcall -private -syscall ZwClearPowerRequest(long long) NtClearPowerRequest
@ stdcall -private ZwClose(long) NtClose
@ stdcall -private
-syscall
ZwClose(long) NtClose
@ stub ZwCloseObjectAuditAlarm
# @ stub ZwCompactKeys
# @ stub ZwCompareTokens
...
...
dlls/ntdll/ntdll_misc.h
View file @
4752e252
...
...
@@ -44,8 +44,6 @@ static const UINT_PTR page_size = 0x1000;
extern
UINT_PTR
page_size
DECLSPEC_HIDDEN
;
#endif
extern
NTSTATUS
close_handle
(
HANDLE
)
DECLSPEC_HIDDEN
;
/* exceptions */
extern
LONG
call_vectored_handlers
(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
raise_status
(
NTSTATUS
status
,
EXCEPTION_RECORD
*
rec
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/om.c
deleted
100644 → 0
View file @
5eefbc6d
/*
* Object management functions
*
* Copyright 1999, 2000 Juergen Schmied
* Copyright 2005 Vitaliy Margolen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "wine/debug.h"
#include "windef.h"
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/server.h"
#include "wine/exception.h"
/*
* Generic object functions
*/
static
LONG
WINAPI
invalid_handle_exception_handler
(
EXCEPTION_POINTERS
*
eptr
)
{
EXCEPTION_RECORD
*
rec
=
eptr
->
ExceptionRecord
;
return
(
rec
->
ExceptionCode
==
EXCEPTION_INVALID_HANDLE
)
?
EXCEPTION_EXECUTE_HANDLER
:
EXCEPTION_CONTINUE_SEARCH
;
}
/* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
NTSTATUS
close_handle
(
HANDLE
handle
)
{
DWORD_PTR
debug_port
;
NTSTATUS
ret
=
unix_funcs
->
NtClose
(
handle
);
if
(
ret
==
STATUS_INVALID_HANDLE
&&
handle
&&
NtCurrentTeb
()
->
Peb
->
BeingDebugged
&&
!
NtQueryInformationProcess
(
NtCurrentProcess
(),
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
),
NULL
)
&&
debug_port
)
{
__TRY
{
EXCEPTION_RECORD
record
;
record
.
ExceptionCode
=
EXCEPTION_INVALID_HANDLE
;
record
.
ExceptionFlags
=
0
;
record
.
ExceptionRecord
=
NULL
;
record
.
ExceptionAddress
=
NULL
;
record
.
NumberParameters
=
0
;
RtlRaiseException
(
&
record
);
}
__EXCEPT
(
invalid_handle_exception_handler
)
{
}
__ENDTRY
}
return
ret
;
}
/**************************************************************************
* NtClose [NTDLL.@]
*
* Close a handle reference to an object.
*
* PARAMS
* Handle [I] handle to close
*
* RETURNS
* Success: ERROR_SUCCESS.
* Failure: An NTSTATUS error code.
*/
NTSTATUS
WINAPI
NtClose
(
HANDLE
Handle
)
{
return
close_handle
(
Handle
);
}
dlls/ntdll/unix/loader.c
View file @
4752e252
...
...
@@ -1360,7 +1360,6 @@ static double CDECL ntdll_tan( double d ) { return tan( d ); }
*/
static
struct
unix_funcs
unix_funcs
=
{
NtClose
,
NtCurrentTeb
,
NtGetContextThread
,
NtQueryPerformanceCounter
,
...
...
dlls/ntdll/unix/server.c
View file @
4752e252
...
...
@@ -1629,6 +1629,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE
*/
NTSTATUS
WINAPI
NtClose
(
HANDLE
handle
)
{
HANDLE
port
;
NTSTATUS
ret
;
int
fd
=
remove_fd_from_cache
(
handle
);
...
...
@@ -1639,5 +1640,13 @@ NTSTATUS WINAPI NtClose( HANDLE handle )
}
SERVER_END_REQ
;
if
(
fd
!=
-
1
)
close
(
fd
);
if
(
ret
!=
STATUS_INVALID_HANDLE
||
!
handle
)
return
ret
;
if
(
!
NtCurrentTeb
()
->
Peb
->
BeingDebugged
)
return
ret
;
if
(
!
NtQueryInformationProcess
(
NtCurrentProcess
(),
ProcessDebugPort
,
&
port
,
sizeof
(
port
),
NULL
)
&&
port
)
{
NtCurrentTeb
()
->
ExceptionCode
=
ret
;
pKiRaiseUserExceptionDispatcher
();
}
return
ret
;
}
dlls/ntdll/unixlib.h
View file @
4752e252
...
...
@@ -28,12 +28,11 @@ struct msghdr;
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 8
8
#define NTDLL_UNIXLIB_VERSION 8
9
struct
unix_funcs
{
/* Nt* functions */
NTSTATUS
(
WINAPI
*
NtClose
)(
HANDLE
handle
);
TEB
*
(
WINAPI
*
NtCurrentTeb
)(
void
);
NTSTATUS
(
WINAPI
*
NtGetContextThread
)(
HANDLE
handle
,
CONTEXT
*
context
);
NTSTATUS
(
WINAPI
*
NtQueryPerformanceCounter
)(
LARGE_INTEGER
*
counter
,
LARGE_INTEGER
*
frequency
);
...
...
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