Page 1 of 1

Bug in ADrives() [Fixed]

PostPosted: Wed Apr 12, 2017 8:24 am
by Enrico Maria Giordano
With latest W10 update the function ADrives() is no longer working. To fix the problem, please replace

Code: Select all  Expand view
FILE( CHR( i ) + ":\NUL" )


with

Code: Select all  Expand view
ISDISK( CHR( i ) )


Hope ISDISK() is available in Harbour too.

EMG

Re: Bug in ADrives()

PostPosted: Wed Apr 12, 2017 5:11 pm
by Antonio Linares
Enrico,

I just tested:
Code: Select all  Expand view
#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 ?

Re: Bug in ADrives()

PostPosted: Wed Apr 12, 2017 5:30 pm
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

I just tested:
Code: Select all  Expand view
#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

Re: Bug in ADrives()

PostPosted: Wed Apr 12, 2017 7:57 pm
by Enrico Maria Giordano
Now I have the same Windows version of yours (1703 build 15063.138) and the problem is not fixed.

EMG

Re: Bug in ADrives()

PostPosted: Thu Apr 13, 2017 7:26 am
by Antonio Linares
What is exactly the problem ?

Re: Bug in ADrives()

PostPosted: Thu Apr 13, 2017 8:31 am
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

Re: Bug in ADrives()

PostPosted: Thu Apr 13, 2017 9:42 am
by Antonio Linares
Could you post your code using ISDISK() ?

many thanks

Re: Bug in ADrives()

PostPosted: Thu Apr 13, 2017 9:59 am
by Enrico Maria Giordano
Here it is:

Code: Select all  Expand view
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

Re: Bug in ADrives()

PostPosted: Thu Apr 13, 2017 11:08 am
by Antonio Linares
many thanks

Re: Bug in ADrives()

PostPosted: Mon May 08, 2017 12:17 pm
by Enrico Maria Giordano
Antonio,

you forgot to fix this in the latest FWH build. :-)

EMG

Re: Bug in ADrives()

PostPosted: Mon May 08, 2017 5:00 pm
by Antonio Linares
Enrico,

You are right

Already included for FWH 17.05

many thanks :-)

Re: Bug in ADrives()

PostPosted: Mon May 08, 2017 5:21 pm
by Enrico Maria Giordano
Great, thank you! :-)

EMG