reading disk sector in WinNT

I was wondering how I can read a sector of a hard disk. I was hoping I could do it with CreateFile('\\.\PhysicalDrive0',...) and then read the drive with ReadFile. But that doesn't work. CreateFile creates a handle ok, but ReadFile keeps me giving error 87 (wrong parameter). Anyone any ideas?

Kind regards,

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

INFO: Direct Drive Access Under Win32 

There is a sample at 

This sample is about CD-ROM, but it is fully applicable to floppy

Floppy Sample: Accessing a Floppy Disk

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hard, floppy, CD-ROM - no difference.
When performing direct disk I/O, you must seek, read, and write in multiples of sector sizes of the device and on sector boundaries. It seems that you don't, that's why you get this error.
DjafkenAuthor Commented:
Thanks, the problem was indeed the sector size, just like you mentioned.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.