Exemplo n.º 1
0
        // Token: 0x06000030 RID: 48 RVA: 0x00004DB0 File Offset: 0x00002FB0
        public static IntPtr GetModuleBaseAddress(int procId, string modName)
        {
            IntPtr result = IntPtr.Zero;
            IntPtr intPtr = cwapi.CreateToolhelp32Snapshot(cwapi.SnapshotFlags.Module | cwapi.SnapshotFlags.Module32, procId);

            if (intPtr.ToInt64() != -1L)
            {
                cwapi.MODULEENTRY32 moduleentry = default(cwapi.MODULEENTRY32);
                moduleentry.dwSize = (uint)Marshal.SizeOf(typeof(cwapi.MODULEENTRY32));
                if (cwapi.Module32First(intPtr, ref moduleentry))
                {
                    while (!moduleentry.szModule.Equals(modName))
                    {
                        if (!cwapi.Module32Next(intPtr, ref moduleentry))
                        {
                            goto IL_63;
                        }
                    }
                    result = moduleentry.modBaseAddr;
                }
            }
IL_63:
            cwapi.CloseHandle(intPtr);
            return(result);
        }
Exemplo n.º 2
0
 private static extern bool Module32Next(IntPtr hSnapshot, ref cwapi.MODULEENTRY32 lpme);