Advertisement

Read/write a sector on a disk?

Started by February 01, 2001 04:10 PM
2 comments, last by Tank 23 years, 11 months ago
I'm having a bit of trouble trying to read/write a sector on a disk. I'm using the WinAPI in MSVC w/ Win98, but there's no direct functions to do this. I found the closest match to be in the WinAPI reference 'FAT32 File System' where you can use vwin32.vxd to call int 25/26 (read/write sector). Yet after days of trial and error I always get ERROR_INVALID_PARAMETER. I have the source on hand if you wnat, any help would be appreciated :D Edited by - Tank on February 1, 2001 5:15:11 PM Edit: He who makes vague topics finds few answers. -fel Edited by - felisandria on February 1, 2001 6:06:00 PM
i also had a look at those functions when i wanted to read sectors from a cd-rom. i never got them to work either. my suggestion would be to either write a dos based program to do what you want and call the program with certain parameters (a fairly slow and crude way of doing it) or write your own "VxD" to access the drive with interrupts.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
Advertisement
I don''t think you can write directly ot a sector in windows.
If I remember correctly - I think there was something like a protection for this.
Have you tried re-writing your boot-sector using "FORMAT" in DOS?

There''s a way to disable this protection, but I dont remember. Something like "LOCK" in DOS ???

This could be your problem?

To read sectors from a CD-ROM (or DVD) you can use the ASPI interface to execute scsi commands (This also works for my HDDs on a ATA100 controller, as they are considered scsi devices)

try looking for info about

WNASPI32.DLL
GetASPI32SupportInfo
SendASPI32Command

Also AKRIP''s website has a few tutorials on ASPI (its the GeoCity''s ones...I''m afraid I''ve forgoten the address)

This topic is closed to new replies.

Advertisement