I need to write to some specific sectors on a floppy disk, but I don't know of any way of doing this from the Windows API. Is there a way?

Just to be a bit more specific, if i wanted to do this in DOS (and i am well aware that in windows you can't use interrupts ) I would do it as follows:

MOV AH, 00h ; Int 13h/AH=00h - DISK - RESET DISK SYSTEM
MOV DL, 00h ; Drive = 0
INT 13h ; Interrupt

MOV AH, 03h ; Int 13h/AH=03h - DISK - WRITE DISK SECTOR(S)
MOV AL, 01h ; Write 1 sector
MOV CX, 0001h ; CH = 0 (Low eight bits of cylinder number)
; CL = 1 (Sector number - ie write to sector 1)
MOV DX, 0000h ; DH = 0 (Head Number)
; DL = 0 (Drive Number)
MOV BX, OFFSET DATA ; Set buffer
INT 13h ; Interrupt

If i write and assemble/link it as a DOS program (ie it IS a DOS program) and then run it in windows, it works fine, but i was wondering if anyone knew of a way to do this using the windows API.

Posted on 2004-04-30 08:49:10 by Ossa
If you're on NT, it's easy - CreateFile with an argument like \\.\A: .If you want 9x support, it's somewhat more ugly - I think somebody came up with a way of doing it here, you'll need to either write a 32->16 bit thunk DLL, or use some IoCtl code with a specific driver iirc.
Posted on 2004-04-30 09:02:38 by f0dder
thnx f0dder, im on XP and it works exactly the way i needed it to!

Posted on 2004-04-30 09:38:44 by Ossa