addDLL_PEi386 loads all DLLs twice
In addDLL_PEi386
we currently have:
for (cFlag = flags_start; cFlag < 2; cFlag++)
{
for (cFormat = 0; cFormat < 4; cFormat++)
{
snwprintf(buf, bufsize, formats[cFormat], dll_name);
instance = LoadLibraryExW(buf, NULL, flags[cFlag]);
if (instance == NULL) {
if (GetLastError() != ERROR_MOD_NOT_FOUND)
{
goto error;
}
}
else
{
break; /* We're done. DLL has been loaded. */
}
}
}
This is subtly wrong. In particular, on success we break
, which only breaks out of the first for
. Consequently we will potentially load the DLL again with a different set of flags. I believe this is harmless but certainly not ideal.