一、

windows7 x64,uac会阻止copyfile到c:/windows。提示拒绝访问。

[会引起uac提示的3种情况:

  • Administrator access token checks.
  • "All access" access requests in system protected locations.
  • Data writing to protected locations, such as %ProgramFiles%, %Windir%, and HKEY_LOCAL_MACHINE\Software.]

需要将程序性的UAC Executioin Level设置为 RequireAdministrator。有两种方法

方法1:

(已测有效,当PC UAC等级较低时,会全屏变暗提示需要Administrate权限。)

Linker->Manifest File->UAC Execution Level, AsInvoker==>RequireAdministrator

方法2:

添加manifest,在manifest文件中配置 requestedExecutionLevel 为 RequireAdministrator。with one of the following.

<requestedExecutionLevel  level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

具体操作参看:http://support.microsoft.com/kb/944276/zh-cn

二、(备用)

runas法。使用SellExecuteEx方法或者ProcessStartInfo类。

引用1:在Windows Vista里面,ShellExecuteExW lpVerb的参数可以传入runas命令,使得系统调用

ShellExecuteExW 的时候,会强制将目标文件以完全admin模式启动,即使目标文件的manifest

没有申明需要完全admin权限。

引用2:ShellExecuteEx是唯一一个微软允许触发UAC的进程启动函数。在Win7下使用Createprocess,

如果发现权限不足,会直接失败,而ShellExecuteEx则是一个好的解决方法。

SHELLEXECUTEINFO shExInfo = {};
shExInfo.cbSize = sizeof(shExInfo);
shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shExInfo.hwnd = ;
shExInfo.lpVerb = _T("open"); // Operation to perform
shExInfo.lpFile = enginePath; // Application to start
shExInfo.lpParameters = szBuf; // Additional parameters
shExInfo.lpDirectory = workingPath;
shExInfo.nShow = SW_SHOW;
shExInfo.hInstApp = ;
ShellExecuteEx(&shExInfo);

或者,To execute another process through UAC elevation: you use the ProcessStartInfo class; you also enable UseShellExecute and add “runas” for Verb:

            try
{
ProcessStartInfo proc = new ProcessStartInfo();
proc.UseShellExecute = true;
proc.WorkingDirectory = @"C:\Windows\System32\";
proc.FileName = @"C:\Windows\System32\cmd.exe";
proc.Verb = "runas";
Process.Start(proc);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

三、(备用)

Service法。

引用1:改成服务程序,或者另做一个服务程序加载现有程序。

四、(非正常手段)

来自:http://bbs.pediy.com/showthread.php?t=106650&page=3

引用1:对于Win7正式版(家庭高级版、家庭基础版、Professional的简体中文)都好使。其原理简述:
          win7有一批可信的文件(white list file),这些文件的敏感行为不会触发uac.
          因此,利用explorer将自身拷贝到其中一个文件的相同目录下,这里用的是sysrep.exe,命名为它

使用的dll,sysrep.dll,然后CreateProcess sysrep.exe,使其加载dll,因为windows优先加载相同

目录下的dll而非系统目录下的,所以我们的dll得以运行。

另:http://www.pretentiousname.com/misc/win7_uac_whitelist2.html#release

五、

1.UAC: All Information Developers need about the User Account Control (UAC)

http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/dd400cb9-d5fc-41b2-ad9d-6b91ce88c766/uac-all-information-developers-need-about-the-user-account-control-uac?forum=windowssecurity

2.MSDN的系列:Designing UAC Applications for Windows Vista

http://msdn.microsoft.com/en-us/library/bb756973.aspx

3.Windows Vista Application Development Requirements for User Account Control (UAC)

http://msdn.microsoft.com/en-us/library/aa905330.aspx

4.Designing UAC Applications for Windows Vista

http://msdn.microsoft.com/en-us/library/bb756973.aspx

5.User Account Control (win7)

http://technet.microsoft.com/en-us/library/cc731416(v=ws.10).aspx

6.Deploying Application Compatibility Databases for Windows 7

http://technet.microsoft.com/en-us/library/ee732413(v=ws.10).aspx

7.Designing UAC Applications for Windows Vista

http://msdn.microsoft.com/en-us/library/bb756973.aspx

8.进程Mandatory Level检查和自我提升权限

http://www.cnblogs.com/jialiang/archive/2010/03/23/uacselfelevation.html

六、

XP中,如果admin用户登录,使用的是一个admin的访问令牌。在vista和win7的uac中,用户持有2个访问令牌access token,无论是普通用户还是administrator,explorer都使用的是普通令牌,也就是桌面是从普通令牌打开的。

这里有一件很神奇的事。就是任务管理器,进程页的显示所有用户进程项,会自动提升访问令牌为admin。。。

The ActiveX Installer Service enables enterprises to delegate ActiveX control installation for standard users. This service ensures that routine business tasks are not impeded by failed ActiveX control installations and updates. Windows Vista also includes Group Policy settings that enable IT professionals to define Host URLs from which standard users can install ActiveX controls. The ActiveX Installer Service consists of a Windows service, a Group Policy administrative template, and some changes in Internet Explorer. The ActiveX Installer Service is an optional component, and will only be enabled on client computers where it is installed.

windows7 阻止copyfile到windows目录的解决办法的更多相关文章

  1. Asp.Net 无法获取IIS拾取目录的解决办法[译]

    Asp.Net 无法获取IIS拾取目录的解决办法 作者:Jason Doucette  [MCP] 翻译:彭远志 原文地址:Fixing the cannot get IIS pickup direc ...

  2. Linux中ftp不能上传文件/目录的解决办法

    在linux中不能上传文件或文件夹最多的问题就是权限问题,但有时也不一定是权限问题了,像我就是空间不够用了,下面我来总结一些ftp不能上传文件/目录的解决办法   在排除用户组和权限等问题后,最可能引 ...

  3. 关于错误 openssl/ssl.h:没有那个文件或目录的解决办法

    原文链接:https://blog.csdn.net/kulala082/article/details/68484314 首先得安装openssl:sudo apt-get install open ...

  4. 微信小程序-没有找到 node_modules 目录的解决办法

    初次在微信开发者工具构建npm 没有找到 node_modules 目录的解决办法 第一步:设置-->项目设置-->使用npm模块 第二步:右键目录下miniprogram-->终端 ...

  5. 【转载】ubuntu和debian环境下无法挂载vmware虚拟机共享目录的解决办法

    转载自:http://www.fengfly.com/plus/view-210022-1.html 第一步,安装VMware Tools 打开虚拟机ubuntu(debian原理一样)后,首先,点击 ...

  6. the service mysql56 was not found in the Windows services的解决办法

    mysql无法启动,无法改变状态-CSDN论坛-CSDN.NET-中国最大的IT技术社区 http://bbs.csdn.net/topics/390943788   具体描述: 关闭,重启mysql ...

  7. Windows10家庭版运行应用提示”管理员已阻止你运行此应用...“的解决办法

    win10版本家庭中文版: 运行应用程序报错: 解决办法(亲试): 1.进入”控制面板“--”用户账户“--”用户账户“,选择”更改用户账户控制设置“,选择最后一项,点击”确定“按钮,如下图: 2.按 ...

  8. 8u ftp 可以连接但是无法获取目录的解决办法:无法打开传输通道。原因:由于...

    来自: http://www.3566t.com/news/dlsn/1557906.html 状态:  正在取得目录列表... 命令:  CWD xinghun 响应:  250 OK. Curre ...

  9. Visual studio加载项目时报错 尚未配置为Web项目XXXX指定的本地IIS,需要配置虚拟目录。解决办法。

    在SVN上下载工程项目.使用visual studio打开时,出现如下提示: 查找相关资料,解决办法如下: 使用记事本打开工程目录下的.csproj文件.把<UseIIS>False< ...

随机推荐

  1. ios framework 简单制作

    在制作过程中遇到的一些问题跟大家分享下,直接上步骤 制作库有分模拟器框架和真机矿机  如果报错x86_64什么的字眼就是库里面没有包含模拟器框架 模拟器:iPhone4s~5 : i386 iPhon ...

  2. MySQL数据库4 - 查看数据表

    一. 查看表的基本结构 语法:DESCRIBE/DESC TABLE_NAME 查询结果含义: Field: 字段名 Type: 字段类型 Null: 是否可以为空 Key: 是否编制索引 defau ...

  3. 简单理解Struts2中拦截器与过滤器的区别及执行顺序

    简单理解Struts2中拦截器与过滤器的区别及执行顺序 当接收到一个httprequest , a) 当外部的httpservletrequest到来时 b) 初始到了servlet容器 传递给一个标 ...

  4. Object.prototype 与 Function.prototype 与 instanceof 运算符

    方法: hasOwnProperty isPrototypeOf propertyIsEnumerable hasOwnProperty 该方法用来判断一个对象中的某一个属性是否是自己提供的( 住要用 ...

  5. UVA 12549 - 二分图匹配

    题意:给定一个Y行X列的网格,网格种有重要位置和障碍物.要求用最少的机器人看守所有重要的位置,每个机器人放在一个格子里,面朝上下左右四个方向之一发出激光直到射到障碍物为止,沿途都是看守范围.机器人不会 ...

  6. BackTrack5-r3改源

    默认源服务器是国外的,更新起来会很慢,所以要改成国内的. 所需要的文件包地址:http://pan.baidu.com/s/1i3ouc9v(64位更新包)进入BT系统图形模式-将(语言选择器)文件拖 ...

  7. 【LeetCode OJ】Symmetric Tree

    Problem Link: https://oj.leetcode.com/problems/symmetric-tree/ To solve the problem, we can traverse ...

  8. ajax的status为201依然触发jquery的error事件的问题

    昨天在调试一个ajax的时候发现,即使status是201,仍然会触发jquery的error事件.statusText是"parseerror". 通过在stackoverflo ...

  9. 如何让iOS 保持界面流畅?这些技巧你知道吗

    如何让iOS 保持界面流畅?这些技巧你知道吗   作者:ibireme这篇文章会非常详细的分析 iOS 界面构建中的各种性能问题以及对应的解决思路,同时给出一个开源的微博列表实现,通过实际的代码展示如 ...

  10. kafka性能基准测试

    转载请注明出处:http://www.cnblogs.com/xiaodf/ 1.测试环境 该benchmark用到了六台机器,机器配置如下 l  IntelXeon 2.5 GHz processo ...