コード例 #1
0
ファイル: PeImageLoaderTests.cs プロジェクト: heruix/reko
        private int Given_Ilt64(params object[] import)
        {
            var rvaTable = writer.Position;

            writer.WriteBytes(0, (uint)(1 + import.Length) * 8); // Reserve space for ulongs and terminating zero.
            var strWriter = writer.Clone();                      // write strings after

            writer.Position = rvaTable;                          // rewind to beginning of table.
            foreach (object imp in import)
            {
                var s = imp as string;
                if (s != null)
                {
                    writer.WriteLeInt64((int)strWriter.Position);
                    strWriter.WriteLeInt16(0);
                    strWriter.WriteString(s, Encoding.UTF8);
                    strWriter.WriteByte(0);
                }
                else if (imp is uint)
                {
                    writer.WriteLeUInt64((ulong)imp | 0x8000000000000000);
                }
            }
            writer.WriteLeInt32(0);
            writer.Position = strWriter.Position;
            return((int)rvaTable);
        }