|
-
Dec 23rd, 2001, 06:03 AM
#1
Thread Starter
Monday Morning Lunatic
crt0.c
Beware - the crt0*.c files are a tad on the unreadable side
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 23rd, 2001, 07:15 AM
#2
I know, I already scanned through them 
But I followed the code of the BaseCRTStartup (mainCRTStartup, wmainCRTStartup, WinMainCRTStartup and wWinMainCRTStartup) including subfunctions already and still can't find the place where AllocConsole is called...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 23rd, 2001, 07:30 AM
#3
Thread Starter
Monday Morning Lunatic
Use Find Files and search for anything with the text AllocConsole
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 24th, 2001, 04:39 AM
#4
Well, it doesn't find it. I searched the whole VC98 directory, and all it found was the declaration in wincon.h.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 24th, 2001, 06:52 AM
#5
I searched the whole Visual Studio tree. It's in WINCON.h, which is no help.
It's also in NCB files, and in compiled projects in .pch files.
This explains how it gets into the project, sort of. The compiler must be pulling the reference in the .ncb file.
No source declaration anywhere.
-
Dec 24th, 2001, 07:42 AM
#6
Thread Starter
Monday Morning Lunatic
Ooooohhhhh...
You want the source? Too bad, it's an API function 
I thought you wanted to know where it was actually called.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 25th, 2001, 03:12 PM
#7
Yes I do want the place where it is called. I know that I don't get the source of the API. But I searched my whole VC++ directory including CRT source, MFC source and all includes for the text "AllocConsole", and the only place I found it was the API declaration in wincon.h. No call to it anywhere.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 25th, 2001, 03:26 PM
#8
Thread Starter
Monday Morning Lunatic
*looks carefully at the .exe file format*
It appears that there is a value there which decides whether Windows itself allocates a console before running the program.
Have a look on MSDN at "peering inside the PE file format". So you can theoretically change a single value (unless the file has a checksum in which case you'd have to reset that) and your program would no longer have a console.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 26th, 2001, 10:39 AM
#9
So it's just the linker option /subsystem:[windows/console]
I somehow suspected that, but I wasn't sure.
The interesting thing is, why does a project started in VC++ set this option? If it is not set, VC++ determines the type of app automatically by searching for main and WinMain: main -> console
WinMain -> windows.
Anyway, this search has shown me how to find out if any console is runnning: the window is always of the class "tty".
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 26th, 2001, 11:12 AM
#10
tty is the standard unix console device - that is where C got it from. Stands for teletype. I'm giving away my age here....
-
Dec 26th, 2001, 11:16 AM
#11
120? 
I didn't know the exact meaning of TTY but I knew where it comes from. I use such apps like PuTTY to contact my linux server...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 26th, 2001, 06:07 PM
#12
Thread Starter
Monday Morning Lunatic
Originally posted by CornedBee
So it's just the linker option /subsystem:[windows/console]
I somehow suspected that, but I wasn't sure.
The interesting thing is, why does a project started in VC++ set this option? If it is not set, VC++ determines the type of app automatically by searching for main and WinMain: main -> console
WinMain -> windows.
Anyway, this search has shown me how to find out if any console is runnning: the window is always of the class "tty".
Is this new with VC++6 or something? With mine the linker settings are setup depending on what project type you created.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 28th, 2001, 07:29 AM
#13
Yes, the linker setting depends on the project type. But Jeffrey Richter said in his book that if you remove the setting, VC++ will search for the startup functions and react accordingly.
Last edited by CornedBee; Dec 28th, 2001 at 07:33 AM.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|