home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / os2 / programm / 4597 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  1.4 KB

  1. Path: sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!PKSMRVM.VNET.IBM.COM!KENKAHN
  2. From: KENKAHN@PKSMRVM.VNET.IBM.COM ("Kenneth A. Kahn")
  3. Newsgroups: comp.os.os2.programmer
  4. Subject: Re: How can I read the MBR (Master Boot Record) under OS/2?
  5. Message-ID: <9208282200.AA22808@ucbvax.Berkeley.EDU>
  6. Date: 28 Aug 92 21:49:51 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Lines: 28
  9.  
  10. Organization: Staff of IBM Fellow - NetWork Computing
  11. Disclaimer: This posting represents the poster's views, not those of IBM
  12. News-Software: UReply 3.0
  13. X-X-From: KENKAHN@PKSMRVM.VNET.IBM.COM (Ken Kahn)
  14. References: <N2c9PB2w165w@tsoft.sf-bay.org>
  15.  
  16. In <N2c9PB2w165w@tsoft.sf-bay.org> Dennis Yelle writes:
  17. >
  18. >I am trying to read the Master Boot Record from my C: drive
  19. >under OS/2.
  20. >
  21.  
  22. I'm not familar with the IOCtl Inetrface for doing this, but the same effect
  23. can be accomplished with the following code:
  24.  
  25.   HFILE  BR_Handle;
  26.   USHORT BR_Action;
  27.  
  28.   RC = DosOpen("C:",&BR_Handle,&BR_Action,0L,FILE_DIRECTORY,
  29.                OPEN_ACTION_OPEN_IF_EXISTS,
  30.                OPEN_ACCESS_READWRITE+OPEN_SHARE_DENYNONE+OPEN_FLAGS_DASD,
  31.                ,0L);
  32.  
  33. The important part here is the OPEN_FLAGS_DASD.  This tells OS/2 that this
  34. is a request to open a Drive rather than a file.  You can then use the handle
  35. (BR_Handle) with DosRead and DosWrite to manipulate the Drive; i.e. the first
  36. 256 Bytes are the Boot Record.
  37.  
  38.