Commit 5a96399b authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

ntdll: Implement LdrEnumerateLoadedModules.

parent e5ad8ae1
......@@ -62,6 +62,7 @@ WINE_DECLARE_DEBUG_CHANNEL(pid);
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID ((ULONG_PTR)2)
typedef DWORD (CALLBACK *DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
typedef void (CALLBACK *LDRENUMPROC)(LDR_MODULE *, void *, BOOLEAN *);
static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
......@@ -1394,6 +1395,34 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod)
}
/******************************************************************
* LdrEnumerateLoadedModules (NTDLL.@)
*/
NTSTATUS WINAPI LdrEnumerateLoadedModules( void *unknown, LDRENUMPROC callback, void *context )
{
LIST_ENTRY *mark, *entry;
LDR_MODULE *mod;
BOOLEAN stop = FALSE;
TRACE( "(%p, %p, %p)\n", unknown, callback, context );
if (unknown || !callback)
return STATUS_INVALID_PARAMETER;
RtlEnterCriticalSection( &loader_section );
mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
for (entry = mark->Flink; entry != mark; entry = entry->Flink)
{
mod = CONTAINING_RECORD( entry, LDR_MODULE, InMemoryOrderModuleList );
callback( mod, context, &stop );
if (stop) break;
}
RtlLeaveCriticalSection( &loader_section );
return STATUS_SUCCESS;
}
/******************************************************************
* LdrLockLoaderLock (NTDLL.@)
*
* Note: some flags are not implemented.
......
......@@ -62,7 +62,7 @@
# @ stub LdrDestroyOutOfProcessImage
@ stdcall LdrDisableThreadCalloutsForDll(long)
@ stub LdrEnumResources
# @ stub LdrEnumerateLoadedModules
@ stdcall LdrEnumerateLoadedModules(ptr ptr ptr)
# @ stub LdrFindCreateProcessManifest
@ stdcall LdrFindEntryForAddress(ptr ptr)
@ stdcall LdrFindResourceDirectory_U(long ptr long ptr)
......
......@@ -2181,7 +2181,7 @@ static void test_LdrEnumerateLoadedModules(void)
if (!pLdrEnumerateLoadedModules)
{
skip("LdrEnumerateLoadedModules not available\n");
win_skip("LdrEnumerateLoadedModules not available\n");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment