PDA

View Full Version : Question about using spawn and execl



Waldo2k2
01-25-2003, 02:27 PM
ok,
I'm attempting to run a program before DOS by calling it command.com. It basically calls the renamed dos (now known as com.com) and away it goes. That works, now, I'm trying to figure out how to call windows then too automatically...here's what I've been thinking of doing:


spawnl(0,"c:\\com.com","autoexec.bat",0);
execl("c:\\windows\\win.com",0);



Also, I have a problem, on some newer bios's, I've noticed that it skips over calling command.com for some reason and goes to win.com (or something like that)....the problem is in win9x since DOS hasn't been run that windows faults out because it can't initialize vFat.
Anyone have a clue what's going on with that?

Thanks.

edit: being compiled as a 16 bit app in turbo C, the first arg to spawnl being a 0 indicating it should run a child process, returning control to the parent

Carlos
01-30-2003, 08:45 AM
... on some newer bios's, I've noticed that it skips over calling command.com for some reason

Confusion.BIOS is responsible for loading the Master Boot Record (head 0, cylinder 0, sector 1) into memory [address 0000:7c00h],which is executed. IO.SYS and MSDOS.SYS (code to handle DOS low level function calls) are loaded.
IO.SYS loads command.com.

That's how the system boots up.
With newer Windows, there are some changes, of course, but technically, the behaviour is as described above.

So, you have to change the original MBR code in order to get control of this flow (I made a boot-loader once, which asked for a password right upon startup).

If there's a COMMAND.COM (or whatever) already loaded into memory, it cannot be replaced, that's why your approach won't work.

Warning: some newer MBR's will place data on further sectors aswell!



Waldo2k2
Anti-Hungarian

Sounds really strange, don't you think?
Please pay attention: You are accessing a public message board. Besides, insulting people for their nationality, skin color etc. is not really trendy since...well, you might have probably heard of WWII, Ku-Klux clan, etc.

Waldo2k2
01-30-2003, 12:35 PM
Thanks for the reply, I was hoping someone would know what to do...and by the way, it's anti-hungarian notation....not a racist remark towards those who happen to be hungarian.