aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/dll_init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r--winsup/cygwin/dll_init.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 2204533..90b3940 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -300,6 +300,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
PWCHAR ntname = nt_max_path_buf ();
GetModuleFileNameW (h, ntname, NT_MAX_PATH);
PWCHAR modname = form_ntname (ntname, NT_MAX_PATH, ntname);
+ DWORD ntnamelen = modname - ntname;
while (modname > ntname && *(modname - 1) != L'\\')
--modname;
@@ -334,6 +335,12 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
}
else
{
+ size_t forkntsize = forkable_ntnamesize (type, ntname, modname);
+
+ /* FIXME: Change this to new at some point. */
+ d = (dll *) cmalloc (HEAP_2_DLL, sizeof (*d)
+ + ((ntnamelen + forkntsize) * sizeof (*ntname)));
+
/* Now we've allocated a block of information. Fill it in with the
supplied info about this DLL. */
wcscpy (d->ntname, ntname);
@@ -348,6 +355,15 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
d->image_size = ((pefile*)h)->optional_hdr ()->SizeOfImage;
d->preferred_base = (void*) ((pefile*)h)->optional_hdr()->ImageBase;
d->type = type;
+ d->fbi.FileAttributes = INVALID_FILE_ATTRIBUTES;
+ d->fii.IndexNumber.QuadPart = -1LL;
+ if (!forkntsize)
+ d->forkable_ntname = NULL;
+ else
+ {
+ d->forkable_ntname = d->ntname + ntnamelen + 1;
+ *d->forkable_ntname = L'\0';
+ }
append (d);
if (type == DLL_LOAD)
loaded_dlls++;
@@ -654,6 +670,8 @@ dll_list::reserve_space ()
void
dll_list::load_after_fork (HANDLE parent)
{
+ release_forkables ();
+
// moved to frok::child for performance reasons:
// dll_list::reserve_space();