[PATCH] Implement MmGetSystemRoutineAddress
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon Nov 17 04:01:10 CST 2008
---
dlls/ntoskrnl.exe/ntoskrnl.c | 36 +++++++++++++++++++++++++++++++++++
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
2 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index e4b0ea5..7e514b1 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -1071,6 +1071,42 @@ NTSTATUS WINAPI PsSetCreateProcessNotifyRoutine( PCREATE_PROCESS_NOTIFY_ROUTINE
return STATUS_SUCCESS;
}
+/***********************************************************************
+ * MmGetSystemRoutineAddress (NTOSKRNL.EXE.@)
+ */
+PVOID WINAPI MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName)
+{
+ HMODULE hMod;
+ STRING routineNameA;
+ PVOID pFunc = NULL;
+
+ static const WCHAR ntoskrnlW[] = {'n','t','o','s','k','r','n','l','.','e','x','e',0};
+ static const WCHAR halW[] = {'h','a','l','.','d','l','l',0};
+
+ TRACE( "%s\n", debugstr_us( SystemRoutineName));
+
+ if (!SystemRoutineName || !SystemRoutineName->Buffer|| !SystemRoutineName->Length)
+ return NULL;
+
+ if (RtlUnicodeStringToAnsiString( &routineNameA, SystemRoutineName, TRUE) == STATUS_SUCCESS)
+ {
+ /* We only support functions exported from ntoskrnl.exe or hal.dll */
+ hMod = GetModuleHandleW( ntoskrnlW);
+ pFunc = GetProcAddress( hMod, routineNameA.Buffer);
+
+ if (!pFunc)
+ {
+ hMod = GetModuleHandleW( halW);
+ pFunc = GetProcAddress( hMod, routineNameA.Buffer);
+ }
+
+ RtlFreeAnsiString( &routineNameA);
+ }
+
+ TRACE( "Function addresss %p\n", pFunc);
+
+ return pFunc;
+}
/*****************************************************
* DllMain
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 7d543d4..9303d03 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -675,7 +675,7 @@
@ stub MmFreePagesFromMdl
@ stub MmGetPhysicalAddress
@ stub MmGetPhysicalMemoryRanges
-@ stub MmGetSystemRoutineAddress
+@ stdcall MmGetSystemRoutineAddress(ptr)
@ stub MmGetVirtualForPhysical
@ stub MmGrowKernelStack
@ stub MmHighestUserAddress
--
1.5.4.3
--------------020701070900070503070902--
More information about the wine-patches
mailing list