[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

IOCTL_DISK_GET_DRIVE_GEOMETRY fails after change of removable disk

Posted on 2003-11-18
3
Medium Priority
?
734 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 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