Greless 2017-03-22 06:04 采纳率: 33.3%
浏览 3155
已采纳

C++复制文件到C:\windows\system32\drivers

有个bat文件xcopy /y %~dp0x64\43430r0nvram.txt %WINDIR%\System32\Drivers\
通过程序去调用bat文件,提示复制成功但是C盘下并没有文件。如果直接管理员运行bat文件就能复制成功C盘有文件,请问怎么回事?
1.UAC Executioin Level已经设置为 RequireAdministrator
2.直接在程序里CopyFile(_T("x64\43430r0nvram.txt"), _T("C:\Windows\System32\drivers\43430r0nvram.txt"), FALSE);也是不成功
3.C盘根目录可以,C:\windows\system32\drivers就不成功

  • 写回答

6条回答

  • Greless 2017-03-22 07:38
    关注

    if (Wow64EnableWow64FsRedirection(FALSE))
    {
    //  Any function calls in this block of code should be as concise
    //  and as simple as possible to avoid unintended results.

        ShellExecute(NULL, L"open", _T("CherryTrail\\AP6212\\Install_64_Auto.cmd"), NULL, NULL, SW_SHOWNORMAL);
        //  Immediately re-enable redirection. Note that any resources
        //  associated with OldValue are cleaned up by this call.
        if(FALSE== Wow64EnableWow64FsRedirection(TRUE))
        {
            //  Failure to re-enable redirection should be considered
            //  a criticial failure and execution aborted.
            return;
        }
    }
    https://msdn.microsoft.com/en-us/library/aa365744.aspx
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?