Example #1
0
 private void WriteData(ResourceDirectory directory)
 {
     foreach (ResourceEntry entry in directory.Entries)
     {
         if (entry.Data != null)
         {
             win32_resources.WriteBytes(entry.Data);
             win32_resources.Align(4);
         }
         else
         {
             WriteData(entry.Directory);
         }
     }
 }
Example #2
0
 private void WriteWin32ResourcesDirectory(ResourceDirectory directory)
 {
     win32_resources = new ByteBuffer();
     if (directory.Entries.Count != 0)
     {
         int stringTableOffset            = GetDirectoryLength(directory);
         Dictionary <string, int> strings = new Dictionary <string, int>();
         ByteBuffer stringTable           = new ByteBuffer(16);
         int        offset = 16 + directory.Entries.Count * 8;
         for (int pass = 0; pass < 3; pass++)
         {
             Write(directory, pass, 0, ref offset, strings, ref stringTableOffset, stringTable);
         }
         // the pecoff spec says that the string table is between the directory entries and the data entries,
         // but the windows linker puts them after the data entries, so we do too.
         stringTable.Align(4);
         offset += stringTable.length;
         WriteResourceDataEntries(directory, ref offset);
         win32_resources.WriteBytes(stringTable);
         WriteData(directory);
     }
 }
Example #3
0
 private void WriteWin32ResourcesDirectory(ResourceDirectory directory)
 {
     win32_resources = new ByteBuffer();
     if (directory.Entries.Count != 0)
     {
         int stringTableOffset = GetDirectoryLength(directory);
         Dictionary<string, int> strings = new Dictionary<string, int>();
         ByteBuffer stringTable = new ByteBuffer(16);
         int offset = 16 + directory.Entries.Count * 8;
         for (int pass = 0; pass < 3; pass++)
             Write(directory, pass, 0, ref offset, strings, ref stringTableOffset, stringTable);
         // the pecoff spec says that the string table is between the directory entries and the data entries,
         // but the windows linker puts them after the data entries, so we do too.
         stringTable.Align(4);
         offset += stringTable.length;
         WriteResourceDataEntries(directory, ref offset);
         win32_resources.WriteBytes(stringTable);
         WriteData(directory);
     }
 }