Article View: comp.os.os2.programmer
Article #1278Re: How can I read the MBR (Master Boot Record) under OS/2?
From: "Kenneth A. Kahn"
Date: Fri, 28 Aug 1992 21:49
Date: Fri, 28 Aug 1992 21:49
27 lines
1473 bytes
1473 bytes
Organization: Staff of IBM Fellow - NetWork Computing
Disclaimer: This posting represents the poster's views, not those of IBM
News-Software: UReply 3.0
X-X-From: KENKAHN@PKSMRVM.VNET.IBM.COM (Ken Kahn)
References: <N2c9PB2w165w@tsoft.sf-bay.org>
In <N2c9PB2w165w@tsoft.sf-bay.org> Dennis Yelle writes:
>
>I am trying to read the Master Boot Record from my C: drive
>under OS/2.
>
I'm not familar with the IOCtl Inetrface for doing this, but the same effect
can be accomplished with the following code:
HFILE BR_Handle;
USHORT BR_Action;
RC = DosOpen("C:",&BR_Handle,&BR_Action,0L,FILE_DIRECTORY,
OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_ACCESS_READWRITE+OPEN_SHARE_DENYNONE+OPEN_FLAGS_DASD,
,0L);
The important part here is the OPEN_FLAGS_DASD. This tells OS/2 that this
is a request to open a Drive rather than a file. You can then use the handle
(BR_Handle) with DosRead and DosWrite to manipulate the Drive; i.e. the first
256 Bytes are the Boot Record.
Technical Details
Message-ID:
<9208282200.AA22808@ucbvax.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!PKSMRVM.VNET.IBM.COM!KENKAHNShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!PKSMRVM.VNET.IBM.COM!KENKAHN
From: KENKAHN@PKSMRVM.VNET.IBM.COM ("Kenneth A. Kahn")
Newsgroups: comp.os.os2.programmer
Subject: Re: How can I read the MBR (Master Boot Record) under OS/2?
Message-ID: <9208282200.AA22808@ucbvax.Berkeley.EDU>
Date: 28 Aug 92 21:49:51 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 28