Thread: Question about using spawn and execl

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    Question about using spawn and execl

    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:
    Code:
    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
    Last edited by Waldo2k2; 01-25-2003 at 03:25 PM.
    PHP and XML
    Let's talk about SAX

  2. #2
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    ... 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.
    Last edited by Carlos; 01-30-2003 at 08:49 AM.

  3. #3
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork, execv, spawn, or something else?
    By DavidP in forum C++ Programming
    Replies: 8
    Last Post: 01-26-2009, 04:25 PM