Mono.Cecil.PE.ImageReader.GetModuleKind C# (CSharp) Method

GetModuleKind() static private method

static private GetModuleKind ( ushort characteristics, ushort subsystem ) : ModuleKind
characteristics ushort
subsystem ushort
return ModuleKind
        static ModuleKind GetModuleKind(ushort characteristics, ushort subsystem)
        {
            if ((characteristics & 0x2000) != 0) // ImageCharacteristics.Dll
                return ModuleKind.Dll;

            if (subsystem == 0x2 || subsystem == 0x9) // SubSystem.WindowsGui || SubSystem.WindowsCeGui
                return ModuleKind.Windows;

            return ModuleKind.Console;
        }

Usage Example

コード例 #1
0
        private void ReadImage()
        {
            ushort num;
            ushort num1;

            if (this.BaseStream.Length < (long)128)
            {
                throw new BadImageFormatException();
            }
            if (this.ReadUInt16() != 23117)
            {
                throw new BadImageFormatException();
            }
            base.Advance(58);
            this.MoveTo(this.ReadUInt32());
            if (this.ReadUInt32() != 17744)
            {
                throw new BadImageFormatException();
            }
            this.image.Architecture = this.ReadArchitecture();
            ushort num2 = this.ReadUInt16();

            base.Advance(14);
            ushort num3 = this.ReadUInt16();

            this.ReadOptionalHeaders(out num, out num1);
            this.ReadSections(num2);
            this.ReadCLIHeader();
            this.ReadMetadata();
            this.image.Kind            = ImageReader.GetModuleKind(num3, num);
            this.image.Characteristics = (ModuleCharacteristics)num1;
        }