Commit 4f2ed66a authored by Alexandre Julliard's avatar Alexandre Julliard

server: Use TEB->ArbitraryUserPointer to store the loaded dll names.

parent bd0a3c1a
......@@ -2641,6 +2641,7 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
HANDLE mapping = 0;
SECTION_IMAGE_INFORMATION image_info;
NTSTATUS nts;
void *prev;
TRACE( "looking for %s in %s\n", debugstr_w(libname), debugstr_w(load_path) );
......@@ -2662,6 +2663,9 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, &nt_name );
prev = NtCurrentTeb()->Tib.ArbitraryUserPointer;
NtCurrentTeb()->Tib.ArbitraryUserPointer = nt_name.Buffer + 4;
switch (nts)
{
case STATUS_INVALID_IMAGE_NOT_MZ: /* not in PE format, maybe it's a .so file */
......@@ -2748,6 +2752,7 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
}
break;
}
NtCurrentTeb()->Tib.ArbitraryUserPointer = prev;
done:
if (nts == STATUS_SUCCESS)
......
......@@ -131,6 +131,13 @@ static const struct object_ops debug_obj_ops =
debug_obj_destroy /* destroy */
};
/* get a pointer to TEB->ArbitraryUserPointer in the client address space */
static client_ptr_t get_teb_user_ptr( struct thread *thread )
{
unsigned int ptr_size = (CPU_FLAG( thread->process->cpu ) & CPU_64BIT_MASK) ? 8 : 4;
return thread->teb + 5 * ptr_size;
}
/* routines to build an event according to its type */
......@@ -181,7 +188,7 @@ static void fill_load_dll_event( struct debug_event *event, const void *arg )
event->data.load_dll.dbg_offset = image_info->dbg_offset;
event->data.load_dll.dbg_size = image_info->dbg_size;
event->data.load_dll.name = dll->name;
event->data.load_dll.name = get_teb_user_ptr( event->sender );
event->file = get_view_file( view, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE );
}
......
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