ntdll: Don't call NtClose directly in delete_view.

This commit is contained in:
Hans Leidekker 2010-12-02 11:33:03 +01:00 committed by Alexandre Julliard
parent 06505c9a34
commit 71beac3219
3 changed files with 20 additions and 12 deletions

View File

@ -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 );

View File

@ -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,
*/ */
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;
} }
/* /*

View File

@ -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 );
} }