Example #1
0
        void PatchResourceDirectoryEntry(ByteBuffer resources)
        {
            if (!resources.SizeAvailable (8))
                return;
            resources.Advance (4);
            var child = resources.ReadUInt32 ();

            var position = resources.position;
            resources.position = (int) child & 0x7fffffff;

            if ((child & 0x80000000) != 0)
                PatchResourceDirectoryTable (resources);
            else
                PatchResourceDataEntry (resources);

            resources.position = position;
        }
Example #2
0
        void PatchResourceDirectoryTable(ByteBuffer resources)
        {
            if (!resources.SizeAvailable (16))
                return;
            resources.Advance (12);

            var entries = resources.ReadUInt16 () + resources.ReadUInt16 ();

            for (int i = 0; i < entries; i++)
                PatchResourceDirectoryEntry (resources);
        }
Example #3
0
 void PatchResourceDataEntry(ByteBuffer resources)
 {
     if (!resources.SizeAvailable (4))
         return;
     var old_rsrc = GetImageResourceSection ();
     var rva = resources.ReadUInt32 ();
     resources.position -= 4;
     resources.WriteUInt32 (rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress);
 }