From af5ce0ae6bf4138a3b3ed7e37f628adb3dd7e83b Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 1 Sep 2013 13:23:54 +0000 Subject: [PATCH] [RSYM] * Don't overwrite the MZ header when there are no long section names. * Correct an error including 4 more bytes than needed in the coff strings. * Brought to you by Arty. svn path=/trunk/; revision=59938 --- reactos/tools/rsym/rsym.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/reactos/tools/rsym/rsym.c b/reactos/tools/rsym/rsym.c index 2db6655c042..0022bf29db5 100644 --- a/reactos/tools/rsym/rsym.c +++ b/reactos/tools/rsym/rsym.c @@ -1161,13 +1161,18 @@ CreateOutputFile(FILE *OutFile, void *InData, } } - fseek(OutFile, OutFileHeader->PointerToSymbolTable, 0); - /* COFF string section is preceeded by a length */ - fwrite((char*)&StringTableLength, 1, sizeof(StringTableLength), OutFile); - /* We just copy enough of the string table to contain the strings we want - The string table length technically counts as part of the string table - space itself. */ - fwrite(StringTable+4, 1, StringTableLength, OutFile); + if (OutFileHeader->PointerToSymbolTable) + { + fseek(OutFile, OutFileHeader->PointerToSymbolTable, 0); + + /* COFF string section is preceeded by a length */ + assert(sizeof(StringTableLength) == 4); + fwrite((char*)&StringTableLength, 1, sizeof(StringTableLength), OutFile); + /* We just copy enough of the string table to contain the strings we want + The string table length technically counts as part of the string table + space itself. */ + fwrite(StringTable + 4, 1, StringTableLength - 4, OutFile); + } if (PaddedRosSym) {