[PATCH 4/4] ntdll: Print a warning when LdrGetProcedureAddress fails

Alex Henrie alexhenrie24 at gmail.com
Sun Jun 7 23:41:19 CDT 2020


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
This will help tremendously with debugging null pointer segfaults.
---
 dlls/ntdll/loader.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index d1b71efc07..2c37135105 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1865,6 +1865,17 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
     }
 
     RtlLeaveCriticalSection( &loader_section );
+
+    if (__WINE_GET_DEBUGGING_WARN( __wine_dbch___default ) && module && (name || ord) && !*address)
+    {
+        WCHAR path_buffer[MAX_PATH];
+        UNICODE_STRING module_path = { 0, sizeof(path_buffer), path_buffer };
+        path_buffer[0] = 0;
+        LdrGetDllFullName( module, &module_path );
+        WARN( "function %s (ordinal %d) not found in module %s\n",
+              wine_dbgstr_a(name ? name->Buffer : NULL), ord, wine_dbgstr_w(path_buffer) );
+    }
+
     return ret;
 }
 
-- 
2.27.0




More information about the wine-devel mailing list