views:

773

answers:

4

Application in question is .Net 2.0 Framework WinForms. It is supposed to work on large user base (installation from CD). Installation done using InnoSetup.

On two machines, application does not accept Drag & Drop (both application and source of D&D have same elevation level).

By adding Read & Read&Execute rights to INTERACTIVE SID for application shortcut, this problem appears to be solved.

Question: how adding those rights and D&D are related and how to check / set those rights in Installation process?

A: 

Just a shot in the dark, but is the [STAThread] attribute present on your application's Main() method? Without it, drag and drop won't work at all. (Although this fails to explain the change in behavior with the change of rights on INTERACTIVE SID).

Guido Domenici
Yes, of course, it is there. Also, this problem is just on 2 (out of 50 tested) machines.
Dejan Vesic
Yes, but threading issues can have a random behavior with Windows.Forms. May work on some machines and fail on others.
AMissico
A: 

You should run the exe file for the projrct directly and outside of the environment of Visual Studion .NET, I'm working on a Windows Vista platform.

Amir Hussein [email protected]

Amir Hussein
+1  A: 

What is the difference between the ".NET Framework 2.0 Configuration" runtime security policy of working and non-working machines?

AMissico
+1  A: 

You have two questions here:

  1. how adding those rights and D&D are related and ...

This I'm totally unsure about. We use D&D in our WinForm app to/from the shell and Outlook without any issues in Vista. I'm not even certain the ACL change you suggest will be certain to fix whatever issue your having.

  1. how to check / set those rights in Installation process?

The easy way to do this is to create a .Net install class and add the following code:

 public static void ReplacePermissions(string filepath, WellKnownSidType sidType, FileSystemRights allow)
 {
  FileSecurity sec = File.GetAccessControl(filepath);
  SecurityIdentifier sid = new SecurityIdentifier(sidType, null);
  sec.PurgeAccessRules(sid); //remove existing
  sec.AddAccessRule(new FileSystemAccessRule(sid, allow, AccessControlType.Allow));
  File.SetAccessControl(filepath, sec);
 }
csharptest.net