Exemplo n.º 1
0
        private IEnumerable <NativeModule> InternalEnumProcessModules()
        {
            var flags = m_Process.Is64Bit ? ListModulesFlags.ListModules64Bit : ListModulesFlags.ListModules32Bit;

            if (!ModuleHelper.EnumProcessModules(m_Process.Handle, out var modHandles, flags))
            {
                return(Enumerable.Empty <NativeModule>());
            }
            return(modHandles.Select(h => new NativeModule(m_Process.Handle, h)));
        }
Exemplo n.º 2
0
 public NativeModule(SafeMemoryHandle hProcess, IntPtr hModule)
 {
     BaseAddress = hModule;
     FileName    = ModuleHelper.GetModuleFileName(hProcess, hModule);
     ModuleName  = string.IsNullOrEmpty(FileName) ? string.Empty : Path.GetFileName(FileName);
     if (ModuleHelper.GetModuleInformation(hProcess, hModule, out var info))
     {
         EntryPointAddress = info.EntryPoint;
         ModuleMemorySize  = (int)info.SizeOfImage.ToInt64();
     }
 }
Exemplo n.º 3
0
        private IEnumerable <NativeModule> InternalEnumProcessModules()
        {
            var flags = m_Process.Is64Bit ? ListModulesFlags.ListModules64Bit : ListModulesFlags.ListModules32Bit;

            if (!ModuleHelper.EnumProcessModules(m_Process.Handle, out var modHandles, flags))
            {
                yield break;
            }
            foreach (var handle in modHandles)
            {
                yield return(new NativeModule(m_Process.Handle, handle));
            }
        }