forkables: use dynloaded dll's IndexNumber as dirname

This commit is contained in:
Michael Haubenwallner 2017-01-12 10:03:52 +01:00 committed by Corinna Vinschen
parent 6dd415caf5
commit 8bbb3d3a23
1 changed files with 8 additions and 25 deletions

View File

@ -409,34 +409,17 @@ dll::nominate_forkable (PCWCHAR dirx_name)
if (!*forkable_ntname) if (!*forkable_ntname)
return; /* denominate */ return; /* denominate */
if (type < DLL_LOAD) if (type == DLL_LOAD)
wcpcpy (next, modname);
else
{ {
/* Avoid lots of extra directories for loaded dll's: /* Multiple dynamically loaded dlls can have identical basenames
* mangle full path into one single directory name, * when loaded from different directories. But still the original
* just keep original filename intact. The original * basename may serve as linked dependency for another dynamically
* filename is necessary to serve as linked * loaded dll. So we have to create a separate directory for the
* dependencies of dynamically loaded dlls. */ * dynamically loaded dll - using the dll's IndexNumber as name. */
PWCHAR lastpathsep = wcsrchr (ntname, L'\\');
if (!lastpathsep)
{
forkable_ntname = NULL;
return;
}
*lastpathsep = L'\0';
HANDLE fh = dll_list::ntopenfile (ntname, NULL, FILE_DIRECTORY_FILE);
*lastpathsep = L'\\';
FILE_INTERNAL_INFORMATION fii = { 0 };
if (fh != INVALID_HANDLE_VALUE)
{
dll_list::read_fii (fh, &fii);
NtClose (fh);
}
next += format_IndexNumber (next, -1, &fii.IndexNumber); next += format_IndexNumber (next, -1, &fii.IndexNumber);
wcpcpy (next, lastpathsep); next = wcpcpy (next, L"\\");
} }
wcpcpy (next, modname);
} }
/* Create the nominated hardlink for one indivitual dll, /* Create the nominated hardlink for one indivitual dll,