From 3b843d3e7d2af1beb6b4575d833c850410bcab48 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 20 Apr 2005 16:26:23 +0000 Subject: [PATCH] Remove all traces of the VIRTUAL_SetFaultHandler support. --- dlls/ntdll/ntdll.spec | 1 - dlls/ntdll/ntdll_misc.h | 2 -- dlls/ntdll/virtual.c | 51 +++++++++---------------------------------------- 3 files changed, 9 insertions(+), 45 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 27a8e09fb25..0ef50d76805 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1036,4 +1036,3 @@ @ cdecl MODULE_DllThreadAttach(ptr) @ cdecl MODULE_GetLoadOrderW(ptr wstr wstr) @ cdecl VERSION_Init(wstr) -@ cdecl VIRTUAL_SetFaultHandler(ptr ptr ptr) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 75739e591ac..e680e8c34b0 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -88,8 +88,6 @@ extern NTSTATUS FILE_GetNtStatus(void); extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ); /* virtual memory */ -typedef BOOL (*HANDLERPROC)(LPVOID, LPCVOID); -extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, HANDLERPROC proc, LPVOID arg); extern DWORD VIRTUAL_HandleFault(LPCVOID addr); extern BOOL VIRTUAL_HasMapping( LPCVOID addr ); extern void VIRTUAL_UseLargeAddressSpace(void); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 5bca4b7f062..c594ed846a9 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -68,8 +68,6 @@ typedef struct file_view void *base; /* Base address */ UINT size; /* Size in bytes */ HANDLE mapping; /* Handle to the file mapping */ - HANDLERPROC handlerProc; /* Fault handler */ - LPVOID handlerArg; /* Fault handler argument */ BYTE flags; /* Allocation flags (VFLAG_*) */ BYTE protect; /* Protection for all pages at allocation time */ BYTE prot[1]; /* Protection byte for each page */ @@ -377,7 +375,6 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz view->flags = 0; view->mapping = 0; view->protect = vprot; - view->handlerProc = NULL; memset( view->prot, vprot, size >> page_shift ); /* Insert it in the linked list */ @@ -1098,25 +1095,6 @@ void virtual_init(void) /*********************************************************************** - * VIRTUAL_SetFaultHandler - */ -BOOL VIRTUAL_SetFaultHandler( LPCVOID addr, HANDLERPROC proc, LPVOID arg ) -{ - FILE_VIEW *view; - BOOL ret = FALSE; - - RtlEnterCriticalSection( &csVirtual ); - if ((view = VIRTUAL_FindView( addr ))) - { - view->handlerProc = proc; - view->handlerArg = arg; - ret = TRUE; - } - RtlLeaveCriticalSection( &csVirtual ); - return ret; -} - -/*********************************************************************** * VIRTUAL_HandleFault */ DWORD VIRTUAL_HandleFault( LPCVOID addr ) @@ -1127,28 +1105,17 @@ DWORD VIRTUAL_HandleFault( LPCVOID addr ) RtlEnterCriticalSection( &csVirtual ); if ((view = VIRTUAL_FindView( addr ))) { - if (view->handlerProc) + BYTE vprot = view->prot[((const char *)addr - (const char *)view->base) >> page_shift]; + void *page = (void *)((UINT_PTR)addr & ~page_mask); + char *stack = NtCurrentTeb()->Tib.StackLimit; + if (vprot & VPROT_GUARD) { - HANDLERPROC proc = view->handlerProc; - void *arg = view->handlerArg; - RtlLeaveCriticalSection( &csVirtual ); - if (proc( arg, addr )) ret = 0; /* handled */ - return ret; - } - else - { - BYTE vprot = view->prot[((const char *)addr - (const char *)view->base) >> page_shift]; - void *page = (void *)((UINT_PTR)addr & ~page_mask); - char *stack = NtCurrentTeb()->Tib.StackLimit; - if (vprot & VPROT_GUARD) - { - VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD ); - ret = STATUS_GUARD_PAGE_VIOLATION; - } - /* is it inside the stack guard page? */ - if (((const char *)addr >= stack) && ((const char *)addr < stack + (page_mask+1))) - ret = STATUS_STACK_OVERFLOW; + VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD ); + ret = STATUS_GUARD_PAGE_VIOLATION; } + /* is it inside the stack guard page? */ + if (((const char *)addr >= stack) && ((const char *)addr < stack + (page_mask+1))) + ret = STATUS_STACK_OVERFLOW; } RtlLeaveCriticalSection( &csVirtual ); return ret; -- 2.11.4.GIT