[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

IOCTL_DISK_GET_DRIVE_GEOMETRY fails after change of removable disk

Posted on 2003-11-18
3
Medium Priority
?
736 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 500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

834 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