MGSoto
MGSoto

Reputation: 2373

How do I prevent users from running applications using invalid shortcuts?

I work in an environment where my department maintains various in-house applications used by our company users with varying computer skill level.

We've had numerous problems in the past where users copy shortcuts from one machine to another, or worse, use shortcuts to applications they've had emailed to them from other users.

For the most part, it doesn't really cause any problems. However, we do get support tickets occasionally because someone is trying to run a shortcut where the path is incorrect, or points to another machine on the network and loads the wrong files.

We're working on some new applications, and I'd love to find a method to prevent that from happening.

My initial thought is to somehow find a way to read how the program was executed and somehow backtrack to the location of the shortcut and find out where it was running from. At that point I could validate the shortcut and/or restrict shortcut. i.e. somehow force the program to be launched directly by exe or from a desktop shortcut only. I don't really know how to find out the shortcut-that-called-the-exe-path however...

Thoughts? Ideas?

Upvotes: 1

Views: 116

Answers (1)

Jason Higgins
Jason Higgins

Reputation: 1526

Your implementation would be left up to you, but a great preliminary check would be to examine the path property of the shortcut file. For example, if someone emailed another user a shortcut and had it placed on the desktop, the path would contain the user of the person who emailed the shortcut rather than the current user. Other than that you could try:

File.Exists(shortcutPath);

You could bundle up some simple rules like these into a console application that recursively checks all the shortcuts on a machine and if they are invalid, delete them.

Upvotes: 1

Related Questions