Link to home
Create AccountLog in
Avatar of rcoast
rcoast

asked on

Full Trust granting for Assembly in x64

I have a very simple C# tool that grants trust to an entire directory. This tool works fine for 32bit Windows but does not work in 64bit Windows. No errors are given. I assume that I am missing something in the steps.

1. I find the Policy Level in the Security.PolicyHierarchy for "Machine"

2. I then create a new PermissionSet for "FullTrust"

3. I create a new PolicyStatement with the new PermissionSet

4. I create a new IMembershipCondition for the directory of the assembly (i.e. "c:\\program files (x86)\\product\\*")

5. I creaet a new CodeGroup with the MembershipCondition and PolicyStatement

6. I give the CodeGroup a name and description, then add it to the Machine's PolicyLevel as a child of RootCodeGroup (i.e MachinePolicyLevel.RootCodeGroup.AddChild(CodeGroup)

7. I then call SecurityManager.SavePolicy

The code runs fine, but the new MemberShip condition is not showing under the FullTrust permission set only on x64 machines. x32 machines, no problem.

What do you think?
Avatar of wackym
wackym

Hi!

How about enabling "ClickOnce Security settings" in Visual Studio project properties and setting application as "full trust application"?
You could also try signing the application with signtool...I think x64 windows requires a valid certificate for that to work (well at least with driver signing)...
Oh, and include the *.manifest files with the application...that tends to help a lot :D

Good luck!
Avatar of rcoast

ASKER

I did sign the code... but what do you mean by "x64 windows requires a valid certificate"? How is this different than 32-bit Windows?

I don't think I include the manifest files with the application. What would that matter? Why would it work in 32-bit Windows, but not 64-bit?

Thanks for your help.
SOLUTION
Avatar of wackym
wackym

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account