home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / lang / asm / 469 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.9 KB

  1. Path: sparky!uunet!ornl!sunova!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!apple!apple!NewsWatcher!user
  2. From: rol@grasp1.univ-lyon1.fr (Paul Rolland)
  3. Newsgroups: alt.lang.asm
  4. Subject: Re: LASTDRIVE function/asm/ect... Need one!
  5. Message-ID: <rol-171192133911@90.222.1.80>
  6. Date: 17 Nov 92 12:36:56 GMT
  7. References: <1992Nov8.081922.15576@ra.msstate.edu>
  8. Sender: usenet@Apple.COM
  9. Followup-To: alt.lang.asm,comp.lang.pascal,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer
  10. Organization: Apple Computer Europe
  11. Lines: 58
  12.  
  13. In article <1992Nov8.081922.15576@ra.msstate.edu>, jdz1@Ra.MsState.Edu
  14. (John D. Zitterkopf) wrote:
  15. > Howdy,
  16. >     As the subject says, I'm looking for some references on how to find
  17. > the LASTDRIVE on a particular system. Something like a INTerrupt or source
  18. > code that will allow me to do this. I did my best to search an interrupt list
  19. > to come up with a solution to do this but no luck. For Example, My lastdrive
  20. > is G, I'd like to make a TP6.0 function called LASTDRIVE that would return
  21. > a byte value of 7 or so. If it's in Assembly, I can convert it, ect. 
  22. >     A function to also tell me if the drive number is valid or not could
  23. > also prove useful. 
  24. >     I know these types of things are done becuase PC-TOOLS and the like
  25. > figure it out and even find the correct drive type. 
  26.  
  27. Here is some code that I use to get LastDrive. It does use the call to
  28. subfunction 60h which is undocumented, but it works fine with all the 
  29. version of DOS that I've tested. It is used to get the real path associated
  30. to a disk (useful to detect SUBSTed disk, or network disk). As a result,
  31. you
  32. have in LastDrive the result of the DOS LastDrive, and in LastPhysDrv the
  33. name of the last PHYSICAL drive, that is to say a disk that really exist 
  34. (not a substed one !).
  35. Tested with NOVELL network.
  36.  
  37.             Mov     Ah,19H
  38.             Int     21H
  39.             Mov     Byte Ptr Ds:[CurrentUnit],Al
  40.             Mov     Dl,Al
  41.             Mov     Ah,0EH
  42.             Int     21H
  43.             Mov     Byte Ptr Ds:[LastDrive],Al
  44.             Add     Al,40H
  45.             Mov     Word Ptr Ds:[Buffer+1],'\:'
  46.             Mov     Byte Ptr Ds:[Buffer+3],0
  47. GLLoop:     Mov     Byte Ptr Ds:[Buffer],Al
  48.             Mov     Si,OffSet Buffer
  49.             Mov     Di,OffSet Buffer+10H
  50.             Mov     Ah,60H
  51.             Int     21H
  52.             Mov     Al,Byte Ptr Ds:[Buffer]
  53.             Cmp     Al,Byte Ptr Ds:[Buffer+10H]
  54.             Jz      GLEnd
  55.             Dec     Al
  56.             Jmp     Short GLLoop
  57. GLEnd:      Sub     Al,40H
  58.             Mov     Byte Ptr Ds:[LastPhysDrv],Al
  59.  
  60. Paul Rolland, rol@grasp1.univ-lyon1.fr
  61. ---
  62.  
  63. A bug can be changed to a feature by documenting it. Developpers know !
  64.  
  65. --------------------- DISCLAIMER -------------------
  66.  
  67. All the opinions I express in this posting are mine, but I'm
  68. ready to share them with anybody interested :-)
  69.