LvR 2016-09-09 05:49 采纳率: 0%
浏览 1298

C# 评测C++程序

最近想编一个C++评测软件,但不知道如何设置Process启动的程序的文件访问权限,曾经看过一个人写的,运用反射,把Process中的m_ProcessAccess改为0x0001(不知道有没有记错),就可以防止启动的线程调用或更改外部文件,但不懂什么意思,求大神帮忙!!! (在线等)

  • 写回答

1条回答

  • threenewbee 2016-09-09 15:14
    关注

    看.net源代码

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), MonitoringDescription(SR.ProcessHandle)]
        public IntPtr Handle {
            [ResourceExposure(ResourceScope.Machine)]
            [ResourceConsumption(ResourceScope.Machine)]
            get {
                EnsureState(State.Associated);
                return OpenProcessHandle(this.m_processAccess).DangerousGetHandle();
            }
        }
    

    再查msdn的api函数定义
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx

    dwDesiredAccess [in]
    The access to the process object. This access right is checked against the security descriptor for the process. This parameter can be one or more of the process access rights.
    If the caller has enabled the SeDebugPrivilege privilege, the requested access is granted regardless of the contents of the security descriptor.

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms684880(v=vs.85).aspx
    PROCESS_TERMINATE (0x0001)

    0x0001使得对于这个handle只有终止进程的权限。

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题