[KERNEL32]

- Small performance improvement : Directly reference dll when getting its handle instead of just checking it's there and then load it

svn path=/trunk/; revision=54283
This commit is contained in:
Jérôme Gardou 2011-11-02 23:37:38 +00:00
parent b9abf0ef06
commit b63701a2c9
5 changed files with 13 additions and 4 deletions

View file

@ -85,7 +85,7 @@
@ stdcall LdrFindResource_U(long ptr long ptr)
//@ stdcall LdrFlushAlternateResourceModules
@ stdcall LdrGetDllHandle(wstr long ptr ptr)
//@ stdcall LdrGetDllHandleEx
@ stdcall LdrGetDllHandleEx(long wstr long ptr ptr)
@ stdcall LdrGetProcedureAddress(ptr ptr long ptr)
//@ stdcall LdrHotPatchRoutine
//@ stdcall LdrInitShimEngineDynamic

View file

@ -83,7 +83,7 @@
@ stdcall LdrFindResource_U(long ptr long ptr)
;@ stdcall LdrFlushAlternateResourceModules
@ stdcall LdrGetDllHandle(wstr long ptr ptr)
;@ stdcall LdrGetDllHandleEx
@ stdcall LdrGetDllHandleEx(long wstr long ptr ptr)
@ stdcall LdrGetProcedureAddress(ptr ptr long ptr)
;@ stdcall LdrHotPatchRoutine
;@ stdcall LdrInitShimEngineDynamic

View file

@ -413,13 +413,13 @@ LoadLibraryExW(LPCWSTR lpLibFileName,
if (dwFlags & LOAD_LIBRARY_AS_DATAFILE)
{
/* If the image is loaded as a datafile, try to get its handle */
Status = LdrGetDllHandle(SearchPath, NULL, &DllName, (PVOID*)&hInst);
Status = LdrGetDllHandleEx(0, SearchPath, NULL, &DllName, (PVOID*)&hInst);
if (!NT_SUCCESS(Status))
{
/* It's not loaded yet - so load it up */
Status = BasepLoadLibraryAsDatafile(SearchPath, DllName.Buffer, &hInst);
_SEH2_YIELD(goto done;)
}
_SEH2_YIELD(goto done;)
}
/* Call the API Properly */

View file

@ -216,6 +216,14 @@ LdrGetDllHandle(
OUT PVOID *DllHandle
);
NTSTATUS
NTAPI
LdrGetDllHandleEx(IN ULONG Flags,
IN PWSTR DllPath OPTIONAL,
IN PULONG DllCharacteristics OPTIONAL,
IN PUNICODE_STRING DllName,
OUT PVOID *DllHandle OPTIONAL);
NTSTATUS
NTAPI
LdrFindEntryForAddress(

View file

@ -1813,6 +1813,7 @@ NTSTATUS WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void
NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);
NTSTATUS WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*);
NTSTATUS WINAPI LdrGetDllHandleEx(ULONG,PWSTR,PULONG,PUNICODE_STRING,PVOID);
NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
void WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);