ok, so i did some poking around, and i think i found a way to use int 25 for raw disk reads in win32, but it seems to not be working.. i have the following code:

xor ecx,ecx ;clear ecx for the counter
mov Regs.reg_EAX,0 ;drive number: a = 0
mov Regs.reg_ECX,1 ;number of sectors to read
mov Regs.reg_EDX,ecx ;sector number to read, 0 to 2879
mov Regs.reg_EBX,offset dBuff ;pointer to buffer for value read
invoke DeviceIoControl,hMem,VWIN32_DIOC_DOS_INT25,addr Regs,sizeof Regs,addr Regs,sizeof Regs,addr dBytesRead,NULL ;call int 25 with the pseudo registers to fill the buffer
mov eax,Regs.reg_Flags ;move the returned flags to eax
cmp eax,247h ;check for carry flag
jnz error ;if there's a carry, send an error
invoke WriteFile,hImage,addr dBuff,512,addr dBytesWrite,NULL ;write the 512 bytes read by int 25 to the file
inc ecx ;increment ecx, the counter
.until ecx == 2880 ;loop until the end of the floppy

dBuff is defined as dd 512 dup(?)
Regs is a DIOCREGS type
dBytesRead and dBytesWrite are both defined as dd 0
hImage is the handle to a file that was opened previously with CreateFile
hMem is a handle to VWIN32, also opened previously by CreateFile

when this code is run, it appears to access the floppy (ie: the light turns on) but does not seem to read the data from it. instead the hImage file is continuously filled until i forcefully break the loop (ctrl-c in dos prompt). i ran it once and got a 1.7 gb output before i caught on. does anyone have any idea what's happening?? thanks in advance for any help.
Posted on 2002-02-21 20:31:35 by mc`
Assuming everything else is correct, my only thought is ECX may be getting clobbered by DeviceIoControl or WriteFile. Try PUSHing ECX before the first INVOKE, and POP it after the second. Or check it out in a debugger. :)
Posted on 2002-02-21 20:45:18 by S/390
mc can I ask u question, what OS r u using...? cause I know win95 have lots of problems accessing interrupt, some of them was fixed in win95sr2, but some of them still even in ME. You can read about them in MSDN...

I found same problem when i was trying read disk sectors accesing windows interrupts through the DeviceIOControl calling VWIN32.vxd ... :(

What MS gives as solution for they announced bug, is to write 32bit dll which will call 16bit dll from which you will call your interrupts... Another words fucking mission.

Luckely winNT/2000 is much safe and with less problems system for those type of operations.

Anyways, all the luck... u will need :)
Posted on 2002-02-22 04:45:49 by notee1
For Windows 95/98/ME I have done that at:
and click
Read floppy disk A sectors with interrupt 25h.

For Windows 2000 this is close to what you would use at:
Assembly program reads master boot sector in XP/2000/95/98/ME.

I know my code is not pretty.
Posted on 2002-02-22 06:38:17 by roaknog
S/390: yeah, i just now realized that, i'll be sure to check it, thanks.

notee1: the code has been tested on 95sr2, 98, and 98se and produces the same problem on each. i saw the thing about the 16 bit dll, but i would really prefer to avoid it. and i already have a second procedure for doing the process in nt based systems.

roaknog: thanks for the examples, i read them over, but i see no real differences between my code and yours.. perhaps S/390 was right. i'll investigate later today and post my findings.

thanks to all of you
Posted on 2002-02-22 08:22:09 by mc`
ok, well, i haven't been able to test anything due to giving my win9x computer to a friend, so i have decided to post the source and compiled executable here. anyone with win9x, please test it for me and let me know of your results. simply run the exe in a command prompt with no argument to see how it's used. RadASM project file included. source is sloppy, but it's going to be rearranged and semi-optimized once it actually works.
Posted on 2002-02-23 14:30:15 by mc`
It doesn't work Win98se, the error is : "Error code 6, description : invalid handle". I tried with "dimage3 -f out.txt -d d" and "dimage3 -f out.txt -d d:".
Posted on 2002-02-23 15:18:47 by Dr. Manhattan
; changes I would make
; put windows.inc first
; add some equ's

; add more .data
county DD 0; instead of ECX
big_buf DD 18432 dup(?); instead of 512 byte buffer for the int 26h or both if you like

;change begin 9x specific code to
mov hDisk, EAX
mov dBuffSize,sizeof dBuff
.if bRev == 1
call read_file_write_disk
call read_disk_write_file

; add two procs
read_file_write_disk proc
invoke CreateFile,addr pszImg,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL ;or open it
mov hImage,eax
mov Regs.reg_EAX,0 ;pseudo registers used in DeviceIoControl, eax = drive, a: is 0, b: is 1 etc. hard coded to a: for now
mov Regs.reg_ECX,36 ;ecx = number of sectors to write
invoke ReadFile,hImage,addr big_buf,18432,addr dBytesRead,NULL ;read first 512 bytes of image file
mov ECX, county
mov Regs.reg_EDX,ecx ;sector number being operated on
mov Regs.reg_EBX,offset big_buf ;data to use
invoke DeviceIoControl,hDisk,VWIN32_DIOC_DOS_INT26,addr Regs,sizeof Regs,addr Regs,sizeof Regs,addr dBytesWrite,NULL ;write data to sector number
add county, 36
.until county == 2880 ;sectors on a standard 1.44 meg 3.5" floppy
read_file_write_disk endp

read_disk_write_file proc
invoke CreateFile,addr pszImg,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL ;create file
mov hImage,eax
mov Regs.reg_EAX,0
mov Regs.reg_ECX,1
mov ECX, county
mov Regs.reg_EDX,ecx
mov Regs.reg_EBX,offset dBuff ;pointer to buffer to hold data
invoke DeviceIoControl,hDisk,VWIN32_DIOC_DOS_INT25,addr Regs,sizeof Regs,addr Regs,sizeof Regs,addr dBytesRead,NULL ;read from disk, store in dBuff
mov eax,Regs.reg_Flags
invoke WriteFile,hImage,addr dBuff,512,addr dBytesWrite,NULL ;write dBuff to the file
inc county
.until county == 2880
read_disk_write_file endp
Posted on 2002-02-23 21:38:00 by roaknog
Dr. Manhattan: currently it's hard coded to use the a drive in 9x machines.. i'll investigate the error, but it should have been ok.. thanks for the feedback. try again as dimage3 -d a: -f test.img make sure there is a floppy in the drive too.

roaknog: yeah, i planned on moving things into procs and tidying the code up more later. right now i'm just trying to make it work. were you able to test any?
Posted on 2002-02-24 14:06:23 by mc`
Listen mc, if you ever get your code to work on all OS :)

Please try to test physical drives read/write procedures, and mail to me notee1@ravemail.co.za

Cause im still using that 16-bit code, and i would like to avoid for my partition manager.

Tx, Cya.
Posted on 2002-02-27 07:07:58 by notee1