[MKHIVE] Remove key name in our custom registry tree; use cell index instead
[reactos.git] / reactos / tools / pefixup.c
index f908a9a..be25015 100644 (file)
@@ -282,7 +282,10 @@ int main(int argc, char **argv)
     */
    len = read(fd_in, hdrbuf, sizeof(elfhdr));
    if (!memcmp(hdrbuf, elfhdr, sizeof(elfhdr)))
+   {
+      close(fd_in);
       return 0;
+   }
 
    len = lseek(fd_in, 0, SEEK_END);
    if (len < sizeof(IMAGE_DOS_HEADER))
@@ -375,12 +378,13 @@ int main(int argc, char **argv)
    {
       /* Update section flags */
       for (i = 0, section_header = IMAGE_FIRST_SECTION(nt_header);
-           i < dtohl(nt_header->OptionalHeader.NumberOfRvaAndSizes);
+           i < dtohl(nt_header->FileHeader.NumberOfSections);
            i++, section_header++)
       {
          if (!strcmp((char*)section_header->Name, ".text") ||
              !strcmp((char*)section_header->Name, ".data") ||
              !strcmp((char*)section_header->Name, ".idata") ||
+             !strcmp((char*)section_header->Name, ".rdata") ||
              !strcmp((char*)section_header->Name, ".bss"))
          {
             section_header->Characteristics |= htodl(IMAGE_SCN_MEM_NOT_PAGED);