Exemple #1
0
        public LoadConfigInfo Clone()
        {
            var copy = new LoadConfigInfo();

            CopyTo(copy);

            return(copy);
        }
Exemple #2
0
 protected void CopyTo(LoadConfigInfo copy)
 {
     copy._characteristics  = _characteristics;
     copy._timeDateStamp    = _timeDateStamp;
     copy._majorVersion     = _majorVersion;
     copy._minorVersion     = _minorVersion;
     copy._globalFlagsClear = _globalFlagsClear;
     copy._globalFlagsSet   = _globalFlagsSet;
     copy._criticalSectionDefaultTimeout = _criticalSectionDefaultTimeout;
     copy._deCommitFreeBlockThreshold    = _deCommitFreeBlockThreshold;
     copy._deCommitTotalFreeThreshold    = _deCommitTotalFreeThreshold;
     copy._lockPrefixTable        = _lockPrefixTable;
     copy._maximumAllocationSize  = _maximumAllocationSize;
     copy._virtualMemoryThreshold = _virtualMemoryThreshold;
     copy._processAffinityMask    = _processAffinityMask;
     copy._processHeapFlags       = _processHeapFlags;
     copy._CSDVersion             = _CSDVersion;
     copy._reserved1      = _reserved1;
     copy._editList       = _editList;
     copy._securityCookie = _securityCookie;
     copy._SEHandlerTable = _SEHandlerTable;
     copy._SEHandlerCount = _SEHandlerCount;
 }
Exemple #3
0
        public static unsafe LoadConfigInfo Load(PEImage image)
        {
            if (image == null)
            {
                return(null);
            }

            var dd = image.Directories[DataDirectories.LoadConfigTable];

            if (dd.IsNull)
            {
                return(null);
            }

            var info = new LoadConfigInfo();

            using (var accessor = image.OpenImageToSectionData(dd.RVA))
            {
                if (image.Is32Bits)
                {
                    fixed(byte *pBuff = accessor.ReadBytes(sizeof(LoadConfigHeader32)))
                    {
                        var header = *(LoadConfigHeader32 *)pBuff;

                        info._characteristics  = header.Characteristics;
                        info._timeDateStamp    = ConvertUtils.ToDateTime(header.TimeDateStamp);
                        info._majorVersion     = header.MajorVersion;
                        info._minorVersion     = header.MinorVersion;
                        info._globalFlagsClear = header.GlobalFlagsClear;
                        info._globalFlagsSet   = header.GlobalFlagsSet;
                        info._criticalSectionDefaultTimeout = header.CriticalSectionDefaultTimeout;
                        info._deCommitFreeBlockThreshold    = header.DeCommitFreeBlockThreshold;
                        info._deCommitTotalFreeThreshold    = header.DeCommitTotalFreeThreshold;
                        info._lockPrefixTable        = header.LockPrefixTable;
                        info._maximumAllocationSize  = header.MaximumAllocationSize;
                        info._virtualMemoryThreshold = header.VirtualMemoryThreshold;
                        info._processAffinityMask    = header.ProcessAffinityMask;
                        info._processHeapFlags       = header.ProcessHeapFlags;
                        info._CSDVersion             = header.CSDVersion;
                        info._reserved1      = header.Reserved1;
                        info._editList       = header.EditList;
                        info._securityCookie = header.SecurityCookie;
                        info._SEHandlerTable = header.SEHandlerTable;
                        info._SEHandlerCount = header.SEHandlerCount;
                    }
                }
                else
                {
                    fixed(byte *pBuff = accessor.ReadBytes(sizeof(LoadConfigHeader64)))
                    {
                        var header = *(LoadConfigHeader64 *)pBuff;

                        info._characteristics  = header.Characteristics;
                        info._timeDateStamp    = ConvertUtils.ToDateTime(header.TimeDateStamp);
                        info._majorVersion     = header.MajorVersion;
                        info._minorVersion     = header.MinorVersion;
                        info._globalFlagsClear = header.GlobalFlagsClear;
                        info._globalFlagsSet   = header.GlobalFlagsSet;
                        info._criticalSectionDefaultTimeout = header.CriticalSectionDefaultTimeout;
                        info._deCommitFreeBlockThreshold    = header.DeCommitFreeBlockThreshold;
                        info._deCommitTotalFreeThreshold    = header.DeCommitTotalFreeThreshold;
                        info._lockPrefixTable        = header.LockPrefixTable;
                        info._maximumAllocationSize  = header.MaximumAllocationSize;
                        info._virtualMemoryThreshold = header.VirtualMemoryThreshold;
                        info._processAffinityMask    = header.ProcessAffinityMask;
                        info._processHeapFlags       = header.ProcessHeapFlags;
                        info._CSDVersion             = header.CSDVersion;
                        info._reserved1      = header.Reserved1;
                        info._editList       = header.EditList;
                        info._securityCookie = header.SecurityCookie;
                        info._SEHandlerTable = header.SEHandlerTable;
                        info._SEHandlerCount = header.SEHandlerCount;
                    }
                }
            }

            return(info);
        }