开发者

GetDirectories call in msi CustomAction throws security exception ONLY when All Users

I have a custom action that I'm using to deploy some files that sit next to the msi in the handoff package. My custom action is passed the ms开发者_如何转开发i path via the OriginalDatabase parameter and I'm checking to see if there is a folder next to it. Nothing too crazy but was a pain in the butt to figure out.

Installing single or multiple users from files copied locally works like a champ. Installing single user when running the setup.exe from a network share works fine however when I install all users from a network share I'm getting a security exception.

The line in question is this:

DirectoryInfo[] subdirectories = workingDirectoryInfo.GetDirectories("Foo");

The custom action runs with SecurityAction.Demand so I should have all the access I need.

Any input anyone can provide is greatly appreciated.

Thanks, Casey


I believe when you install per-user the server side doesn't need to elevate to do the transaction so it impersonates the interactive user and can access the files. When you install for all-users it has to elevate so now it's basically running as system which would use the machine account to access the files and boom you get a permissions error.

May I ask why these files aren't in your installer? Is there not some way you can include them so you don't have to have the custom action? Otherwise you might have to write a custom action that detects the OriginalDatabase is on a network share and prevent the install unless the user copies all of the files down before running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜