Jump to content

DriveGetDrive not working as expected


Recommended Posts

The DriveGetDrive command returned all drives (option "ALL") for years now and my program could always rely on that function. Suddenly a drive letter that was created with the subst command does not appear in the list of drives anymore. And it clearly did, because I used to react to a certain subst command by reacting to new or revoked (subst /D) drive letters.

Why is that? I think this a bug because there's no way left to list ALL drive letters anymore.

And why should I use an API command for that when this was already built in for years?


 

Cheap, Fast, Good - Choose any two

Link to comment
Share on other sites

  • Developers
9 minutes ago, kristo said:

Why is that? I think this a bug because there's no way left to list ALL drive letters anymore.

And why should I use an API command for that when this was already built in for years?

Could be me but it feels there are some assumptions in there and where does the API remark come from?

You claim it has been working for years and now it doesn't anymore, so my question to you would be: What have you changed? ;)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Well I moved on to Windows 10. So that's probably it. No further assumptions made.

Try for yourself:

Point an empty drive letter to any folder with subst (for me this is subst T: c:\virtuals\drive_T)

if you check the array returned by DriveGetDrive("ALL") then you'll find not drive T: there. Any it was always there, otherwise a program that worked for many years now wouldn't have in the first place.

 

btw. No Drive command works for substituted letters anymore. You'll neither get a name nor a serial now.

Edited by kristo
Second thoughts

Cheap, Fast, Good - Choose any two

Link to comment
Share on other sites

15 minutes ago, kristo said:

This is interesting: The script starts working when I create an exe. The exe detects the virtual drive letter, while the au3 script doesn't :/

Now that doesn't seems right.

 

Cheap, Fast, Good - Choose any two

Link to comment
Share on other sites

  • Developers

I've tested here a little with this script running it from SciTE (which is running under normal credentials):

Local $aArray = DriveGetDrive("ALL")
If @error Then
    ; An error occurred when retrieving the drives.
Else
    For $i = 1 To $aArray[0]
        ; Show all the drives found and convert the drive letter to uppercase.
        ConsoleWrite($aArray[$i] & @CRLF) ;### Debug Console
    Next
EndIf

Then open a CMD box and type: subst t: d:\temp

Run the script and this is the result:

--> Press Ctrl+Alt+END to Restart or Ctrl+Break -or- Ctrl+END to Stop
c:
d:
p:
t:
+>21:10:42 AutoIt3.exe ended.rc:0

Which seems fine to me. How are you testing when running it uncompiled?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Here's a complete testscript that works for me ran from SciTE:

ShowMaps()
runwait(@ComSpec & " /c subst t: d:\temp")
ShowMaps()
runwait(@ComSpec & " /c subst t: /D")
ShowMaps()

Func ShowMaps()
    ConsoleWrite("---------" & @CRLF) ;### Debug Console
    Local $aArray = DriveGetDrive("ALL")
    If @error Then
        ; An error occurred when retrieving the drives.
    Else
        For $i = 1 To $aArray[0]
            ; Show all the drives found and convert the drive letter to uppercase.
            ConsoleWrite($aArray[$i] & @CRLF) ;### Debug Console
        Next
    EndIf
EndFunc   ;==>ShowMaps

result:

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Development\AutoIt3\programs\test\test1.au3"    
--> Press Ctrl+Alt+END to Restart or Ctrl+Break -or- Ctrl+END to Stop
---------
c:
d:
p:
---------
c:
d:
p:
t:
---------
c:
d:
p:
+>21:37:59 AutoIt3.exe ended.rc:0

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I have no idea why that would be and I am running: OS:WIN_10/  CPU:X64 OS:X64 
Which version of AutoIt3 are you running and are you running with SciTE4AutoIt3 full , in other words: is the script shelled by AutoIt3Wrapper?? 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes it is.

And as soon as I compile the script into an executable it returns the correct result. But not from within SCITE (and I just updated AutoIt and Scite to the latest stable build btw.)

Cheap, Fast, Good - Choose any two

Link to comment
Share on other sites

  • Developers

Your setup is identical to mine. (Sorry for asking but) You do have a d:\temp directory ...right?
Other than that: I am out of ideas at the moment.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...