* autoload.cc (dll_load): Make inline. Clarify logic.

This commit is contained in:
Christopher Faylor 2011-02-28 20:55:10 +00:00
parent 87cd8d6d9d
commit 8ceb4854b6
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2011-02-28 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (dll_load): Make inline. Clarify logic.
2011-02-27 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (dll_load): Only call LoadLibraryExW with

View File

@ -212,13 +212,16 @@ union retchain
To wit: winmm.dll calls FreeLibrary in its DllMain and that can result
in LoadLibraryExW returning an ERROR_INVALID_ADDRESS. */
static bool
static __inline bool
dll_load (HANDLE& handle, WCHAR *name)
{
HANDLE h = LoadLibraryW (name);
if (!h && in_forkee && handle && GetLastError () == ERROR_INVALID_ADDRESS)
h = LoadLibraryExW (name, NULL, DONT_RESOLVE_DLL_REFERENCES);
return h ? (handle = h) : 0;
if (!h)
return false;
handle = h;
return true;
}
#define RETRY_COUNT 10
@ -407,7 +410,7 @@ LoadDLLfunc (LsaFreeReturnBuffer, 4, secur32)
LoadDLLfunc (LsaLogonUser, 56, secur32)
LoadDLLfunc (LsaLookupAuthenticationPackage, 12, secur32)
/* secur32 functions return NTSTATUS values. However, the error code must
fit in a single word, see LoadDLLprime.
fit in 16 bits , see LoadDLLprime.
The calling function, lsaauth(), checks for STATUS_SUCCESS (0), so we
simply return some arbitrary non-0 value (127 == ERROR_PROC_NOT_FOUND)
from here, if the function can't be loaded. */