Page 1 of 1

Prevent executable running from network share

Posted: Tue Apr 12, 2016 6:40 pm
by bbanelli
Greetings to all,

is there a programmatic (and preferably an easy) way to prevent user running executable from network share? It's all fun and games when there is a classic network path (starting with "\\"), but what about network drives?

TIA!

Bruno

Re: Prevent executable running from network share

Posted: Tue Apr 12, 2016 7:27 pm
by NEW NicknameFJ
Hello bbanelli,

give GetDriveType_() from the WinApi a chance :D

Look here: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

Code: Select all

  
    StartDrive$ = Left(ProgramFilename(),1)    
    If GetDriveType_(StartDrive$+":\") <> #DRIVE_FIXED
      MessageRequester("STOP","Can“t start program from this device")
      End
    EndIf


Greetings

NicknameFJ

Re: Prevent executable running from network share

Posted: Tue Apr 12, 2016 8:20 pm
by bbanelli
NEW NicknameFJ wrote:Hello bbanelli,

give GetDriveType_() from the WinApi a chance :D
Thank you so much, exactly what I needed! :)