Re: [WIN] GetLogicalDrives returns drives NOT present

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> 
> Dan Moyer wrote:
> > 
> > Bernie Ryan wrote:
> > > 
> > > Dan Moyer wrote:
> > > > 
> > > > 
> > > > When I wrap the function GetLogicalDrives, it works, except that it 
> > > > returns drive numbers for drives that aren't actually there yet, exactly
> > > > as
> > > > "My Computer" does, ie, usb drives that aren't currently plugged in. 
> > > > And then
> > > > if I use "dir" to see if a drive is "ready", I get a non-fatal error
> > > > message.
> > > >  
> > > > 
> > > > What I was trying to do was find out what drives are on the system, and
> > > > then
> > > > if they were removable or not.  But I don't want to check drives that
> > > > aren't
> > > > actually there.
> > > > 
> > > > Any suggestions??
> > >  
> > > Dan:
> > > 
> > >     Be sure that you unmount the USB drives before you remove them.
> > > 
> > >     Windows when it loads assigns the drive numbers when it boots
> > > 
> > >     and when you remove a USB drive it's drive number does not go
> > > 
> > >     away.
> > > 
> > >     You did't say what operating system you are using which may make a
> > > 
> > >     difference.
> > > 
> > >     Here is a link that might help:
> > > 
> > >     <a
> > >     href="http://www.uwe-sieber.de/usbstick_e.html">http://www.uwe-sieber.de/usbstick_e.html</a>
> > > 
> > > Bernie
> > 
> > Thanks for the observation & link Bernie.
> > 
> > I'm using WinXP, and 4 different "removable drives" have shown up as
> > present,
> > as far as I remember, from first time I turned on the system, before ever
> > mounting
> > any usb flashdrives.  Those are the drives that show up from
> > GetLogicalDrives.
> > Any time I mount a usb drive, I unmount it via the "safely remove hardware"
> > icon in systray, which is currently showing those same 4 not actually
> > present
> > drives; when I do mount a usb flash drive, it shows up also, and then
> > dissappears
> > from the "safely remove hardware" list after I click there to unmount it.  
> > 
> > So my problem *seems* (?) to be, how to discern if a drive that is asserted
> > 
> > by the system to be "there" is actually "ready" or not.  I thought to use 
> > "dir" to test that, but it brought up non-fatal errors which required user
> > clicks in a message box to continue, which is not desireable. 
> > 
> > Dan
> 
> GetLogicalDrives doesn't seem the way to go.
> Instead, the code at the following address is supposed to list all available
> volumes with their paths, which looks like what you are after:
> <a
> href="http://msdn2.microsoft.com/en-us/library/bb891980">http://msdn2.microsoft.com/en-us/library/bb891980</a>(VS.85).aspx
> Of course, this is in C, but the code is clean and pretty straightforward to
> translate.
> 
> CChris

Chris: 
I kinda thought *logical* drives might be at least part of the problem I'm
having, but I don't think I can decipher/translate the C code.  I'm
wondering if there isn't some way to defeat the presentation of the error
messages?  I thought there is something along those line in Win32Lib?


And Bernie wrote:

> Dan:
> 
>   Get a list of drive drive letters using a Window function.
>  
>   Then I don't know if XP would allow you to write in Euphoria Assembler
>   
>   function that would use interrupt 13 ( INT 13,1 - Disk Status ) to
> 
>   check the status of each of the drive letters that you found with
> 
>   the windows function.
> 
>   Using the interrupt would eliminate the OS error message.
> 
> Bernie

Bernie:
Yeah, I can get the list of drives ok, and if I use the "dir" function,
if equal(dir(  aDrive & "://"  ) , -1) then
         puts(1, "drive not ready")
       end if 

I actually DO get accurate results, the "phantom" drives show as not ready,
and actual mounted flashdrive shows as ready, but with error messages
allowing user to select "continue" presenting for each "not ready" drive.
  But I'd hate to have to try
to write assembly code right now if at all avoidable.  Thanks for the 
suggestion, though :)

If I could just defeat that #$% error message, my code would work!

Dan

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu