jackall
November 8th, 2010, 12:11
Two executables build from (abc.c) and (abp.cpp)
The initialized data normally, to be found in (.data) section as seen in the dumpbin output of abc.exe.
SECTION HEADER #3
.data name
C0000040 flags
Read Write
However, the same initialized data in (abp.cpp) is not found in (.data) section, but was in (.rdata) section.
SECTION HEADER #2
.rdata name
40000040 flags
Read Only
1-why the initialized data, is shifted from read write section as in (C), to read only section in (C++)...?
2-is there a console utility to filter (to show the string in an executable)...! A small utility like dumpbin..!
3-how to make the code section (write)able in addition to its default (execute read) attributes..?
4- how to create another custom data section and move any desired data to it..?
thank you..!
The initialized data normally, to be found in (.data) section as seen in the dumpbin output of abc.exe.
SECTION HEADER #3
.data name
C0000040 flags
Read Write
Code:
0040C000: 65 6E 74 65 72 20 70 61 73 73 77 6F 72 64 2E 2E enter password..
0040C010: 0A 2E 2E 61 73 20 6B 72 69 73 0A 00 6B 72 69 73 ...as kris..kris
0040C020: 0A 00 00 00 77 72 6F 6E 67 2E 2E 20 70 61 73 73 ....wrong.. pass
0040C030: 77 6F 72 64 2E 2E 0A 00 70 61 73 73 77 6F 72 64 word....password
However, the same initialized data in (abp.cpp) is not found in (.data) section, but was in (.rdata) section.
SECTION HEADER #2
.rdata name
40000040 flags
Read Only
Code:
004131A0: 0A 65 6E 74 65 72 20 70 61 73 73 77 6F 72 64 2E .enter password.
004131B0: 2E 0A 2E 2E 61 73 20 6B 72 69 73 0A 00 00 00 00 ....as kris.....
004131C0: 6B 72 69 73 00 00 00 00 0A 77 72 6F 6E 67 20 70 kris.....wrong p
004131D0: 61 73 73 77 6F 72 64 2E 2E 00 00 00 70 61 73 73 assword.....pass
004131E0: 77 6F 72 64 20 4F 4B 0A 0A 00 00 00 69 6F 73 5F word OK.....ios_
1-why the initialized data, is shifted from read write section as in (C), to read only section in (C++)...?
2-is there a console utility to filter (to show the string in an executable)...! A small utility like dumpbin..!
3-how to make the code section (write)able in addition to its default (execute read) attributes..?
4- how to create another custom data section and move any desired data to it..?
thank you..!