=?UTF-8?Q?Michael=20M=C3=BCller=20?=: ntdll: Implement LdrEnumerateLoadedModules.
Alexandre Julliard
julliard at winehq.org
Mon May 1 16:38:04 CDT 2017
Module: wine
Branch: master
Commit: 5a96399b66224a31d426084b3a57c121c1611382
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a96399b66224a31d426084b3a57c121c1611382
Author: Michael Müller <michael at fds-team.de>
Date: Fri Apr 28 17:59:41 2017 +0200
ntdll: Implement LdrEnumerateLoadedModules.
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 29 +++++++++++++++++++++++++++++
dlls/ntdll/ntdll.spec | 2 +-
dlls/ntdll/tests/rtl.c | 2 +-
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index cf75850..518a99f 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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.
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 66618fc..07944ed 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -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)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 92b7213..7176e44 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -2181,7 +2181,7 @@ static void test_LdrEnumerateLoadedModules(void)
if (!pLdrEnumerateLoadedModules)
{
- skip("LdrEnumerateLoadedModules not available\n");
+ win_skip("LdrEnumerateLoadedModules not available\n");
return;
}
More information about the wine-cvs
mailing list