Solved

IOCTL_DISK_GET_DRIVE_GEOMETRY fails after change of removable disk

Posted on 2003-11-18
3
722 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 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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