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:
Michael Haubenwallner
2016-12-07 11:58:25 +01:00
committed by Corinna Vinschen
parent 9fa22dba55
commit 2678c4efe1
3 changed files with 187 additions and 69 deletions

View File

@@ -175,21 +175,18 @@ frok::child (volatile char * volatile here)
if (fixup_shms_after_fork ())
api_fatal ("recreate_shm areas after fork failed");
/* If we haven't dynamically loaded any dlls, just signal
the parent. Otherwise, load all the dlls, tell the parent
that we're done, and wait for the parent to fill in the.
loaded dlls' data/bss. */
/* load dynamic dlls, if any */
dlls.load_after_fork (hParent);
cygheap->fdtab.fixup_after_fork (hParent);
/* If we haven't dynamically loaded any dlls, just signal the parent.
Otherwise, tell the parent that we've loaded all the dlls
and wait for the parent to fill in the loaded dlls' data/bss. */
if (!load_dlls)
{
cygheap->fdtab.fixup_after_fork (hParent);
sync_with_parent ("performed fork fixup", false);
}
sync_with_parent ("performed fork fixup", false);
else
{
dlls.load_after_fork (hParent);
cygheap->fdtab.fixup_after_fork (hParent);
sync_with_parent ("loaded dlls", true);
}
sync_with_parent ("loaded dlls", true);
init_console_handler (myself->ctty > 0);
ForceCloseHandle1 (fork_info->forker_finished, forker_finished);
@@ -303,8 +300,6 @@ frok::parent (volatile char * volatile stack_here)
si.lpReserved2 = (LPBYTE) &ch;
si.cbReserved2 = sizeof (ch);
syscall_printf ("CreateProcessW (%W, %W, 0, 0, 1, %y, 0, 0, %p, %p)",
myself->progname, myself->progname, c_flags, &si, &pi);
bool locked = __malloc_lock ();
/* Remove impersonation */
@@ -315,6 +310,9 @@ frok::parent (volatile char * volatile stack_here)
while (1)
{
syscall_printf ("CreateProcessW (%W, %W, 0, 0, 1, %y, 0, 0, %p, %p)",
myself->progname, myself->progname, c_flags, &si, &pi);
hchild = NULL;
rc = CreateProcessW (myself->progname, /* image to run */
GetCommandLineW (), /* Take same space for command