private void WriteResourceDataEntries(ResourceDirectory directory, ref int offset) { foreach (ResourceEntry entry in directory.Entries) { if (entry.Data != null) { win32_resources.WriteUInt32((uint)(rsrc.VirtualAddress + offset)); win32_resources.WriteInt32(entry.Data.Length); win32_resources.WriteUInt32(entry.CodePage); win32_resources.WriteUInt32(entry.Reserved); offset += (entry.Data.Length + 3) & ~3; } else { WriteResourceDataEntries(entry.Directory, ref offset); } } }
void PatchRawFatSection(ByteBuffer buffer, MetadataBuilder metadata) { position--; var length = ReadInt32 (); buffer.WriteInt32 (length); var count = (length >> 8) / 24; PatchRawExceptionHandlers (buffer, metadata, count, true); }
void PatchRawFatMethod(ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, out MetadataToken local_var_token) { var flags = ReadUInt16 (); buffer.WriteUInt16 (flags); buffer.WriteUInt16 (ReadUInt16 ()); symbols.code_size = ReadInt32 (); buffer.WriteInt32 (symbols.code_size); local_var_token = ReadToken (); if (local_var_token.RID > 0) { var variables = symbols.variables = ReadVariables (local_var_token); buffer.WriteUInt32 (variables != null ? writer.GetStandAloneSignature (symbols.variables).ToUInt32 () : 0); } else buffer.WriteUInt32 (0); PatchRawCode (buffer, symbols.code_size, writer); if ((flags & 0x8) != 0) PatchRawSection (buffer, writer.metadata); }
static void PatchChecksum(Stream stream, int checksum) { stream.Seek (0xd8, SeekOrigin.Begin); var buffer = new ByteBuffer (4); buffer.WriteInt32 (checksum); stream.Write (buffer.buffer, 0, 4); }