Alright this is the result of a couple of other questions. It appears I was doing something wrong with the suggestions and at this point have come up with an error when usi
I see what might be happening here.
Try this:
For every "FILE_SHARE_READ", change it to "FILE_SHARE_WRITE Or FILE_SHARE_READ"
From msdn:
"If you want to open a volume using \.\X:, you must use FILE_SHARE_WRITE | FILE_SHARE_READ, not just FILE_SHARE_WRITE. If you omit FILE_SHARE_READ, you'll get ERROR_NOT_SUPPORTED on most volumes"
http://msdn.microsoft.com/en-us/library/aa363858(v=vs.85).aspx
EDIT:
Your going to hate this, but the real reason it's failing is because your define for IOCTL_DISK_GET_LENGTH_INFO is wrong. Replace it with this:
((IOCTL_DISK_BASE shl 16) or (FILE_READ_ACCESS shl 14) or ($0017 shl 2) or METHOD_BUFFERED);
Which turns out to be 0x7405C not 0x80070017