I was asking me the question... what is that unusefull thing after the Dos
Stub of all exes generated with the Microsoft linker... now i'm asking that
question to you.... What is it ?

it's just before the PE.... it take some space.... so I can't get my exe
generated with that linker smaller than 396 bytes... I must edit it by
hand...
There is always the string "Rich" and some other constant... but the rest is
random......

any one knows what it is? and maybe... how to get it off ?

Re: The thing after the DOS Stub by James

James
Sat Dec 13 04:25:43 CST 2003

Hi,
It's there for legacy reasons. If you run a win32 program under
ms-dos (i.e. the real ms-dos, not just a console) you get a message
saying "this program requires windows" or something like that. That's
what the stub program is for. And no, you can't get rid of it.

BTW you can put any dos program there. There used to be programs
a few years ago that ran in both dos and windows, with the dos-program
running in text mode and mimicking the way the windows program worked.

James
--
www.catch22.org.uk
Free Win32 Software, Source Code and Tutorials



"FrE" <fre2001@sympatico.ca> wrote in message
news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> I was asking me the question... what is that unusefull thing after the Dos
> Stub of all exes generated with the Microsoft linker... now i'm asking
that
> question to you.... What is it ?
>
> it's just before the PE.... it take some space.... so I can't get my exe
> generated with that linker smaller than 396 bytes... I must edit it by
> hand...
> There is always the string "Rich" and some other constant... but the rest
is
> random......
>
> any one knows what it is? and maybe... how to get it off ?
>
>



Re: The thing after the DOS Stub by Tim

Tim
Sat Dec 13 07:48:11 CST 2003

"James Brown" <PLEASEDONTSPAMjames.brown7@virgin.net> wrote in message
news:3fdae927$0$11173$cc9e4d1f@news.dial.pipex.com...
> BTW you can put any dos program there. There used to be programs
> a few years ago that ran in both dos and windows, with the dos-program
> running in text mode and mimicking the way the windows program worked.

16-bit VB programs always used to have a stub which loaded Windows and
started the program itself. And the 16-bit Windows SETUP.EXE had the Windows
instal program in the DOS stub, and the add/remove components dialog in the
Windows part.

--
Tim Robinson (MVP, Windows SDK)
http://www.themobius.co.uk/



Re: The thing after the DOS Stub by FrE

FrE
Sat Dec 13 15:55:34 CST 2003

I said it was after the DOS Stub.... the DOS Stub ends right after or 1 byte
after the $ (string terminasion char)
The string is like:
"This program must be run under Win32\r\n$"
or
"This program cannot be run in DOS mode.\r\r\n$"

I check.... if you stop right after the '$' it's still working (I set
MZ.e_lfanew to 0 to check that...)

The code after is completely unusefull... you can 0 fill it until the PE and
everything will be fine...

By the way... you can change the have a smaller dos Stub by linking it with
the /STUB:mzexename.exe

I use a 64 bytes Dos Stub and there is thease weird thing between 0x40 and
0x80 (where the PE is)
so there is 64 bytes of that crap here... but usualy there is at least 100
bytes of it....

help...

- FrE

"James Brown" <PLEASEDONTSPAMjames.brown7@virgin.net> a écrit dans le
message de news: 3fdae927$0$11173$cc9e4d1f@news.dial.pipex.com...
> Hi,
> It's there for legacy reasons. If you run a win32 program under
> ms-dos (i.e. the real ms-dos, not just a console) you get a message
> saying "this program requires windows" or something like that. That's
> what the stub program is for. And no, you can't get rid of it.
>
> BTW you can put any dos program there. There used to be programs
> a few years ago that ran in both dos and windows, with the dos-program
> running in text mode and mimicking the way the windows program worked.
>
> James
> --
> www.catch22.org.uk
> Free Win32 Software, Source Code and Tutorials
>
>
>
> "FrE" <fre2001@sympatico.ca> wrote in message
> news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> > I was asking me the question... what is that unusefull thing after the
Dos
> > Stub of all exes generated with the Microsoft linker... now i'm asking
> that
> > question to you.... What is it ?
> >
> > it's just before the PE.... it take some space.... so I can't get my exe
> > generated with that linker smaller than 396 bytes... I must edit it by
> > hand...
> > There is always the string "Rich" and some other constant... but the
rest
> is
> > random......
> >
> > any one knows what it is? and maybe... how to get it off ?
> >
> >
>
>



Re: The thing after the DOS Stub by Gary

Gary
Sat Dec 13 16:58:36 CST 2003


"FrE" <fre2001@sympatico.ca> wrote in message
news:uVLCb.20228$aF2.2281185@news20.bellglobal.com...
> I said it was after the DOS Stub.... the DOS Stub ends right after or 1
byte
> after the $ (string terminasion char)
> The string is like:
> "This program must be run under Win32\r\n$"
> or
> "This program cannot be run in DOS mode.\r\r\n$"
>
> I check.... if you stop right after the '$' it's still working (I set
> MZ.e_lfanew to 0 to check that...)
>
> The code after is completely unusefull... you can 0 fill it until the PE
and
> everything will be fine...
>
> By the way... you can change the have a smaller dos Stub by linking it
with
> the /STUB:mzexename.exe
>
> I use a 64 bytes Dos Stub and there is thease weird thing between 0x40 and
> 0x80 (where the PE is)
> so there is 64 bytes of that crap here... but usualy there is at least 100
> bytes of it....

In the program I examined (created by MSVC6), this field was only 32
bytes. I have no idea what it's meant for either.

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
-gchanson@mvps.org

-Abolish public schools



Re: The thing after the DOS Stub by James

James
Sat Dec 13 19:39:51 CST 2003

Sorry, I mis-read the original question.

James


"FrE" <fre2001@sympatico.ca> wrote in message
news:uVLCb.20228$aF2.2281185@news20.bellglobal.com...
> I said it was after the DOS Stub.... the DOS Stub ends right after or 1
byte
> after the $ (string terminasion char)
> The string is like:
> "This program must be run under Win32\r\n$"
> or
> "This program cannot be run in DOS mode.\r\r\n$"
>
> I check.... if you stop right after the '$' it's still working (I set
> MZ.e_lfanew to 0 to check that...)
>
> The code after is completely unusefull... you can 0 fill it until the PE
and
> everything will be fine...
>
> By the way... you can change the have a smaller dos Stub by linking it
with
> the /STUB:mzexename.exe
>
> I use a 64 bytes Dos Stub and there is thease weird thing between 0x40 and
> 0x80 (where the PE is)
> so there is 64 bytes of that crap here... but usualy there is at least 100
> bytes of it....
>
> help...
>
> - FrE
>
> "James Brown" <PLEASEDONTSPAMjames.brown7@virgin.net> a écrit dans le
> message de news: 3fdae927$0$11173$cc9e4d1f@news.dial.pipex.com...
> > Hi,
> > It's there for legacy reasons. If you run a win32 program under
> > ms-dos (i.e. the real ms-dos, not just a console) you get a message
> > saying "this program requires windows" or something like that. That's
> > what the stub program is for. And no, you can't get rid of it.
> >
> > BTW you can put any dos program there. There used to be programs
> > a few years ago that ran in both dos and windows, with the dos-program
> > running in text mode and mimicking the way the windows program worked.
> >
> > James
> > --
> > www.catch22.org.uk
> > Free Win32 Software, Source Code and Tutorials
> >
> >
> >
> > "FrE" <fre2001@sympatico.ca> wrote in message
> > news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> > > I was asking me the question... what is that unusefull thing after the
> Dos
> > > Stub of all exes generated with the Microsoft linker... now i'm asking
> > that
> > > question to you.... What is it ?
> > >
> > > it's just before the PE.... it take some space.... so I can't get my
exe
> > > generated with that linker smaller than 396 bytes... I must edit it by
> > > hand...
> > > There is always the string "Rich" and some other constant... but the
> rest
> > is
> > > random......
> > >
> > > any one knows what it is? and maybe... how to get it off ?
> > >
> > >
> >
> >
>
>



Re: The thing after the DOS Stub by Frank

Frank
Sun Dec 14 02:35:50 CST 2003

Not that I can help but I was just curious what the big deal was...I mean
back in the 640K days I could see this as a potential nuisance but now?
Anyway, why not write a utility that removes it?

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"FrE" <fre2001@sympatico.ca> wrote in message
news:uVLCb.20228$aF2.2281185@news20.bellglobal.com...
> I said it was after the DOS Stub.... the DOS Stub ends right after or 1
byte
> after the $ (string terminasion char)
> The string is like:
> "This program must be run under Win32\r\n$"
> or
> "This program cannot be run in DOS mode.\r\r\n$"
>
> I check.... if you stop right after the '$' it's still working (I set
> MZ.e_lfanew to 0 to check that...)
>
> The code after is completely unusefull... you can 0 fill it until the PE
and
> everything will be fine...
>
> By the way... you can change the have a smaller dos Stub by linking it
with
> the /STUB:mzexename.exe
>
> I use a 64 bytes Dos Stub and there is thease weird thing between 0x40 and
> 0x80 (where the PE is)
> so there is 64 bytes of that crap here... but usualy there is at least 100
> bytes of it....
>
> help...
>
> - FrE
>
> "James Brown" <PLEASEDONTSPAMjames.brown7@virgin.net> a écrit dans le
> message de news: 3fdae927$0$11173$cc9e4d1f@news.dial.pipex.com...
> > Hi,
> > It's there for legacy reasons. If you run a win32 program under
> > ms-dos (i.e. the real ms-dos, not just a console) you get a message
> > saying "this program requires windows" or something like that. That's
> > what the stub program is for. And no, you can't get rid of it.
> >
> > BTW you can put any dos program there. There used to be programs
> > a few years ago that ran in both dos and windows, with the dos-program
> > running in text mode and mimicking the way the windows program worked.
> >
> > James
> > --
> > www.catch22.org.uk
> > Free Win32 Software, Source Code and Tutorials
> >
> >
> >
> > "FrE" <fre2001@sympatico.ca> wrote in message
> > news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> > > I was asking me the question... what is that unusefull thing after the
> Dos
> > > Stub of all exes generated with the Microsoft linker... now i'm asking
> > that
> > > question to you.... What is it ?
> > >
> > > it's just before the PE.... it take some space.... so I can't get my
exe
> > > generated with that linker smaller than 396 bytes... I must edit it by
> > > hand...
> > > There is always the string "Rich" and some other constant... but the
> rest
> > is
> > > random......
> > >
> > > any one knows what it is? and maybe... how to get it off ?
> > >
> > >
> >
> >
>
>



Re: The thing after the DOS Stub by Gary

Gary
Sun Dec 14 12:27:27 CST 2003


"Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message
news:-uidnRliwOp7vUGiRVn-sQ@comcast.com...
> Not that I can help but I was just curious what the big deal was...I mean
> back in the 640K days I could see this as a potential nuisance but now?
> Anyway, why not write a utility that removes it?

Easier said then done. That would mean relocating everything in the
file.

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
-gchanson@mvps.org

-Abolish public schools



Re: The thing after the DOS Stub by FrE

FrE
Sun Dec 14 13:59:56 CST 2003

Gary is right.... You could relocate the PE with a small program (only move
the PE and change e_lfanew)... but... it will not change the size of the
file.... to do that you must disassemble all the file and process eatch
line..... do alignment stuff... change the directories and sections... and a
lot of field in the PE like .codesize..... it may be harder than do your own
linker!

My frist question was: what is the crapy crap between the DosStub and the
PE? there is still no awnser to this one...

My other question was a litle bit more about the linker options.... is there
any switch to remove that crap? If you know it's impossible with MS
linker... tell me then....

I will ad an other one: Do you know a linker that I can use with VC++ 6.0
that don't do this thing and optimize everyting a litle better?

-

and Frank for the 64 bytes thing... maybe it's not a lot.... but I don't
like the idea that i have crap in my programs... it's like if my program was
crap... haha.... so that's why i'm searching a way to remove it.... I could
fill it with 0s..... but it's to make a crap and then repair it...

I seen to mutch 32ko program that could be optimise to 2-3 ko with 2 #pragma
...... that is only 2 lines to add....

when you look inside an exe... what do you see ?
a lot of 0000000000000000

why fill you file with unusefull information ?

and maybe 64 bytes is not a lot for you.... but... I aways optimise my
program at the best I can....

I know i'm a litle crasy..... but not my fault.... i'm born like that...

-FrE



Re: The thing after the DOS Stub by Gary

Gary
Sun Dec 14 21:41:14 CST 2003


"FrE" <fre2001@sympatico.ca> wrote in message
news:6j3Db.1761$Ve.274128@news20.bellglobal.com...
> Gary is right.... You could relocate the PE with a small program (only
move
> the PE and change e_lfanew)... but... it will not change the size of the
> file.... to do that you must disassemble all the file and process eatch
> line..... do alignment stuff... change the directories and sections... and
a
> lot of field in the PE like .codesize..... it may be harder than do your
own
> linker!
>
> My frist question was: what is the crapy crap between the DosStub and the
> PE? there is still no awnser to this one...
>
> My other question was a litle bit more about the linker options.... is
there
> any switch to remove that crap? If you know it's impossible with MS
> linker... tell me then....
>
> I will ad an other one: Do you know a linker that I can use with VC++ 6.0
> that don't do this thing and optimize everyting a litle better?
>
> -
>
> and Frank for the 64 bytes thing... maybe it's not a lot.... but I don't
> like the idea that i have crap in my programs... it's like if my program
was
> crap... haha.... so that's why i'm searching a way to remove it.... I
could
> fill it with 0s..... but it's to make a crap and then repair it...
>
> I seen to mutch 32ko program that could be optimise to 2-3 ko with 2
#pragma
> ...... that is only 2 lines to add....
>
> when you look inside an exe... what do you see ?
> a lot of 0000000000000000
>
> why fill you file with unusefull information ?
>
> and maybe 64 bytes is not a lot for you.... but... I aways optimise my
> program at the best I can....
>
> I know i'm a litle crasy..... but not my fault.... i'm born like that...

It's also useless. At the very most, all you will do is save one hard
drive cluster. It won't make a any difference to the executable image
mapped into your process.

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
-gchanson@mvps.org

-Abolish public schools



Re: The thing after the DOS Stub by FrE

FrE
Sun Dec 14 22:09:11 CST 2003

I know that kernel32 is mapping the file in memory acording to PE entries...
but still what does this crap does there ?

a 32 ko exe can be changed to a 2-3 ko not only with alignment you know....

"Gary Chanson" <gchanson@No.Spam.TheWorld.net> a écrit dans le message de
news: uNd283rwDHA.2440@TK2MSFTNGP12.phx.gbl...
>
> "FrE" <fre2001@sympatico.ca> wrote in message
> news:6j3Db.1761$Ve.274128@news20.bellglobal.com...
> > Gary is right.... You could relocate the PE with a small program (only
> move
> > the PE and change e_lfanew)... but... it will not change the size of the
> > file.... to do that you must disassemble all the file and process eatch
> > line..... do alignment stuff... change the directories and sections...
and
> a
> > lot of field in the PE like .codesize..... it may be harder than do your
> own
> > linker!
> >
> > My frist question was: what is the crapy crap between the DosStub and
the
> > PE? there is still no awnser to this one...
> >
> > My other question was a litle bit more about the linker options.... is
> there
> > any switch to remove that crap? If you know it's impossible with MS
> > linker... tell me then....
> >
> > I will ad an other one: Do you know a linker that I can use with VC++
6.0
> > that don't do this thing and optimize everyting a litle better?
> >
> > -
> >
> > and Frank for the 64 bytes thing... maybe it's not a lot.... but I don't
> > like the idea that i have crap in my programs... it's like if my program
> was
> > crap... haha.... so that's why i'm searching a way to remove it.... I
> could
> > fill it with 0s..... but it's to make a crap and then repair it...
> >
> > I seen to mutch 32ko program that could be optimise to 2-3 ko with 2
> #pragma
> > ...... that is only 2 lines to add....
> >
> > when you look inside an exe... what do you see ?
> > a lot of 0000000000000000
> >
> > why fill you file with unusefull information ?
> >
> > and maybe 64 bytes is not a lot for you.... but... I aways optimise my
> > program at the best I can....
> >
> > I know i'm a litle crasy..... but not my fault.... i'm born like that...
>
> It's also useless. At the very most, all you will do is save one hard
> drive cluster. It won't make a any difference to the executable image
> mapped into your process.
>
> --
>
> -GJC [MS Windows SDK MVP]
> -Software Consultant (Embedded systems and Real Time Controls)
> -gchanson@mvps.org
>
> -Abolish public schools
>
>



Re: The thing after the DOS Stub by Gary

Gary
Sun Dec 14 22:40:53 CST 2003


"FrE" <fre2001@sympatico.ca> wrote in message
news:MtaDb.4545$Ve.502835@news20.bellglobal.com...
> I know that kernel32 is mapping the file in memory acording to PE
entries...
> but still what does this crap does there ?
>
> a 32 ko exe can be changed to a 2-3 ko not only with alignment you
know....

So what? You probably have 64K clusters on your hard drive.

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
-gchanson@mvps.org

-Abolish public schools



Re: The thing after the DOS Stub by FrE

FrE
Sun Dec 14 23:11:30 CST 2003

Don't get mad... I have 4ko clusters on my HD

"Gary Chanson" <gchanson@No.Spam.TheWorld.net> a écrit dans le message de
news: eXzocYswDHA.1736@TK2MSFTNGP09.phx.gbl...
>
> "FrE" <fre2001@sympatico.ca> wrote in message
> news:MtaDb.4545$Ve.502835@news20.bellglobal.com...
> > I know that kernel32 is mapping the file in memory acording to PE
> entries...
> > but still what does this crap does there ?
> >
> > a 32 ko exe can be changed to a 2-3 ko not only with alignment you
> know....
>
> So what? You probably have 64K clusters on your hard drive.
>
> --
>
> -GJC [MS Windows SDK MVP]
> -Software Consultant (Embedded systems and Real Time Controls)
> -gchanson@mvps.org
>
> -Abolish public schools
>
>



Re: The thing after the DOS Stub by adebaene

adebaene
Mon Dec 15 04:33:22 CST 2003

"FrE" <fre2001@sympatico.ca> wrote in message news:<O4vCb.16168$aF2.1821441@news20.bellglobal.com>...
> I was asking me the question... what is that unusefull thing after the Dos
> Stub of all exes generated with the Microsoft linker... now i'm asking that
> question to you.... What is it ?

Isn't it some kind of genration date / timestamp ?

Arnaud
MVP - VC

Re: The thing after the DOS Stub by Gary

Gary
Mon Dec 15 04:47:57 CST 2003


"FrE" <fre2001@sympatico.ca> wrote in message
news:9obDb.5014$Ve.529941@news20.bellglobal.com...
> Don't get mad... I have 4ko clusters on my HD

Ok. I still say "so what?".

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
-gchanson@mvps.org

-Abolish public schools



Re: The thing after the DOS Stub by James

James
Mon Dec 15 10:11:34 CST 2003

I believe that is the 16-bit Windows stub. (it does basically the same
thing as the DOS stub, but for when you try to running it in Windows 3.1)

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"FrE" <fre2001@sympatico.ca> wrote in message
news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> I was asking me the question... what is that unusefull thing after the Dos
> Stub of all exes generated with the Microsoft linker... now i'm asking
that
> question to you.... What is it ?
>
> it's just before the PE.... it take some space.... so I can't get my exe
> generated with that linker smaller than 396 bytes... I must edit it by
> hand...
> There is always the string "Rich" and some other constant... but the rest
is
> random......
>
> any one knows what it is? and maybe... how to get it off ?
>
>



Re: The thing after the DOS Stub by Ozma

Ozma
Mon Dec 15 10:21:45 CST 2003

> I was asking me the question... what is that unusefull thing after the Dos
> Stub of all exes generated with the Microsoft linker... now i'm asking
that
> question to you.... What is it ?
NE heeader is at least para-alingned & BIND program keeps it's data
structures 256-byte alingned.
So NE-header in your pgm starts @256-byte boundary, eh ? :) But it's not
language issue...
>



Re: The thing after the DOS Stub by Alexander

Alexander
Mon Dec 15 10:33:15 CST 2003

NE is 16-bit Windows EXE.
32-bit Windows uses PE.

"Ozma" <ozma2000@mail.ru> wrote in message
news:%23fyxJeywDHA.3436@tk2msftngp13.phx.gbl...
> > I was asking me the question... what is that unusefull thing after the
Dos
> > Stub of all exes generated with the Microsoft linker... now i'm asking
> that
> > question to you.... What is it ?
> NE heeader is at least para-alingned & BIND program keeps it's data
> structures 256-byte alingned.
> So NE-header in your pgm starts @256-byte boundary, eh ? :) But it's not
> language issue...
> >
>
>



Re: The thing after the DOS Stub by Elias

Elias
Tue Dec 16 01:27:02 CST 2003


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:etD7mkywDHA.2456@TK2MSFTNGP12.phx.gbl...
> NE is 16-bit Windows EXE.
> 32-bit Windows uses PE.
>
Yes, of course. Excuse me for woolgathering. But it does not change the
situation - "New" or "Portable" Executable header must be aligned.
AFAIK, PE header is at list 8-byte aligned according to specification, in
real life - at list para (16 byte) aligned. BIND & MS linker allocates n*256
bytes for DOS stub (don't ask me why. May be it's a prehistoric tradition )
Watcom linker uses OPTION ALIGNMENT for this purpose. Suppose that other
EXE-bulding tools uses some "block allocation"







Re: The thing after the DOS Stub by Bonj

Bonj
Fri Jan 09 13:19:12 CST 2004

An exe is 396 bytes????? ONLY?!
Does it actually DO anything?


"FrE" <fre2001@sympatico.ca> wrote in message
news:O4vCb.16168$aF2.1821441@news20.bellglobal.com...
> I was asking me the question... what is that unusefull thing after the Dos
> Stub of all exes generated with the Microsoft linker... now i'm asking
that
> question to you.... What is it ?
>
> it's just before the PE.... it take some space.... so I can't get my exe
> generated with that linker smaller than 396 bytes... I must edit it by
> hand...
> There is always the string "Rich" and some other constant... but the rest
is
> random......
>
> any one knows what it is? and maybe... how to get it off ?
>
>