Solved

IOCTL_DISK_GET_DRIVE_GEOMETRY fails after change of removable disk

Posted on 2003-11-18
3
700 Views
Last Modified: 2013-12-03
I am writing a simple floppy disk dump program and try to determine the geometry of the inserted disk so that I get the correct numbers for tracks, sectors per track and so on.
However, if I insert a (formatted) floppy disk and call DeviceIoControl with IOCTL_DISK_GET_DRIVE_GEOMETRY, I only get an error back (1110) which means that the disk could have changed. I know that it changed, just how do I initialize it properly before checking the geometry?
One workaround is to instantiate a CFileFind object and search for any file on the floppy drive, but this is only a poor solution. Can anybody please point me to something smarter for this case?
I also noticed there seems to be a problem to read oversized disks (like 1.72 megabytes instead of 1.44), any smart solution for this? Operating systems are Windows 2000 and Windows XP. In Windows 9x, everything seems to work fine...

0
Comment
Question by:engelmann_media
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 9773880
>> I know that it changed, just how do I initialize it properly before checking the geometry?

Close the device handle and re-open it again.
0
 
LVL 2

Author Comment

by:engelmann_media
ID: 9778273
Unfortunately, this doesn't work. I am sorry I forgot to mention this, my fault :)
I found this solution a day ago or so and tried it, but the sequence CreateFile(...), CloseHandle(...), CreateFile(...) does not change the behaviour. I still get FALSE returned and GetLastError states 1110. Everything works fine if I use the CFileFind workaround, but I don't feel comfortable with this :)

Any other ideas?
0
 
LVL 2

Author Comment

by:engelmann_media
ID: 9781784
Okay, You were right, I'll award you the points :) The trick is to close and reopen the device right after an error. Open, close, reopen does not work in a prophylactic way ;)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.Net Loading Word 11 98
VBA Error Since Excel 2016 x64 5 92
Why I am having this error installing Visual Basic Enterprise 11 58
SignTool Error with Windows 10 5 118
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now