コード例 #1
0
        PeDosHeaderDataImpl(HexBufferSpan span)
            : base(span)
        {
            var buffer = span.Buffer;
            var pos    = span.Start.Position;

            Magic    = new StructField <UInt16Data>("e_magic", new UInt16Data(buffer, pos + 0));
            Cblp     = new StructField <UInt16Data>("e_cblp", new UInt16Data(buffer, pos + 2));
            Cp       = new StructField <UInt16Data>("e_cp", new UInt16Data(buffer, pos + 4));
            Crlc     = new StructField <UInt16Data>("e_crlc", new UInt16Data(buffer, pos + 6));
            Cparhdr  = new StructField <UInt16Data>("e_cparhdr", new UInt16Data(buffer, pos + 8));
            Minalloc = new StructField <UInt16Data>("e_minalloc", new UInt16Data(buffer, pos + 0x0A));
            Maxalloc = new StructField <UInt16Data>("e_maxalloc", new UInt16Data(buffer, pos + 0x0C));
            Ss       = new StructField <UInt16Data>("e_ss", new UInt16Data(buffer, pos + 0x0E));
            Sp       = new StructField <UInt16Data>("e_sp", new UInt16Data(buffer, pos + 0x10));
            Csum     = new StructField <UInt16Data>("e_csum", new UInt16Data(buffer, pos + 0x12));
            Ip       = new StructField <UInt16Data>("e_ip", new UInt16Data(buffer, pos + 0x14));
            Cs       = new StructField <UInt16Data>("e_cs", new UInt16Data(buffer, pos + 0x16));
            Lfarlc   = new StructField <UInt16Data>("e_lfarlc", new UInt16Data(buffer, pos + 0x18));
            Ovno     = new StructField <UInt16Data>("e_ovno", new UInt16Data(buffer, pos + 0x1A));
            Res      = new StructField <ArrayData <UInt16Data> >("e_res", ArrayData.CreateUInt16Array(buffer, pos + 0x1C, 4));
            Oemid    = new StructField <UInt16Data>("e_oemid", new UInt16Data(buffer, pos + 0x24));
            Oeminfo  = new StructField <UInt16Data>("e_oeminfo", new UInt16Data(buffer, pos + 0x26));
            Res2     = new StructField <ArrayData <UInt16Data> >("e_res2", ArrayData.CreateUInt16Array(buffer, pos + 0x28, 10));
            Lfanew   = new StructField <FileOffsetData>("e_lfanew", new FileOffsetData(buffer, pos + 0x3C));
            Fields   = new StructField[] {
                Magic,
                Cblp,
                Cp,
                Crlc,
                Cparhdr,
                Minalloc,
                Maxalloc,
                Ss,
                Sp,
                Csum,
                Ip,
                Cs,
                Lfarlc,
                Ovno,
                Res,
                Oemid,
                Oeminfo,
                Res2,
                Lfanew,
            };
        }