Click to See Complete Forum and Search --> : windows inside a dos program
slewrate
February 24th, 2007, 11:26 PM
Hello. I am not sure if this is the right place to ask, if not, I apologize in advance.
Allright, I know that a regular C++ program has a basic main loop such as
void main(){...etc , and everbody knows that a Windows program has lots of more code in it.
Now, I found a DirectX wrapper and I think I also remember seeing other packages that had a regular void main() as main function, although when executing one could see that it was actually a windows program that was running.
I guess my question is..whether I am wrong with my assumption or is it really possible to hide a full blown Windows program behind a regular looking c++ program (maybe somehow in the includes or in linked libs ?)
Any answer is appreciated
Lars(NL)
February 25th, 2007, 06:47 AM
I guess my question is..whether I am wrong with my assumption or is it really possible to hide a full blown Windows program behind a regular looking c++ program (maybe somehow in the includes or in linked libs ?)
I think you're in a totally wrong frame of mind.
What do you define a "regular looking c++ program"?
Looking purely at the very foundation of C++, it is really nothing more than a syntax that can be used to write programs, or more specifically... any programs.
Let me just answer your question in the clearest way I can think of.
Some C++ programs are:
1. regedit.exe (Windows Registry Editor)
2. calc.exe (Windows Calculator)
3. winword.exe (Microsoft Office Word)
4. CityOfHeroes.exe (A great MMORPG by Cryptic Studios and PlayNC)
5. gtasa.exe (GTA San Andreas by Rockstar North - who doesn't know it)
...
...
...
10924. ...
ovidiucucu
February 25th, 2007, 08:17 AM
everbody knows that a Windows program has lots of more code in it.
I didn't know that. Thank you for enlighten us! :)
is it really possible to hide a full blown Windows program behind a regular looking c++ program (maybe somehow in the includes or in linked libs ?)
Yes (almost) everything is possible. See attached.
Ovidiu
PS. What's the point? :D
slewrate
February 25th, 2007, 02:55 PM
I didn't know that. Thank you for enlighten us! :)
Yes (almost) everything is possible. See attached.
Ovidiu
PS. What's the point? :D
Sorry for not being on your level. Didn't mean to enlighten you.
The point is simply that I wanted to know how Win32 libraries such as SDL and the like have a main instead of a Winmain ?!
Thanks anyway.
Lars(NL)
February 25th, 2007, 04:12 PM
The point is simply that I wanted to know how Win32 libraries such as SDL and the like have a main instead of a Winmain ?!
Thanks anyway.
Oooooohhh, well it doesn't matter if you call main, WinMain, f00 or Tweety - after all, a name is just a name.
WinMain is described by Microsoft on MSDN as a "placeholder for an application-defined procedure name".
We refer to it as WinMain because then everyone knows what you're talking about.
If I ask here why my Tweety doesn't properly uninitialize when a WM_QUIT message is received, no one knows what I'm talking about.
As long as the code is in order, the procedure is too, but names never matter.
They're not even compiled.
ovidiucucu
February 25th, 2007, 05:26 PM
In addition to what Lars(NL) already said, taking a look at /ENTRY Linker Option (http://msdn2.microsoft.com/en-us/library/f9t8842e(VS.71).aspx) can clarify a little bit the problem.
Also, please find attached a simple Win32 Application having the entry point "BabaSafta" (focus on "Project Settings/Link/Category:Output/Entry-point symbol").
slewrate
February 25th, 2007, 11:51 PM
Thank you for your help. I think my question was answered, thanks for the source.
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.