You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Any idea if this is at all possible ? I need to run a program from config.sys that sets up the device driver to load from config.sys, I don't want to do a reboot. If possible, are examples available somewhere ?
thx, Rob
I might be mistaken, but I think you have to set up
device drivers during boot. I know you can use a config.sys
menu in win9x and change your device settings by having them
pre setup to different setings in each selection. I know this
isn't what you are looking for, but it might be the next best
thing too it. The config.sys menu will let you boot to windows
or dos in many different configerations.
Unhide MSDOS.SYS and change BOOTGUI=1 to BOOTGUI=0
and that will allow you to boot straight to DOS without
haveing to hit that function key, or boot to windows, whichever
you select from the Config.sys Menu.
Now load config.sys in an text editor and add the menu.
This is just an example, yours will be different.
Code:
[menu]
menuitem=windows1
menuitem=windows2
menuitem=dos
menuitem=nosound
menuitem=nodrivers
[common] ;common will be included with every
DEVICE=C:\WINDOWS\HIMEM.SYS ;selection
[windows1]
DEVICE=C:\WINDOWS\EMM386.EXE
DEVICE=C:\WINDOWS\setver.exe
DEVICE=???.sys ;DEVICE setup one way
[windows2]
DEVICE=C:\WINDOWS\EMM386.EXE
DEVICE=C:\WINDOWS\setver.exe
DEVICE=???.sys ;DEVICE setup another way
;Add more selections if
;you want more ways.
[dos] ;if you want to use all your
DEVICE=C:\WINDOWS\EMM386.EXE RAM ;drivers for dos, like CD, Sound
BUFFERSHIGH=45 ;in which mine is set in
FILES=45 ;Autoexec.bat
DOS=HIGH,UMB
DEVICEHIGH=C:\WINDOWS\COMMAND\ansi.sys
DEVICEHIGH=C:\CDROM\yourCDROM.SYS /D:MSCD000 /v
[nosound] ;if you want to use only a CD
DEVICE=C:\WINDOWS\EMM386.EXE RAM ;and ansi.sys
FILES=40
BUFFERSHIGH=45
DOS=HIGH,UMB
DEVICEHIGH=C:\WINDOWS\COMMAND\ansi.sys
DEVICEHIGH=C:\CDROM\CDROM.SYS /D:MSCD000 /v
[nodrivers]
DEVICE=C:\WINDOWS\EMM386.EXE RAM
BUFFERSHIGH=45
FILES=45
DOS=HIGH,UMB
When you get config.sys the way you want it,
save it. Don't forget to make extra copies of
the original in case you goof. The same goes
for the MSDOS.SYS and Autoexec.bat files.
The AUTOEXEC.BAT could look something like this:
antivirrus.exe ;put here what you want to run with
;every selection
GOTO %CONFIG% ;go to your chosen selection
:windows1
path=C:\WINDOWS;C:\WINDOWS\COMMAND;G:\dos;C:\;
CD\WINDOWS
win ; RUN WINDOWS
GOTO END
:windows2
path=C:\WINDOWS;C:\WINDOWS\COMMAND;G:\dos;C:\;
CD\WINDOWS
win ; RUN WINDOWS
GOTO END
:dos
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;G:\jack;G:\DOS;C:\MENU
LH C:\WINDOWS\COMMAND\MSCDEX /D:MSCD000
lh g:\dos\mouse
SET BLASTER=A220 I7 D1 H7 P330 T6
SET SBPCI=C:\AUDIOPCI
menu ;If you have a menu, you can run the menu,
goto end
;if not, you will get the DOS prompt
:nosound
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;c:\;G:\DOS;C:\MENU;
LH C:\WINDOWS\COMMAND\MSCDEX /D:MSCD000
lh g:\dos\mouse
cd\MENU
MENU
goto end
:nodrivers
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\DOS;C:\MENU;c:\;
lh g:\dos\mouse
cd\MENU
MENU
goto end
:end
Make sure you have the same labels thats in you config.sys file.
Make sure you have bootable floppys with windows startup on it so
you can change any mistakes you make or switch back to the originals
if you can't make it work. Its has been working for me for many years.
Also, windows setup likes to put 'REM' in front of all the CDrom and
Mouse drivers to disable them. If it happens to run, you'll need to go back
and remove them or you'll loose those devices in dos.
------------------
[This message has been edited by Jerry Fielden (edited February 19, 2001).]
You're right, it was not wat I was looking for. But thanx for your reply anyway.
To restate my question: is it possible to write a DOS device driver in PB or are there any limitations to the PB runtime environment that would make this impossible ?
And if so, are there any experiences with this or is there any sample code available ? I have some sample asm-code for a DOS device driver but it would take me some time to figure out what is happening there and, anyway, why use ASM if PB could do it ?
It sounds like what you're trying to do is akin to IOmega's "Guest" program for their ZIP drives, which loads, tests, and then (if necessary) unloads various ASPI drivers until it finds one that allows it to see the ZIP drive. Your program isn't actually going to be the hardware driver, it's just going to try to find one that works, install it, then exit, right?
Unfortunately, loading and unloading drivers on the fly is tricky business; DOS isn't really designed to do it, and has to be "fooled" into thinking that "nothing has changed". This usually requires, among other things, drivers that are written specifically for the task... (notice that IOmega supplies their own set of drivers for the various Adaptec SCSI boards for the "Guest" program, for instance.) The manufacturer-supplied drivers you're hoping to pick-and-choose from probably aren't designed to do this.
What you want to do is even further complicated by your desire to do it from CONFIG.SYS, as (IIRC) DOS really has no provision for allowing one .SYS program to load another. (The IOmega "Guest" program runs from the DOS prompt.) Your program can load and attempt to search for the network driver, but it can't subsequently alter the CONFIG.SYS sequence on the fly, since CONFIG.SYS is loaded into memory by the DOS kernel and evaluated there, just like a .BAT file; any changes you made to CONFIG.SYS would only alter the next boot sequence, not the current one... and if your program does manage to install the correct device driver on its own, you'll leave a "hole" in the device chain when your "search-and-install" program terminates, and DOS won't like that either.
Lastly, I very much doubt it is possible to write a DOS device driver in PowerBASIC anyway; as I recall, .SYS files have some very strict rules governing the number of segments they can occupy, and they use a different set of DOS services to terminate or make themselves resident than .EXE files do... and I don't think the full set of DOS services is available to your program during the boot sequence, either, which would undoubtedly cause trouble with a lot of PB routines.
In short - I don't think you can get there from here.
After some investigations of my own I found the exact layout of a device driver. It This can be done in ASM directly but certainly not in PB. So I'll pursue that direction and not bother the PB DOS group with it. Thanx for your elaborate answer anyway, it helped me get on the right track.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment