I want to write a Win32 application can read Hdd's MBR, without
any dll , and also can run under Win98/ME/2000/XP
Does anyone have idea about it ??
The previous mail have some information about this
but they need a dll file
Posted on 2002-02-06 04:06:51 by jordanc
This is almost what you want at



Assembly program reads master boot sector in XP/2000 and all other sectors in 98/ME.
Posted on 2002-02-06 20:58:49 by roaknog
Dear roaknog
I'm appreciate your help
also this web site have many information, it's very good
and the program can't read MBR under Win98/ME
it's use int21h function 7305h to allow absolute r/w sector
this function not support physical disk
anyway , still thank you
Posted on 2002-02-06 23:50:51 by jordanc

Bios reserved two interrupt about disk r/w :

int 25h - Absolute Disk Read
int 26h - Absolute Disk Write

if you want use hardware level port programming :


1F0-1FF Fixed disk 0 (AT)
1F0 disk 0 data
1F1 disk 0 error
1F2 disk 0 sector count
1F3 disk 0 sector number
1F4 disk 0 cylinder low
1F5 disk 0 cylinder high
1F6 disk 0 drive/head
1F7 disk 0 status

170-17F Fixed disk 1 (AT)
170 disk 1 data
171 disk 1 error
172 disk 1 sector count
173 disk 1 sector number
174 disk 1 cylinder low
175 disk 1 cylinder high
176 disk 1 drive/head
177 disk 1 status

have nice days,
Posted on 2002-02-07 06:00:15 by Unregistered

i've searched all the web a lot to make a MBR reading from W95, compatible also in NT without dll. I've also post on many forum and discussion boards, but nothing.
So i've done using QT_thunk function and a dll. (you can see application and tutorial on my site).

What i think is that port read/write operations using in & out instruction will not work in NT :(.

Let me know if you find a way to do your app compatible W95/NT without dll, i'm very interested also !

Posted on 2002-02-07 14:02:23 by Bit7
;Retrieve the MBR using BIOS calls...

mov ah,0x0201
;ah = INT 13h call 02h reads sectors from the HD in CHS format
;al = Number of sectors to read...

mov es,0x0000
mov bx,0x0600
;address of the buffer to use goes into ES:BX...

mov cx,0x0001
;ch = Cylinder Number to read from
;cl = Sector in bits 0-5, high 2 bits of Head is in bits 6-7

mov dx,0x0080
;dh = Lower 8 bits of Head number
;dl = the device, 80h is the first HD (primary master/primary cable select)

int 0x13 ;make the bios call

;------------------------------------------------------------------------------;This should work on any "IBM PC Clone" or any IBM based PC setup (ie the MBR is CHS 0,0,1 and the MB supports standard IBM BIOS calls)
Posted on 2002-02-07 14:52:41 by SpooK
Since the vxd conflicts with Me and the dll thunks conflict with 2000 I added a third method to my example using WinExec of a 16 bit program for 98/ME.
Posted on 2002-02-07 15:57:03 by roaknog
I am corrected. The vxd does not conflict with ME and it works in 95. I changed the program to z.exe in
Assembly program reads master boot sector in XP/2000/95/98/ME. I hope you can use a vxd.
Posted on 2002-02-07 18:47:26 by roaknog
For 9x, the thunking method seems to work well.
For NT and onwards, all you need is CreateFile, look it up in the
PlatformSDK. No need to mess with port I/O which will most likely
not work with all storage types (raid, scsi, software raid, etc.)
Posted on 2002-02-08 13:29:37 by f0dder
Interesting. I just changed the code on my example too. I do that frequently. And I try to share my code. I added a read with three dlls in Win9x/ME.
Posted on 2002-02-08 13:35:33 by roaknog