PDA

Click to See Complete Forum and Search --> : Disk direct access possible?


Lord Orwell
Feb 13th, 2001, 02:57 AM
I have a program written in vb 1.0 for dos that i would like to convert to 32-bit windows. The problem is this: The program does low-level interrupt calls to read and write disk sectors. Is there an api call that i can use to read a disk sector? I don't care how "protected mode" a hard drive is- it must be possible, or de-frag programs wouldn't work. If anyone has a clue, i would greatly appreciate it. I have searched many api references with no luck. The only .dll programs i have found are for vb 16-bit versions and i haven't been able to get them to work with vb5.
(FYI: VB 1.0 took up 2 floppies)

Bios
Feb 14th, 2001, 06:32 AM
as for an API call...i have no idea...but...

I'm really good at finding ways for finding a bootleg way of doing things, but I don't know exactly what your program does, and also I'm curious on how you low-level interrupts using VB 1.0 (I have it, but I'd have no clue on how) so I was wondering if you could post your code here, and I'll try to find a way to make it work, and will be informed :-)

PS - I understand if you don't want to post it.

Lord Orwell
Feb 15th, 2001, 01:37 PM
No problem. I used the interruptx command, which you have to include. It gives you direct access to system registers. I cant find anyway to do this in windows 95/98 in c or vb

YoungBuck
Feb 15th, 2001, 02:02 PM
Maybe this (http://support.microsoft.com/support/kb/articles/Q100/0/27.asp?LN=EN-US&SD=gn&FR=0&qry=Direct%20Access&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=SDK3) will get you started.

Lord Orwell
Feb 16th, 2001, 02:23 AM
Thanks, i'll check it out.
My exact code(from an earlier version of my prog)
TYPE RegType
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
bp AS INTEGER
si AS INTEGER
di AS INTEGER
flags AS INTEGER
ds AS INTEGER
es AS INTEGER
END TYPE
COMMON SHARED sector_data AS STRING * 512
COMMON SHARED spare_data AS STRING * 512
COMMON SHARED info_data AS STRING * 512
DECLARE SUB interrupt (intnum%, iReg AS RegType, oReg AS RegType)
DIM iReg AS RegType
DIM oReg AS RegType
read_sector:
iReg.ax = drive
iReg.bx = VARPTR(sector_data)
iReg.cx = 1
iReg.dx = sector
iReg.es = VARSEG(sector_data)
interrupt &H25, iReg, oReg
GOSUB display_sector
RETURN

write_sector:
iReg.ax = drive
iReg.bx = VARPTR(sector_data)
iReg.cx = 1
iReg.dx = sector
iReg.es = VARSEG(sector_data)
interrupt &H26, iReg, oReg
RETURN
i can't find my newer code. The newer used interrupt 21 for support for
any size of drive. This is my back-up (always keep backups, trust me)

Lord Orwell
Feb 16th, 2001, 02:44 AM
Thanks. That was just what i wanted. Now all i have to do is learn the ins and outs of 2 functions i never saw before (both very involved ones) and decode the message hidden in the tech bulletin...

Feb 16th, 2001, 03:32 PM
Sorry... Just my $0.02:

Windows is a Multithreaded, Multitasking (and so on) OS. It won't give you (easily) direct access to system registers and this sorta stuff.... Closest you'll get in VB is (I think) in a "virtual machine mode"....

Just my $0.02... No offense!

Lord Orwell
Feb 16th, 2001, 11:35 PM
you forgot multi-paininthe***ing