Bug in ADrives() [Fixed]

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Bug in ADrives() [Fixed]

Post by Enrico Maria Giordano »

With latest W10 update the function ADrives() is no longer working. To fix the problem, please replace

Code: Select all

FILE( CHR( i ) + ":\NUL" )
with

Code: Select all

ISDISK( CHR( i ) )
Hope ISDISK() is available in Harbour too.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in ADrives()

Post by Antonio Linares »

Enrico,

I just tested:

Code: Select all

#include "FiveWin.ch"

function Main()

   XBrowser( ADrives() )
   
return nil
And it is working fine with Windows 10 Pro, version 1703, OSBuild 15063.138

What Windows 10 version are you using ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Bug in ADrives()

Post by Enrico Maria Giordano »

Antonio Linares wrote:Enrico,

I just tested:

Code: Select all

#include "FiveWin.ch"

function Main()

   XBrowser( ADrives() )
   
return nil
And it is working fine with Windows 10 Pro, version 1703, OSBuild 15063.138
What do you get? I get all the drives from C to Z after latest Windows update.
Antonio Linares wrote:What Windows 10 version are you using ?
Latest official: Windows 10 Pro 1607 14393.1066

Anyway, I think that using a specific function like ISDISK() is better than the old trick with NUL, isn't it?

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Bug in ADrives()

Post by Enrico Maria Giordano »

Now I have the same Windows version of yours (1703 build 15063.138) and the problem is not fixed.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in ADrives()

Post by Antonio Linares »

What is exactly the problem ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Bug in ADrives()

Post by Enrico Maria Giordano »

The problem is that ADrives() should return (and did before the recent Windows updates) only the existing drives in the system. In my PC it did return C, D AND E while now it wrongly returns all the drives from C to Z. Using ISDISK() instead of the NUL trick fixed the problem for me.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in ADrives()

Post by Antonio Linares »

Could you post your code using ISDISK() ?

many thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Bug in ADrives()

Post by Enrico Maria Giordano »

Here it is:

Code: Select all

function ADrives( nType )  // Thanks to EMG

   local aDisk := {}
   local i

   DEFAULT nType := 0

   if nType = 0 .OR. nType = 1
      for i = ASC( "A" ) TO ASC( "B" )
          if ISDISKETTE( CHR( i ) + ":" )
             AADD( aDisk, CHR( i ) + ":" )
          endif
      next
   endif

   if nType = 0 .OR. nType = 2
      for i = ASC( "C" ) TO ASC( "Z" )
          if ISCDROM( CHR( i ) + ":" ) .OR. ISDISK( CHR( i ) )
             AADD( aDisk, CHR( i ) + ":" )
          endif
      next
   endif

return aDisk
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in ADrives()

Post by Antonio Linares »

many thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Bug in ADrives()

Post by Antonio Linares »

Enrico,

You are right

Already included for FWH 17.05

many thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply