dd@beta.UUCP (Dan Davison) (10/24/87)
I recently asked how to get around a problem with a program which always uses drive A:. I received a number of good suggestions, the two threads of which were (1) use debug and (2) use the assign command. Well, I wound up using the suggestion from jtn3@bsu-cs.UUCP (Jim Nelson), which is presented below. By the way, the DEBUG solution did not work for a very interesting reason. The string A: was stored in the file but changing all the A: to C: did not work-there was logic that caused the program to abort if it did not find the file on drive A or B! Also, the name of the parameter file was dynamically constructed. The latter was only figured out after about 8-10 hours with DEBUG. *Sigh*. So, I used the ASSIGN command...but hoo boy do I anticipate screams from the users. *sigh sigh*. My thanks to all! dan davison =================== From: John Owens <OWENSJ%VTVM1.BITNET@WISCVM.WISC.EDU> Look at the JOIN and SUBST commands in recent versions of DOS. If you said SUBST A: C:\DIRECTORY, references to A: would be to that subdirectory of C. (You can, of course, say SUBST A: C:\). This will work as long as the application doesn't call the ROM BIOS directly to do floppy I/O. [It didn't, luckily! dd] ------------------ From: NESCC%NERVM.BITNET@WISCVM.WISC.EDU (Scott C Crumpton) If the program uses file handles rather than FCBs then it is a simple matter to search the EXE file for "A:" and change it. If FCBs are used then you could search for the filename and change the drive byte in the FCB. If however, the FCB is built at execution time rather than staticly defined, then you have a problem involving dis-assembly and trying to figure out what the code does. [Yup, I sure did have a problem. It also used handles, not FCBs... dd] --------------- From: <C90630JG%WUVMD.BITNET@WISCVM.WISC.EDU> Program authors who hard-wire drive letters should be horsewipped. On a lighter note, have you tried the ASSIGN command? Syntax: [d:][path] ASSIGN old = new Purpose: transfer requests for a specific drive to a different drive. ASSIGN with no parameters resets. Note: don't use this with BACKUP, RESTORE, LABEL, PRINT(?!), OR RESTORE. DISKCOPY, DISKCOMP, and FORMAT ignore it. --------------------- From: Dimitri Vulis <CLDLV%NASAGISS.BITNET@WISCVM.WISC.EDU> Dan, the following procedure might work: 1) Rename your EXE file to some filetype other than EXE. MAKE SURE YOU RETAIN A BACKUP E.G. ren foo.exe bar 2) Debug the file and try to look for the reference to A: debug bar s 0 fff0 'A:' s 0 fff0 'a:' Note: if your EXE file is >64K, you make have to search more than once. I.e. suppose it's 92K and when you load, ds=1f00 (for instance), then you should say something like a 2d00:fff0 'a:' Suppose you find some occurences... i.e. debug sais xxxx:yyyy Then you should edit these locations and change A to C. then type w to write it back and rename it back to EXE file. [It was when this did not work that I got out Advanced MS-DOS, the Tech Ref manual, and pounded away with DEBUG. dd] ----------------- From: weikert@nadc.arpa (J. Weikert) Have you tried the "assign" command? ---------------- From: jtn3@bsu-cs.UUCP (Jim Nelson) Well, this method is a kludge that I've used that may work for you: Create a batch file to execute the program similar to this. CTTY NUL SUBST A: C:\PATHNAME SUBST B: C:\PATHNAME CTTY CON PROGRAM.EXT CTTY NUL SUBST A: /D SUBST B: /D CTTY CON ----------------------- From: <KRANTZ%VUCTRVAX.BITNET@WISCVM.WISC.EDU> One suggestion would be to use the SUBST command (I think) in DOS to make the program look on C - of course this would have the undesirable affect of disableing drive a:. (but you could use B: for A:). Or, if you will send the EXE file to me I will try to patch it for you. Basically what I would do is do a dump of the file to see if it has a filespec a:xxxx and if it does I will change it to c:xxxx... --------------------- From: LENOIL@XX.LCS.MIT.EDU The easiest remedy for your problem is to use the ASSIGN or SUBST commands, which allow you reassign the drive designator A: to another drive (assign) or subdirectory on another drive (subst). You then invoke your program via a batch file that looks something like this: SUBST A: C:\BIN DUMBPROG SUBST A: /D ------------------------- From: izumi@violet.Berkeley.EDU I don't have manuals etc. here, so from top of my head.... To change embedded "a:" in *.exe files to "c:", you can use debug.com as follows. First rename or copy abcd.exe to abcd.bin. You can't edit *.exe with debug. Note the size of abcd.bin by "dir" command. See how many segments it may occupy. Let's assume it's 100kbytes, which takes 2 segments. Then, do "debug abcd.bin" "-d" to display first section of the file content. The address on the left should be noted. xxxx:0100 -------- Now, do the search for string "a:" or "A:" by; -s xxxx:0000 L ffff "a:" (for first 64k -1) -s yyyy:0000 L ffff "a:" (yyyy= xxxx+1000 (hex), for next segment) -s xxxx:0000 L ffff "A:" (do it for upper case too) -s yyyy:0000 L ffff "A:" Now, if the program is much longer, repeat the above process for higher segment by keep adding 1000h to segment part of the address spec. MAke note of the addresses the search turns up. Do displays of memory near these addresses. If the ASCII representation on the right hand side show file names you must change, that what you shoud change EG, if the above search turns up string "A:" around address 2abc:0300, for example Do -d2abc:02f0 See if that shows any file name strings. If it does, get the exact address of the char "A" in "A:foo.dat" etc, and change that "A" to "C" by -e2abc:0300 "C" finaly -w (write back changed reslts) and rename the file to abcd.exe There may be some errors in how to use debug, but basic idea should be clear. ------------------ From: <hc!ames!uw-beaver!microsof!leefi> I guess you could trace through the run of the program, looking for the drive access logic, and replacing the "A:" parameter with your "C:" one. This would probably be replacing "00" with "02" if the file i/o is via a DOS int 21h service, or replacing "00" with "80" (hex) if the file i/o is using ROM BIOS interrupt 13h. A patch to an ugly (read hard coded drive letters suck) program... Although you said you didn't want to, I'd probably still use one of the following two methods: assign a = c subst a: c:\foo --------------------- From: hc!ames!ihnp4!chinet!hcfeams!acich!steve Why can't you just use the DOS "assign" command to redirect all disk calls from the A: drive to the C: drive. ---------------------- -- dan davison/theoretical biology/t-10 ms k710/los alamos national laboratory los alamos, nm 875545/dd@lanl.gov (arpa)/dd@lanl.uucp(new)/..cmcl2!lanl!dd "I refuse to be intimidated by reality any more" "What is reality anyway? Nuthin' but a collective hunch!" --Jane Wagner,via Lily Tomlin