dll_list: Store dll file name as full NT path.
Store loaded dll's file name as full NT path. * dll_init.h (struct dll): Rename member variable name to ntname. (struct dll_list): Declare private static member variable nt_max_path_buffer. Declare public static methods form_ntname, form_shortname. Define public static methods nt_max_path_buf, buffered_shortname. (dll_list::operator []): Use PCWCHAR rather than const PWCHAR. (dll_list::find_by_modname): Ditto. * dll_init.cc (in_load_after_fork): Define earlier in file. (struct dll_list): Rename member variable name to ntname. Define nt_max_path_buffer variable. Implement static methods form_ntname, form_shortname. (dll_list::operator []): Use PCWCHAR rather than const PWCHAR. (dll_list::find_by_modname): Ditto. (reserve_at): Ditto. (release_at): Ditto. (dll_list::alloc): Use nt_max_path_buf method instead of local buffer. Store module file name as full NT path, convert using the form_ntname static method. (dll_list::load_after_fork): Call load_after_fork_impl only when reload_on_fork is set. * fork.cc (frok::child): Call dlls.load_after_fork even without need to dynamically load dlls. (frok::parent): Move syscall_printf into the retry loop.
This commit is contained in:
committed by
Corinna Vinschen
parent
9fa22dba55
commit
2678c4efe1
@@ -58,7 +58,7 @@ struct dll
|
||||
DWORD image_size;
|
||||
void* preferred_base;
|
||||
PWCHAR modname;
|
||||
WCHAR name[1];
|
||||
WCHAR ntname[1]; /* must be the last data member */
|
||||
void detach ();
|
||||
int init ();
|
||||
void run_dtors ()
|
||||
@@ -79,11 +79,25 @@ class dll_list
|
||||
dll *hold;
|
||||
dll_type hold_type;
|
||||
static muto protect;
|
||||
/* Use this buffer under loader lock conditions only. */
|
||||
static WCHAR NO_COPY nt_max_path_buffer[NT_MAX_PATH];
|
||||
public:
|
||||
static PWCHAR form_ntname (PWCHAR ntbuf, size_t bufsize, PCWCHAR name);
|
||||
static PWCHAR form_shortname (PWCHAR shortbuf, size_t bufsize, PCWCHAR name);
|
||||
static PWCHAR nt_max_path_buf ()
|
||||
{
|
||||
return nt_max_path_buffer;
|
||||
}
|
||||
static PCWCHAR buffered_shortname (PCWCHAR name)
|
||||
{
|
||||
form_shortname (nt_max_path_buffer, NT_MAX_PATH, name);
|
||||
return nt_max_path_buffer;
|
||||
}
|
||||
|
||||
dll start;
|
||||
int loaded_dlls;
|
||||
int reload_on_fork;
|
||||
dll *operator [] (const PWCHAR name);
|
||||
dll *operator [] (PCWCHAR ntname);
|
||||
dll *alloc (HINSTANCE, per_process *, dll_type);
|
||||
dll *find (void *);
|
||||
void detach (void *);
|
||||
@@ -91,7 +105,7 @@ public:
|
||||
void load_after_fork (HANDLE);
|
||||
void reserve_space ();
|
||||
void load_after_fork_impl (HANDLE, dll* which, int retries);
|
||||
dll *find_by_modname (const PWCHAR name);
|
||||
dll *find_by_modname (PCWCHAR modname);
|
||||
void populate_deps (dll* d);
|
||||
void topsort ();
|
||||
void topsort_visit (dll* d, bool goto_tail);
|
||||
|
Reference in New Issue
Block a user