Alexandre Julliard : kernel32/tests: Load GetMappedFileNameW() dynamically.

Alexandre Julliard julliard at winehq.org
Fri Feb 12 14:37:38 CST 2021


Module: wine
Branch: master
Commit: 75030285da81e154daccba5c4ad307c69c866c1d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=75030285da81e154daccba5c4ad307c69c866c1d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Feb 12 18:20:29 2021 +0100

kernel32/tests: Load GetMappedFileNameW() dynamically.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/debugger.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index 118984eec75..d8eb61fceab 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -26,7 +26,6 @@
 #include <windows.h>
 #include <winternl.h>
 #include <winreg.h>
-#include <psapi.h>
 #include "wine/test.h"
 #include "wine/heap.h"
 #include "wine/rbtree.h"
@@ -51,6 +50,7 @@ static NTSTATUS  (WINAPI *pNtSetInformationDebugObject)(HANDLE,DEBUGOBJECTINFOCL
 static NTSTATUS  (WINAPI *pDbgUiConnectToDbg)(void);
 static HANDLE    (WINAPI *pDbgUiGetThreadDebugObject)(void);
 static void      (WINAPI *pDbgUiSetThreadDebugObject)(HANDLE);
+static DWORD     (WINAPI *pGetMappedFileNameW)(HANDLE,void*,WCHAR*,DWORD);
 
 static LONG child_failures;
 
@@ -909,7 +909,7 @@ static void check_dll_event( HANDLE process, DEBUG_EVENT *ev )
     case CREATE_PROCESS_DEBUG_EVENT:
         break;
     case LOAD_DLL_DEBUG_EVENT:
-        if (!GetMappedFileNameW( process, ev->u.LoadDll.lpBaseOfDll, module, MAX_PATH )) module[0] = 0;
+        if (!pGetMappedFileNameW( process, ev->u.LoadDll.lpBaseOfDll, module, MAX_PATH )) module[0] = 0;
         if ((p = wcsrchr( module, '\\' ))) p++;
         else p = module;
         if (!wcsicmp( p, L"ole32.dll" )) ole32_mod = ev->u.LoadDll.lpBaseOfDll;
@@ -1954,7 +1954,9 @@ START_TEST(debugger)
 
     hdll=GetModuleHandleA("kernel32.dll");
     pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent");
-
+    pGetMappedFileNameW = (void*)GetProcAddress(hdll, "GetMappedFileNameW");
+    if (!pGetMappedFileNameW) pGetMappedFileNameW = (void*)GetProcAddress(LoadLibraryA("psapi.dll"),
+                                                                          "GetMappedFileNameW");
     ntdll = GetModuleHandleA("ntdll.dll");
     pDbgBreakPoint = (void*)GetProcAddress(ntdll, "DbgBreakPoint");
     pNtSuspendProcess = (void*)GetProcAddress(ntdll, "NtSuspendProcess");




More information about the wine-cvs mailing list