ntoskrnl.exe: Implement MmGetSystemRoutineAddress

Dmitry Timoshkov dmitry at codeweavers.com
Mon Nov 17 03:52:24 CST 2008


"Alistair Leslie-Hughes" <leslie_alistair at hotmail.com> wrote:

> +    if(RtlUnicodeStringToAnsiString(&routineNameA, SystemRoutineName, TRUE) == STATUS_SUCCESS)
> +    {
> +        /* We only support functions exported from ntoskrnl.exe or hal.dll */
> +        hMod = GetModuleHandleW(ntoskrnlW);
> +        if(hMod)
> +        {
> +           pFunc = GetProcAddress(hMod, routineNameA.Buffer);
> +        }

You are calling GetModuleHandleW from inside of ntoskrnl.exe, how that
could fail?

> +        if(!pFunc)
> +        {
> +           hMod = GetModuleHandleW(halW);
> +           if(hMod)
> +           {
> +              pFunc = GetProcAddress(hMod, routineNameA.Buffer);
> +           }
> +        }
> +
> +        RtlFreeAnsiString(&routineNameA);
> +    }
> +
> +    TRACE("Function addresss %p\n", pFunc);
> +
> +    return pFunc;
> +}

Please follow the existing coding style, place a space after 'if' and
avoid not necessary braces for single line statements after 'if'.

-- 
Dmitry.



More information about the wine-devel mailing list