From 3e0c6c79949564f8c28949232fcbc24c69be91db Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 13 Nov 2004 13:09:07 +0000 Subject: [PATCH] implemented MmGetSystemRoutineAddress() svn path=/trunk/; revision=11643 --- reactos/ntoskrnl/ldr/loader.c | 6 +++--- reactos/ntoskrnl/mm/mm.c | 36 +++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/ldr/loader.c b/reactos/ntoskrnl/ldr/loader.c index 2063db2ffb3..c0f421715c7 100644 --- a/reactos/ntoskrnl/ldr/loader.c +++ b/reactos/ntoskrnl/ldr/loader.c @@ -1,4 +1,4 @@ -/* $Id: loader.c,v 1.150 2004/10/26 10:56:38 ekohl Exp $ +/* $Id: loader.c,v 1.151 2004/11/13 13:09:07 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -43,8 +43,8 @@ LIST_ENTRY ModuleListHead; KSPIN_LOCK ModuleListLock; -STATIC MODULE_OBJECT NtoskrnlModuleObject; -STATIC MODULE_OBJECT HalModuleObject; +MODULE_OBJECT NtoskrnlModuleObject; +MODULE_OBJECT HalModuleObject; LIST_ENTRY ModuleTextListHead; STATIC MODULE_TEXT_SECTION NtoskrnlTextSection; diff --git a/reactos/ntoskrnl/mm/mm.c b/reactos/ntoskrnl/mm/mm.c index dc6bc448069..e63506ade45 100644 --- a/reactos/ntoskrnl/mm/mm.c +++ b/reactos/ntoskrnl/mm/mm.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: mm.c,v 1.79 2004/10/22 20:38:22 ekohl Exp $ +/* $Id: mm.c,v 1.80 2004/11/13 13:09:07 weiden Exp $ * * COPYRIGHT: See COPYING in the top directory * PROJECT: ReactOS kernel @@ -35,6 +35,9 @@ /* GLOBALS *****************************************************************/ +extern MODULE_OBJECT NtoskrnlModuleObject; +extern MODULE_OBJECT HalModuleObject; + PVOID EXPORTED MmUserProbeAddress = NULL; PVOID EXPORTED MmHighestUserAddress = NULL; PBOOLEAN EXPORTED Mm64BitPhysicalAddress = FALSE; @@ -496,7 +499,7 @@ MmSetAddressRangeModified ( } /* - * @unimplemented + * @implemented */ PVOID NTKERNELAPI @@ -504,8 +507,33 @@ MmGetSystemRoutineAddress ( IN PUNICODE_STRING SystemRoutineName ) { - UNIMPLEMENTED; - return 0; + PVOID ProcAddress; + ANSI_STRING AnsiRoutineName; + NTSTATUS Status; + + if(!NT_SUCCESS(RtlUnicodeStringToAnsiString(&AnsiRoutineName, + SystemRoutineName, + TRUE))) + { + return NULL; + } + + Status = LdrGetProcedureAddress(NtoskrnlModuleObject.Base, + &AnsiRoutineName, + 0, + &ProcAddress); + + if(!NT_SUCCESS(Status)) + { + Status = LdrGetProcedureAddress(HalModuleObject.Base, + &AnsiRoutineName, + 0, + &ProcAddress); + } + + RtlFreeAnsiString(&AnsiRoutineName); + + return (NT_SUCCESS(Status) ? ProcAddress : NULL); } /* EOF */