示例#1
0
        public FShellFolder[] ListFolder()
        {
            IntPtr ptr = IntPtr.Zero;

            if (_face.EnumObjects(_handle, EShcontf.Folders | EShcontf.IncludeHidden, out ptr) == RWinShell.S_OK)
            {
                IntPtr pidlSub;
                int    celtFetched;
                FObjects <FShellFolder> folders = new FObjects <FShellFolder>();
                IEnumIDList             list    = (IEnumIDList)Marshal.GetObjectForIUnknown(ptr);
                while (list.Next(1, out pidlSub, out celtFetched) == RWinShell.S_OK)
                {
                    if (celtFetched != RWinShell.S_FALSE)
                    {
                        break;
                    }
                    FShellFolder folder = new FShellFolder();
                    folder.Parent = this;
                    folder.SetHandle(pidlSub);
                    folder.RefreshInfo();
                    folders.Push(folder);
                }
                return(folders.ToArray());
            }
            return(null);
        }
示例#2
0
        //============================================================
        // <T>刷新器。</T>
        //============================================================
        private void timRefresh_Tick(object sender, System.EventArgs e)
        {
            FObjects <FTrack> tracks = RMoCore.TrackConsole.Tracks;

            FTrack[] trackItems = null;
            lock (tracks) {
                trackItems = tracks.ToArray();
                tracks.Clear();
            }
            if (trackItems.Length > 0)
            {
                lvwTracks.BeginUpdate();
                foreach (FTrack track in trackItems)
                {
                    if (null != track)
                    {
                        ListViewItem lviTrack = new ListViewItem();
                        lviTrack.Text = track.Datetime.ToString();
                        lviTrack.SubItems.Add(track.Sender);
                        lviTrack.SubItems.Add(track.Message);
                        lvwTracks.Items.Add(lviTrack);
                    }
                }
                lvwTracks.EndUpdate();
                Show();
                BringToFront();
            }
        }
示例#3
0
        //============================================================
        // <T>查找所有选中节点集合。</T>
        //
        // @return 选中节点集合
        //============================================================
        public FObjects <TreeNode> FetchCheckedNodes()
        {
            FObjects <TreeNode> nodes = new FObjects <TreeNode>();

            FetchCheckedNodes(Nodes, nodes);
            return(nodes);
        }
示例#4
0
        public static SModuleEntry32[] ListModule(IntPtr hModule)
        {
            FObjects <SModuleEntry32>  mes       = new FObjects <SModuleEntry32>();
            Nullable <SImageNtHeaders> ntHeaders = GetNtHeaders(hModule);
            SImageDataDirectory        idd       = ntHeaders.Value.OptionalHeader.DataDirectory[(int)EImageDirectoryEntry.Import];

            if (idd.VirtualAddress == 0)
            {
                return(mes.ToArray());
            }
            // Import
            uint   maddress  = (uint)hModule.ToInt32();
            IntPtr pIdHeader = (IntPtr)(maddress + idd.VirtualAddress);
            int    idSize    = Marshal.SizeOf(typeof(SImageImportDescriptor));

            while (true)
            {
                SImageImportDescriptor impDesc = (SImageImportDescriptor)Marshal.PtrToStructure(pIdHeader, typeof(SImageImportDescriptor));
                if (impDesc.Name == 0)
                {
                    break;
                }
                IntPtr         namePtr = (IntPtr)(maddress + impDesc.Name);
                SModuleEntry32 me      = new SModuleEntry32();
                me.modBaseAddr = impDesc.FirstThunk;
                me.szModule    = Marshal.PtrToStringAnsi(namePtr, 260);
                mes.Push(me);
                pIdHeader = (IntPtr)(pIdHeader.ToInt32() + idSize);
            }
            return(mes.ToArray());
        }
示例#5
0
        //============================================================
        // <T>选中改变状态事件。</T>
        //
        // @param sender 事件产生者
        // @param e      数据对象
        //============================================================
        public FObjects <FRsResource> SeletedResource()
        {
            FObjects <FRsResource> resources = new FObjects <FRsResource>();

            SelectedResource(Nodes, resources);
            return(resources);
        }
示例#6
0
        public static FProcessInfo[] Fetch()
        {
            IntPtr hSnap = RKernel32.CreateToolhelp32Snapshot(ETh32cs.SnapProcess, 0);

            if (!RApi.IsValidHandle(hSnap))
            {
                return(null);
            }
            FObjects <FProcessInfo> process = new FObjects <FProcessInfo>();
            SProcessEntry32         pe32    = new SProcessEntry32();

            pe32.dwSize = (uint)Marshal.SizeOf(pe32);
            bool next = RKernel32.Process32First(hSnap, ref pe32);

            while (next)
            {
                FProcessInfo info = new FProcessInfo();
                info.Id       = pe32.th32ProcessID;
                info.Threads  = (int)pe32.cntThreads;
                info.FileName = pe32.szExeFile;
                process.Push(info);
                next = RKernel32.Process32Next(hSnap, ref pe32);
            }
            RKernel32.CloseHandle(hSnap);
            return(process.ToArray());
        }
示例#7
0
        //============================================================
        // <T>选中导出事件。</T>
        //
        // @author TYFNG 20120406
        //============================================================
        public void SaveSelected()
        {
            FObjects <FRsResource> resources = qdsCatalog.SeletedResource();

            foreach (FRsResource resource in resources)
            {
                resource.Store();
            }
            MessageBox.Show("保存成功!");
        }
示例#8
0
        //============================================================
        // <T>选中导出事件。</T>
        //
        // @author TYFNG 20120406
        //============================================================
        public void ExportSelected(ERsExportMode modeCd)
        {
            FObjects <FRsResource> resources = qdsCatalog.SeletedResource();

            foreach (FRsResource resource in resources)
            {
                FRsExportTask task = new FRsExportTask();
                task.ModeCd   = modeCd;
                task.Exporter = resource;
                RMoCore.TaskConsole.Push(task);
            }
        }
示例#9
0
        public static Encoding[] DetectInputAllCodepages(byte[] input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (input.Length == 0)
            {
                return(new Encoding[] { Encoding.ASCII });
            }
            if (input.Length < 256)
            {
                byte[] newInput = new byte[256];
                int    steps    = 256 / input.Length;
                for (int i = 0; i < steps; i++)
                {
                    Array.Copy(input, 0, newInput, input.Length * i, input.Length);
                }
                int rest = 256 % input.Length;
                if (rest > 0)
                {
                    Array.Copy(input, 0, newInput, steps * input.Length, rest);
                }
                input = newInput;
            }
            IMultiLanguage2 multilang2 = new FMultiLanguageClass();

            if (multilang2 == null)
            {
                throw new System.Runtime.InteropServices.COMException("Failed to get IMultilang2");
            }
            FObjects <Encoding> result = new FObjects <Encoding>();

            try {
                SDetectEncodingInfo[] detectedEncdings = new SDetectEncodingInfo[RInt.SIZE_1K];
                int         scores  = detectedEncdings.Length;
                int         srcLen  = input.Length;
                SMlDetectCp options = SMlDetectCp.MLDETECTCP_NONE;
                multilang2.DetectInputCodepage(options, 0, ref input[0], ref srcLen, ref detectedEncdings[0], ref scores);
                if (scores > 0)
                {
                    for (int i = 0; i < scores; i++)
                    {
                        result.Push(Encoding.GetEncoding((int)detectedEncdings[i].nCodePage));
                    }
                }
            } finally {
                Marshal.FinalReleaseComObject(multilang2);
            }
            return(result.ToArray());
        }
示例#10
0
 //============================================================
 // <T>查找所有选中节点集合。</T>
 //
 // @return 选中节点集合
 //============================================================
 protected void FetchCheckedNodes(TreeNodeCollection nodes, FObjects <TreeNode> checkeds)
 {
     foreach (TreeNode node in nodes)
     {
         if (node.Checked)
         {
             checkeds.Push(node);
         }
         if (node.Nodes.Count > 0)
         {
             FetchCheckedNodes(node.Nodes, checkeds);
         }
     }
 }
示例#11
0
        public FField[] GetAllFields(BindingFlags flags)
        {
            FObjects <FField> fields = new FObjects <FField>();
            Type type = _type;

            while (type != null)
            {
                foreach (FieldInfo fieldInfo in type.GetFields(flags))
                {
                    fields.Push(new FField(fieldInfo));
                }
                type = type.BaseType;
            }
            return(fields.ToArray());
        }
示例#12
0
        public FMethod[] GetAllMethods(BindingFlags flags)
        {
            FObjects <FMethod> methods = new FObjects <FMethod>();
            Type type = _type;

            while (type != null)
            {
                foreach (MethodInfo methodInfo in type.GetMethods(flags))
                {
                    methods.Push(new FMethod(methodInfo));
                }
                type = type.BaseType;
            }
            return(methods.ToArray());
        }
示例#13
0
 //============================================================
 public void SelectedResource(TreeNodeCollection nodes, FObjects <FRsResource> resources)
 {
     foreach (TreeNode node in nodes)
     {
         if (node.Checked)
         {
             FRsResource resouce = node.Tag as FRsResource;
             if (resouce != null)
             {
                 resources.Push(resouce);
             }
         }
         //SelectedResource(node.Nodes, resources);
     }
 }
示例#14
0
        //============================================================
        // <T>导入材质信息。</T>
        //============================================================
        public void ImportMaterial()
        {
            Open();
            // 获得显示列表
            FObjects <FDrSceneDisplay> displays = new FObjects <FDrSceneDisplay>();

            displays.Append(_sky.Displays);
            displays.Append(_map.Displays);
            displays.Append(_space.Displays);
            // 压缩文件
            foreach (FDrSceneDisplay display in displays)
            {
                foreach (FDrSceneMaterial sceneMaterial in display.Materials)
                {
                    // 获得场景
                    FDrMaterialGroup group    = RContent3dManager.MaterialConsole.FindGroup(sceneMaterial.Name);
                    FDrMaterial      material = group.SyncMaterial(_themeName);
                    _logger.Debug(this, "ImportMaterial", "Import material. (material={0}, theme={1})", group.Code, _themeName);
                    // 设置颜色
                    material.ColorMin   = sceneMaterial.ColorMin;
                    material.ColorMax   = sceneMaterial.ColorMax;
                    material.ColorMerge = sceneMaterial.ColorMerge;
                    material.ColorRate  = sceneMaterial.ColorRate;
                    // 设置透明
                    material.AlphaBase  = sceneMaterial.AlphaBase;
                    material.AlphaRate  = sceneMaterial.AlphaRate;
                    material.AlphaLevel = sceneMaterial.AlphaLevel;
                    material.AlphaMerge = sceneMaterial.AlphaMerge;
                    // 设置颜色
                    material.AmbientColor.Assign(sceneMaterial.AmbientColor);
                    material.DiffuseColor.Assign(sceneMaterial.DiffuseColor);
                    material.DiffuseViewColor.Assign(sceneMaterial.DiffuseViewColor);
                    material.SpecularColor.Assign(sceneMaterial.SpecularColor);
                    material.SpecularBase    = sceneMaterial.SpecularBase;
                    material.SpecularRate    = sceneMaterial.SpecularRate;
                    material.SpecularAverage = sceneMaterial.SpecularAverage;
                    material.SpecularShadow  = sceneMaterial.SpecularShadow;
                    material.SpecularViewColor.Assign(sceneMaterial.SpecularViewColor);
                    material.SpecularViewBase    = sceneMaterial.SpecularViewBase;
                    material.SpecularViewRate    = sceneMaterial.SpecularViewRate;
                    material.SpecularViewAverage = sceneMaterial.SpecularViewAverage;
                    material.SpecularViewShadow  = sceneMaterial.SpecularViewShadow;
                    // 存储资源组
                    group.Store();
                }
            }
            _logger.Debug(this, "Export", "Export scene success. (file_name={0})", _exportFileName);
        }
示例#15
0
        //============================================================
        // <T>按照选中保存。</T>
        //============================================================
        public void SaveSelect()
        {
            FObjects <TreeNode> checkeds = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in checkeds)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (null != folder)
                {
                    FDrTexture texture = folder.Tag as FDrTexture;
                    if (null != texture)
                    {
                        texture.Store();
                    }
                }
            }
        }
示例#16
0
        //============================================================
        // <T>按照选中保存。</T>
        //============================================================
        public void SaveSelect()
        {
            FObjects <TreeNode> nodes = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in nodes)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (folder != null)
                {
                    FDrModel model = folder.Tag as FDrModel;
                    if (null != model)
                    {
                        model.Store();
                    }
                }
            }
        }
示例#17
0
        //============================================================
        // <T>打开资源。</T>
        //============================================================
        public void ExportSelected()
        {
            FObjects <TreeNode> checkeds = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in checkeds)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (null != folder)
                {
                    FDrTexture texture = folder.Tag as FDrTexture;
                    if (null != texture)
                    {
                        RContent3dManager.TextureConsole.TaskExport(texture);
                    }
                }
            }
        }
示例#18
0
        //============================================================
        // <T>选中改变状态事件。</T>
        //
        // @param sender 事件产生者
        // @param e      数据对象
        //============================================================
        public FObjects <FRsResourceGroup> SeletedResource()
        {
            FObjects <FRsResourceGroup> groupList = new FObjects <FRsResourceGroup>();

            foreach (TreeNode node in Nodes)
            {
                FRsResourceGroup group = node.Tag as FRsResourceGroup;
                if (node.Checked)
                {
                    groupList.Push(group);
                }
            }
            return(groupList);
            //          FObjects<FDsResource> resources = new FObjects<FDsResource>();
            //          SelectedResource(Nodes, resources);
            //          return resources;
        }
示例#19
0
        //============================================================
        // <T>按照选中保存。</T>
        //============================================================
        public void SaveSelect()
        {
            FObjects <TreeNode> nodes = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in nodes)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (folder != null)
                {
                    FDrTemplate template = folder.Tag as FDrTemplate;
                    if (null != template)
                    {
                        template.Store();
                    }
                }
            }
        }
示例#20
0
        //============================================================
        // <T>按照选中保存。</T>
        //============================================================
        public void SaveSelect()
        {
            FObjects <TreeNode> checkeds = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in checkeds)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (folder != null)
                {
                    FDrMaterialGroup material = folder.Tag as FDrMaterialGroup;
                    if (null != material)
                    {
                        material.Store();
                    }
                }
            }
        }
示例#21
0
        //============================================================
        // <T>选中导出。</T>
        //============================================================
        public void ExportSelected()
        {
            FObjects <TreeNode> nodes = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in nodes)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (null != folder)
                {
                    FDrModel model = folder.Tag as FDrModel;
                    if (null != model)
                    {
                        RContent3dManager.ModelConsole.TaskExport(model);
                    }
                }
            }
        }
示例#22
0
        /*public FFieldInfo[] GetFields(object value) {
         *       FObjects<FFieldInfo> infos = new FObjects<FFieldInfo>();
         *       if (value != null) {
         *          Type type = value.GetType();
         *          FieldInfo[] fields = type.GetFields();
         *          foreach (FieldInfo field in fields) {
         *             FFieldInfo fieldInfo = new FFieldInfo();
         *             fieldInfo.Name = field.Name;
         *             fieldInfo.Value = field.GetValue(value);
         *             collection.Push(fieldInfo);
         *          }
         *       }
         *       return collection;
         *    }*/

        public static FField[] GetFields(object value)
        {
            FObjects <FField> infos = new FObjects <FField>();

            if (value != null)
            {
                Type        type   = value.GetType();
                FieldInfo[] fields = type.GetFields();
                foreach (FieldInfo field in fields)
                {
                    FField fieldInfo = new FField();
                    fieldInfo.Name  = field.Name;
                    fieldInfo.Value = field.GetValue(value);
                    infos.Push(fieldInfo);
                }
            }
            return(infos.ToArray());
        }
示例#23
0
        //============================================================
        // <T>打开处理。</T>
        //============================================================
        public void ScanTextures()
        {
            string rootDirectory = _folder.Directory;

            foreach (INamePair <FDrTexture> pair in RContent3dManager.TextureConsole.Textures)
            {
                FDrTexture       texture       = pair.Value;
                String           name          = texture.Name;
                FDrMaterialGroup materialGroup = FindGroup(name);
                if (materialGroup != null)
                {
                    continue;
                }
                // 创建材质组
                FDrFolder             folder = texture.Folder;
                FObjects <FCfgFolder> stack  = folder.FetchFolderStack(false);
                string materialPath          = folder.FolderPath().Replace("tx-", "mt-");
                string materialDirectory     = rootDirectory + materialPath;
                RDirectory.MakeDirectories(materialDirectory);
                FDrTheme theme = RContent3dManager.ThemeConsole.DefaultTheme;
                // 创建材质组
                materialGroup                = new FDrMaterialGroup();
                materialGroup.Name           = name;
                materialGroup.ConfigFileName = materialDirectory + "/config.xml";
                // 创建材质
                FDrMaterial material = new FDrMaterial();
                material.Theme      = theme;
                material.EffectName = theme.EffectName;
                materialGroup.Materials.Push(material);
                foreach (FDrTextureBitmap bitmap in texture.Bitmaps)
                {
                    FDrMaterialTexture materialTexture = new FDrMaterialTexture();
                    materialTexture.TypeCd       = bitmap.TypeCd;
                    materialTexture.Source       = texture.Name;
                    materialTexture.SourceTypeCd = bitmap.TypeCd;
                    materialTexture.SourceIndex  = bitmap.Index;
                    materialGroup.Textures.Push(materialTexture);
                }
                // 存储材质
                materialGroup.Store();
                _materials.Set(name, materialGroup);
                _logger.Debug(this, "ScanTextures", "Create material. (name={0})", materialDirectory);
            }
        }
示例#24
0
        //============================================================
        // <T>获取层级目录集合。</T>
        //
        // @return 目录集合
        //============================================================
        public FObjects <FCfgFolder> FetchFolderStack(bool constainsSelf = true)
        {
            FObjects <FCfgFolder> stack = new FObjects <FCfgFolder>();
            FCfgFolder            find  = this;

            while (find != null)
            {
                if (constainsSelf)
                {
                    stack.Push(find);
                }
                else if (find != this)
                {
                    stack.Push(find);
                }
                find = find.Parent;
            }
            stack.Reverse();
            return(stack);
        }
示例#25
0
        //============================================================
        // <T>设置渲染过程。</T>
        //============================================================
        public override void Setup()
        {
            base.Setup();
            SIntSize size = new SIntSize(2048, 2048);
            FObjects <FDxBufferedTexture> textures = new FObjects <FDxBufferedTexture>();

            // 创建深度检测区
            _depthTexture.Device = _device;
            _depthTexture.Create(size.Width, size.Height);
            // 创建渲染目标纹理区 (标识)
            _textureFlags.Device       = _device;
            _textureFlags.NativeFormat = Format.R32G32B32A32_SInt;
            _textureFlags.Create(size.Width, size.Height);
            textures.Push(_textureFlags);
            // 创建渲染目标纹理区 (颜色,透明度)
            _textureColor.Device       = _device;
            _textureColor.NativeFormat = Format.R8G8B8A8_UNorm;
            _textureColor.Create(size.Width, size.Height);
            textures.Push(_textureColor);
            // 建立纹理列表
            _targets = textures.ToArray();
        }
示例#26
0
        //============================================================
        // <T>绘制出生点。</T>
        //============================================================
        public void DrawBirths()
        {
            FObjects <FMbMapBirth> births = _map.Births;

            if (!births.IsEmpty())
            {
                int count = births.Count;
                for (int n = 0; n < count; n++)
                {
                    FMbMapBirth birth    = births[n];
                    SIntPoint2  location = birth.Location;
                    // 获取敌机集合
                    FObjects <FMbMapBirthEnemy> enemys = birth.BirthEnemys;
                    int enemyCount = enemys.Count;
                    for (int x = 0; x < enemyCount; x++)
                    {
                        FMbMapBirthEnemy birthEnemy = enemys[x];
                        int         templateId      = birthEnemy.TemplateId;
                        FMbTplEnemy enemy           = RMobileManager.TemplateConsole.EnemyConsole.FingById(templateId);
                        int         resourceRid     = enemy.ResourceRid;
                        // 获取资源图片
                        FRsResourcePicture resource    = RContent2dManager.ResourceConsole.FindOpen(resourceRid) as FRsResourcePicture;
                        Bitmap             resourceMap = resource.Bitmap.Native;
                        // 创建绘制对象
                        FDxBitmap bitmap = null;
                        if (!_dxBitmapSet.Contains(resourceRid.ToString()))
                        {
                            bitmap = _context.Device.CreateBitmap(resourceMap);
                            _dxBitmapSet.Set(resourceRid.ToString(), bitmap);
                        }
                        else
                        {
                            bitmap = _dxBitmapSet.Get(resourceRid.ToString());
                        }
                        _context.DrawBitmap(bitmap, location.X - _location.X, location.Y - _location.Y);
                    }
                }
            }
        }
示例#27
0
        public FShellFile[] ListFile()
        {
            IntPtr ptr = IntPtr.Zero;

            if (_face.EnumObjects(_handle, EShcontf.NonFolders | EShcontf.IncludeHidden, out ptr) == RWinShell.S_OK)
            {
                IntPtr pidlSub;
                int    celtFetched;
                FObjects <FShellFile> files = new FObjects <FShellFile>();
                IEnumIDList           list  = (IEnumIDList)Marshal.GetObjectForIUnknown(ptr);
                while (list.Next(1, out pidlSub, out celtFetched) == RWinShell.S_OK && celtFetched == RWinShell.S_FALSE)
                {
                    FShellFile file = new FShellFile();
                    file.Parent = this;
                    file.SetHandle(pidlSub);
                    file.RefreshInfo();
                    files.Push(file);
                }
                return(files.ToArray());
            }
            return(null);
        }
示例#28
0
        //============================================================
        // <T>绘制层。</T>
        //============================================================
        public void DrawLayers()
        {
            FObjects <FMbMapLayer> layers = _map.Layers;

            if (!layers.IsEmpty())
            {
                int count = layers.Count;
                for (int n = 0; n < count; n++)
                {
                    FMbMapLayer layer = layers[n];
                    if (layer.OptionValid)
                    {
                        _cellSize  = layer.CellSize;
                        _cellCount = layer.CellCount;

                        FObjects <FMbMapCell> cells = layer.MapCell;
                        int cellCount = cells.Count;
                        for (int x = 0; x < cellCount; x++)
                        {
                            FMbMapCell cell       = cells[x];
                            int        resourceId = cell.ResourceId;
                            if (0 == resourceId)
                            {
                                continue;
                            }
                            SIntPoint2 cellIndex = cell.Index;

                            FMbMapTile mapTile = RMobileManager.MapTileConsole.FindMapTile(resourceId);
                            if (null != mapTile)
                            {
                                DrawMapTile(mapTile, cellIndex);
                            }
                        }
                    }
                    // 绘制方格
                    DrawLine();
                }
            }
        }
示例#29
0
        public static SModuleEntry32[] ListAll(int processId)
        {
            IntPtr hSnap = RKernel32.CreateToolhelp32Snapshot(ETh32cs.SnapModule, processId);

            if (!RApi.IsValidHandle(hSnap))
            {
                return(null);
            }
            FObjects <SModuleEntry32> modules = new FObjects <SModuleEntry32>();
            SModuleEntry32            me32    = new SModuleEntry32();

            me32.dwSize = Marshal.SizeOf(me32);
            bool next = RKernel32.Module32First(hSnap, ref me32);

            while (next)
            {
                SModuleEntry32 module = new SModuleEntry32();
                module = me32;
                modules.Push(module);
                next = RKernel32.Module32Next(hSnap, ref me32);
            }
            RKernel32.CloseHandle(hSnap);
            return(modules.ToArray());
        }
示例#30
0
        public static FTrunkInfo[] FetchTrunks(IntPtr hModule)
        {
            Nullable <SImageNtHeaders> ntHeaders = GetNtHeaders(hModule);
            SImageDataDirectory        idd       = ntHeaders.Value.OptionalHeader.DataDirectory[(int)EImageDirectoryEntry.Import];

            if (idd.VirtualAddress == 0)
            {
                return(null);
            }
            // Import
            uint   maddress  = (uint)hModule.ToInt32();
            IntPtr pIdHeader = (IntPtr)(maddress + idd.VirtualAddress);
            SImageImportDescriptor impDesc = (SImageImportDescriptor)Marshal.PtrToStructure(pIdHeader, typeof(SImageImportDescriptor));

            if (impDesc.Name == 0)
            {
                return(null);
            }
            // Get module Name
            // IntPtr moduleNamePtr = (IntPtr)(maddress + impDesc.Name);
            // Trunk
            IntPtr pOrgFt = (IntPtr)(maddress + impDesc.OriginalFirstThunk);
            IntPtr pFt    = (IntPtr)(maddress + impDesc.FirstThunk);
            int    ftSize = Marshal.SizeOf(typeof(SImageThunkData32));
            int    miSize = Marshal.SizeOf(typeof(SMemoryBasicInformation));
            FObjects <FTrunkInfo> infos = new FObjects <FTrunkInfo>();

            while (true)
            {
                SImageThunkData32 origThunk = (SImageThunkData32)Marshal.PtrToStructure(pOrgFt, typeof(SImageThunkData32));
                SImageThunkData32 realThunk = (SImageThunkData32)Marshal.PtrToStructure(pFt, typeof(SImageThunkData32));
                if (origThunk.Function == 0)
                {
                    break;
                }
                if ((origThunk.Ordinal & 0x80000000) == 0x80000000)
                {
                    break;
                }

                /*uint arrd = (uint)(maddress + origThunk.AddressOfData);
                 * if ((arrd & 0x80000000) == 0x80000000) {
                 * break;
                 * }*/
                // Read name
                IntPtr             pName  = (IntPtr)(maddress + origThunk.AddressOfData);
                SImageImportByName byName = (SImageImportByName)Marshal.PtrToStructure(pName, typeof(SImageImportByName));
                if (byName.Name[0] == 0)
                {
                    break;
                }
                // Read memory state
                SMemoryBasicInformation mbi = new SMemoryBasicInformation();
                //RKernel32.VirtualQuery((uint)pFt.ToInt32(), ref mbi, miSize);
                RKernel32.VirtualQuery(realThunk.Function, ref mbi, miSize);
                // TrunkInfo
                FTrunkInfo info = new FTrunkInfo();
                info.Name    = RAscii.GetString(byName.Name);
                info.Address = origThunk.Function;
                //info.Entry = (IntPtr)(maddress + origThunk.Function);
                info.Entry                = (IntPtr)realThunk.Function;
                info.Hint                 = byName.Hint;
                info.MemAllocationBase    = mbi.AllocationBase;
                info.MemAllocationProtect = mbi.AllocationProtect;
                info.MemBaseAddress       = mbi.BaseAddress;
                info.MemProtect           = mbi.Protect;
                info.MemRegionSize        = mbi.RegionSize;
                info.MemState             = mbi.State;
                info.MemType              = mbi.Type;
                infos.Push(info);
                // Loop
                pOrgFt = (IntPtr)(pOrgFt.ToInt32() + ftSize);
                pFt    = (IntPtr)(pFt.ToInt32() + ftSize);
            }
            return(infos.ToArray());
        }