Commit 71beac32 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

ntdll: Don't call NtClose directly in delete_view.

parent 06505c9a
...@@ -39,6 +39,8 @@ struct drive_info ...@@ -39,6 +39,8 @@ struct drive_info
ino_t ino; ino_t ino;
}; };
extern NTSTATUS close_handle( HANDLE );
/* exceptions */ /* exceptions */
extern void wait_suspend( CONTEXT *context ); extern void wait_suspend( CONTEXT *context );
extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *context ); extern NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTEXT *context );
......
...@@ -348,6 +348,22 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, ...@@ -348,6 +348,22 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
return ret; return ret;
} }
/* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
NTSTATUS close_handle( HANDLE handle )
{
NTSTATUS ret;
int fd = server_remove_fd_from_cache( handle );
SERVER_START_REQ( close_handle )
{
req->handle = wine_server_obj_handle( handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
if (fd != -1) close( fd );
return ret;
}
/************************************************************************** /**************************************************************************
* NtClose [NTDLL.@] * NtClose [NTDLL.@]
* *
...@@ -362,17 +378,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, ...@@ -362,17 +378,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
*/ */
NTSTATUS WINAPI NtClose( HANDLE Handle ) NTSTATUS WINAPI NtClose( HANDLE Handle )
{ {
NTSTATUS ret; return close_handle( Handle );
int fd = server_remove_fd_from_cache( Handle );
SERVER_START_REQ( close_handle )
{
req->handle = wine_server_obj_handle( Handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
if (fd != -1) close( fd );
return ret;
} }
/* /*
......
...@@ -444,7 +444,7 @@ static void delete_view( struct file_view *view ) /* [in] View */ ...@@ -444,7 +444,7 @@ static void delete_view( struct file_view *view ) /* [in] View */
{ {
if (!(view->protect & VPROT_SYSTEM)) unmap_area( view->base, view->size ); if (!(view->protect & VPROT_SYSTEM)) unmap_area( view->base, view->size );
list_remove( &view->entry ); list_remove( &view->entry );
if (view->mapping) NtClose( view->mapping ); if (view->mapping) close_handle( view->mapping );
RtlFreeHeap( virtual_heap, 0, view ); RtlFreeHeap( virtual_heap, 0, view );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment