Error in ld scripts
Command line: ld -subsystem native --file-alignment
0x20 --section-alignment 0x20 --image-base 0x10000
driver.c -o driver.sys -lntoskrnl
Section .text address is countings as follows:
__image_base__ + __section_alignment__, so we have
section .text address 0x10020. It's incorrect, because
header size is bigger than 0x20.
I suggest to change line
.text __image_base__ + __section_alignment__ :
. = __image_base__ + SIZEOF_HEADERS;
.text BLOCK(__section_alignment__) :
in linker scripts.
Log in to post a comment.