Announcement

Collapse
No announcement yet.

Network drives

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Network drives

    Can anyone suggest a way to determine if the %AppDir% is on a network drive. I want to install an extra file if the user is installing onto a network drive.

  • #2
    Re: Network drives

    I'm not aware of any way that this could be determined. The only way I could think of was to ask the user during the installation, possibly presenting the Select Drive screen at some point if they wanted a network drive install.

    There may be information in the Registry that could be read, however I couldn't seem to find anything.

    Comment


    • #3
      Re: Network drives

      Make a call to the Kernel32.dll

      Use the GetDriveTypeA function, if it the return result is a 4, then it is a Network Drive.




      Comment


      • #4
        Re: Network drives

        Thanks. Works fine, so long as you select _stdcall as the calling convention.

        Comment


        • #5
          Re: Network drives

          I guess I should have thrown that out there. [img]/ubbthreads/images/icons/smile.gif[/img]

          Comment


          • #6
            Worm, you deal with DLLs as they were your closest friends (I’m envious). Could you, or anybody else, tell me exactly how to call GetDriveTypeA in SUF? (Parameters and so on.) I should really like to have my app to check for a network drive in a more efficient way than to use the Select Drive screen (network drives only).

            And.. Does anybody know a working method to detect whether a network is present? (You can’t rely on %LANDomain% on NTFS systems).

            Comment


            • #7
              I don't hav SF6 installed on this machine, but GetDriveTypeA takes one parameter of the type string

              GetDriveTypeA("C:\")

              If you can't figure it out from that, let me know, and when I get home I'll fire up SF and get the actual code for you.

              Comment


              • #8
                Thx! I have tried everything from the letter “C” to escaped backslash (“C:\\”) as String1 in the SF6 input field <"String 1","String 2",1,0>. I have set String 2 to empty (without the second string parameter the app crashes). Calling convention: _stdcall. The return value is always empty.

                Comment


                • #9
                  Here is an export of the action
                  Attached Files

                  Comment


                  • #10
                    GREAT! Thank you very much, Worm.

                    It is rarely wise to execute commands you really do not understand, but thanks to your help I feel confident with the GetDriveType. Maybe I shall now be able to utilize the MS information about Windows API in another SF6 scenario. If it might be helpful to somebody else, the MS link to Windows API is found here

                    The link 'Reference' displays Functions in Alpabetical order, and here you can find the other return variables from the GetDriveType function.

                    Comment

                    Working...
                    X