开发者

UAC elevated, run some not-elevated code

开发者 https://www.devze.com 2023-02-04 04:20 出处:网络
I am running an elevated UAC app. At one point in code, I want to create a file that is available for not-elevated apps. However, I cannot achieve to do this while ele开发者_开发知识库vated.

I am running an elevated UAC app. At one point in code, I want to create a file that is available for not-elevated apps. However, I cannot achieve to do this while ele开发者_开发知识库vated.

Is it possible to run just some lines not elevated (or is there a better solution for this)

Thanks in forward


How about modifying file security(ACL) to allow access by EveryOne (or All Users based on your need) - see System.Security.AccessControl.FileSecurity - check the example at down to understand how to modify ACL for file. You can generate identity ref for EveryOne using something like new SecurityIdentifier(WellKnownSidType.WorldSid, null).

0

精彩评论

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