VISTA*在这个系统使用renamefile对文件(夹)改名, 对于普通的文件改名成功,但如果被改的是windows/program   files等系统目录的文件时,改名就会失败,movefile移动该文件(夹)也不行。 我觉得,可能是因为在vista中,更改那些文件必须要提高软件的权限吧。于是我使用了xp中关机时常用的提权函数   OpenProcessToken( 
    AdjustTokenPrivileges( 但是,这方法行不通。 我参考了网上的一款软件,叫“文件夹加密超级大师”,这是加密软件,加密后会把文件转移到根目录下,但我不知道他们用的是什么方式来移动文件,这软件的保护很深,api   spy,exescope都搞不定他。 
很疑惑,急需帮助!很疑惑,急需帮助! 谢谢大家

解决方案 »

  1.   

    在VISTA下修改文件夹是要更高的权限,最好是你这个用户有这个权限。
      

  2.   

    Vista下面引入了UAC,是全新的API,好好看看相关的资料吧。如果要修改敏感地方的文件或者文件夹,那么需要提升(elevation)自己的程序。这个是Vista的基本知识,要努力学习呀。
      

  3.   

    需要elevation
    Admin也不是最大权限的!SYSTEM才是
    UAC启用时,Admin都不能直接访问保护区,用RUN AS ADMIN或采用elevation XML manifest才可以
      

  4.   

    小弟我已测试成功了。感谢大家提供思路。谢谢,如果有更好的办法,欢迎告诉我。转载自:http://www.changblog.com/knowledge-base/55-UAC-exe-manifest.html看看相关的资料吧。Using a Manifest FileMicrosoft recommend that all executables, such as Setup programs (which need access to protected areas of Windows), should be ed as requireAdministrator. This is achieved by using a manifest file (embedded or external).You can try this yourself. Below is a valid manifest file. To  a file "Fred.exe" as requireAdministrator, save the text below to the file "Fred.exe.manifest" in the same folder as "Fred.exe". When "Fred.exe" is run under Vista User logon you will see the customary Admin approval window appear.Manifest file <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">        <assemblyIdentity version="1.0.0.0"  processorArchitecture="X86"  name="ExeName"  type="win32"/><description>elevate execution level</description>      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">       <security>          <requestedPrivileges>             <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>          </requestedPrivileges>        </security>    </trustInfo> </assembly> "Installer Detection" Policy = Automatic Elevation
    This is a funny thing the first time you see it. :-)It turns out that Windows actually examines the names of all executable you run, and if they contain the words "setup", "install", "update", "patch" etc then the executable is automatically elevated; e.g. MySetup001.exe will run elevated. I've heard of cases where a word such as "update" found within an executables resources also trigged elevation. I've also heard that Windows can recognize and elevate setup files created by InstallShield and Wise. I'm not sure of the exact heuristics used.So this is going to help older setups to work reliably under Vista.“Installer Detection” Policy = Automatic ElevationThis is a funny thing the first time you see it.  It turns out that Windows actually examines the names of all executable you run, and if they contain the words “setup”, “install”, “update”, “patch” etc then the executable is automatically elevated; e.g. MySetup001.exe will run elevated. I’ve heard of cases where a word such as “update” found within an executables resources also trigged elevation. Do I need to  all my Installer helper executables?No. Just  the main setup program. All other executables downstream will run automatically as administrator.
    Example: Setup.exe runs MyApplication.msi, which has a custom action to run MyHelper.exe, which inturn runs AnotherHelper.exe. Now if Setup.exe is ed it turns out that all other executables, right down the chain, also run elevated. And the nice thing is that you are only asked once for approval to run.Does UAC effect the built-in administrator?No. UAC mode has no effect if you are logged in as the built-in administrator.大意就是说:如果想在vista下边以相应权限(一般都是管理员权限)执行任何程序的时候,就使用这个manifest文件。将这个文件放在目标文件Fred.exe的同目录下边,并以Fred.exe.manifest命名即可。而且呢,vista会自动对文件名中有”setup”, “install”, “update”, “patch”这些关键词的文件提供方便——自动提供高级权限。如果是安装软件的话,只需要对主文件设置相应的manifest即可,其他相关文件会自动提升权限。这个manifest文件不光可以放在外边,而且也可以作文资源,内嵌在执行文件中。不光exe可以内嵌,DLL等也可。
      

  5.   

    怎么听到的消息,总是VISTA 越来越烂了!
      

  6.   

    不错,使用manifest文件是合适的方法。