Just trying to copy a file using CopyFile() function from the current directory to C:\windows\system32\drivers.
I wrote also manifest with "requestedExecutionLevel level="highestAvailable"" in it and I run mt to add it to resulting executable.
When I try to run it, Windows 7 UAC dialog popping out, I press "Yes", but CopyFile() returning "Access Denied" error. What is wrong? What should I check?
My manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3">
<v3:security>
<v3:requestedPrivileges>
<v3:requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</v3:requestedPrivileges>
</v3:security>
</v3:trustInfo>
</assembly>
My piece of C code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
if (CopyFile ("aaa.sys", "C:\\windows\\system32\\drivers", FALSE)==FALSE)
ErrorExit ("CopyFile");