[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] editing tccpe.c

From: Nick Smith-Burns
Subject: Re: [Tinycc-devel] editing tccpe.c
Date: Tue, 7 May 2013 06:50:53 -0400

From the PE sepcification:
MSDOS Stub (Image Only)
The MSDOS stub is a valid application that runs under MSDOS. It is placed at the front of the EXE image. The linker places a default stub here, which prints out the message “This program cannot be run in DOS mode” when the image is run in MSDOS. The user can specify a different stub by using the /STUB linker option.
At location 0x3c, the stub has the file offset to the PE signature. This information enables Windows to properly execute the image file, even though it has an MSDOS stub. This file offset is placed at location 0x3c during linking.
 Signature (Image Only)
After the MSDOS stub, at the file offset specified at offset 0x3c, is a 4-byte signature that identifies the file as a PE format image file. This signature is “PE\0\0” (the letters “P” and “E” followed by two null bytes).

So you have to keep the code block the same size of bytes.
Why do you want to remove the zeroes anyway? If your worried about the size of your executable removing those is hardly going to do anything.
On May 7, 2013 1:42 AM, "Carlos Montiers" <address@hidden> wrote:
Hello. I want change the default message of my compiled files from:
'This program cannot be run in DOS mode'
'This program must be run under Win32'

I do it using this in line 499 of tccpe.c

/* BYTE dosstub[0x40] */
/* 14 code bytes + "This program cannot be run in DOS mode.\r\r\n$" + 6 * 0x00 */
'T','h','i','s',' ','p','r','o','g','r','a','m',' ','m','u','s','t',' ',
'b','e',' ','r','u','n',' ','u','n','d','e','r',' ','W','i','n','3','2',

but I want remove the last 11 0x00

I tried do it replacing dosstub[0x40]  in line 237 by dosstub[0x35]  and 0x00000080 by 0x00000075 in line 498. But I get bad result.

Please can someone help me please indicating the modifications needed for remove the last 0x00?


Tinycc-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]