开发者

ShellExecuteEx + runas + file access permissions

My app started new process by ShellExecuteEx with "runas" verb in order to get administrator privilegies. New process 开发者_如何学编程creates some files in the user folder, but files can't be readed by built-in users. Only administrators can access those files. Same problem on XP and Vista.

I tried to read SetNamedSecurityInfo() docs but it's too complex for newbee. Can somebody tell how to just enable file read access for built-in users ?

Thanks.


When a user creates a file, the file owner is set to that user by default. Therefore, when you run commands as the administrator that create files, those files are owned by the administrator, not you. You either need to find a smaller command to runas the administrator that doesn't create tons of files, or you need to add another runas command that changes the ownership of those files back to your user.

I must confess I don't have experience in Windows programming, as I come from the Linux world, but I'm sure someone else can help you find the suitable commands if you post some code to help us understand what you're trying to do.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜