Alexandre Julliard : ntdll: Encode the function pointers in the vectored handler list.
Alexandre Julliard
julliard at winehq.org
Tue Jun 28 17:25:14 CDT 2011
Module: wine
Branch: master
Commit: 30cb179fe2b9291de7ce9e8784768b70a82f593d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=30cb179fe2b9291de7ce9e8784768b70a82f593d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jun 28 08:01:48 2011 -0500
ntdll: Encode the function pointers in the vectored handler list.
---
dlls/ntdll/exception.c | 10 ++++++----
include/winternl.h | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index 41ffec9..faa9e0d 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -155,6 +155,7 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
struct list *ptr;
LONG ret = EXCEPTION_CONTINUE_SEARCH;
EXCEPTION_POINTERS except_ptrs;
+ PVECTORED_EXCEPTION_HANDLER func;
VECTORED_HANDLER *handler, *to_free = NULL;
except_ptrs.ExceptionRecord = rec;
@@ -166,14 +167,15 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
{
handler = LIST_ENTRY( ptr, VECTORED_HANDLER, entry );
handler->count++;
+ func = RtlDecodePointer( handler->func );
RtlLeaveCriticalSection( &vectored_handlers_section );
RtlFreeHeap( GetProcessHeap(), 0, to_free );
to_free = NULL;
TRACE( "calling handler at %p code=%x flags=%x\n",
- handler->func, rec->ExceptionCode, rec->ExceptionFlags );
- ret = handler->func( &except_ptrs );
- TRACE( "handler at %p returned %x\n", handler->func, ret );
+ func, rec->ExceptionCode, rec->ExceptionFlags );
+ ret = func( &except_ptrs );
+ TRACE( "handler at %p returned %x\n", func, ret );
RtlEnterCriticalSection( &vectored_handlers_section );
ptr = list_next( &vectored_handlers, ptr );
@@ -226,7 +228,7 @@ PVOID WINAPI RtlAddVectoredExceptionHandler( ULONG first, PVECTORED_EXCEPTION_HA
VECTORED_HANDLER *handler = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*handler) );
if (handler)
{
- handler->func = func;
+ handler->func = RtlEncodePointer( func );
handler->count = 1;
RtlEnterCriticalSection( &vectored_handlers_section );
if (first) list_add_head( &vectored_handlers, &handler->entry );
diff --git a/include/winternl.h b/include/winternl.h
index a1c9f0c..21879d0 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2298,6 +2298,7 @@ NTSYSAPI BOOLEAN WINAPI RtlCreateUnicodeString(PUNICODE_STRING,LPCWSTR);
NTSYSAPI BOOLEAN WINAPI RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING,LPCSTR);
NTSYSAPI NTSTATUS WINAPI RtlCreateUserThread(HANDLE,const SECURITY_DESCRIPTOR*,BOOLEAN,PVOID,SIZE_T,SIZE_T,PRTL_THREAD_START_ROUTINE,void*,HANDLE*,CLIENT_ID*);
NTSYSAPI void WINAPI RtlDeactivateActivationContext(DWORD,ULONG_PTR);
+NTSYSAPI PVOID WINAPI RtlDecodePointer(PVOID);
NTSYSAPI NTSTATUS WINAPI RtlDecompressBuffer(USHORT,PUCHAR,ULONG,PUCHAR,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI RtlDeleteAce(PACL,DWORD);
NTSYSAPI NTSTATUS WINAPI RtlDeleteAtomFromAtomTable(RTL_ATOM_TABLE,RTL_ATOM);
@@ -2326,6 +2327,7 @@ NTSYSAPI NTSTATUS WINAPI RtlDowncaseUnicodeString(UNICODE_STRING*,const UNICODE
NTSYSAPI void WINAPI RtlDumpResource(LPRTL_RWLOCK);
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int,const UNICODE_STRING*,UNICODE_STRING*);
NTSYSAPI NTSTATUS WINAPI RtlEmptyAtomTable(RTL_ATOM_TABLE,BOOLEAN);
+NTSYSAPI PVOID WINAPI RtlEncodePointer(PVOID);
NTSYSAPI NTSTATUS WINAPI RtlEnterCriticalSection(RTL_CRITICAL_SECTION *);
NTSYSAPI void WINAPI RtlEraseUnicodeString(UNICODE_STRING*);
NTSYSAPI NTSTATUS WINAPI RtlEqualComputerName(const UNICODE_STRING*,const UNICODE_STRING*);
More information about the wine-cvs
mailing list