Prevent executable running from network share

Windows specific forum
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 544
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Prevent executable running from network share

Post 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
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
NEW NicknameFJ
New User
New User
Posts: 6
Joined: Fri Sep 04, 2015 8:32 pm

Re: Prevent executable running from network share

Post 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
User avatar
bbanelli
Enthusiast
Enthusiast
Posts: 544
Joined: Tue May 28, 2013 10:51 pm
Location: Europe
Contact:

Re: Prevent executable running from network share

Post by bbanelli »

NEW NicknameFJ wrote:Hello bbanelli,

give GetDriveType_() from the WinApi a chance :D
Thank you so much, exactly what I needed! :)
"If you lie to the compiler, it will get its revenge."
Henry Spencer
https://www.pci-z.com/
Post Reply