nothingmag

Hello,

I encountered a problem that my program cannot CopyFile to C:\\Windows\\System32\\Drivers

even though my property is Administrator, what I got by using GetLastError is Access Deny.

But I really need to copy some files to that place,

is there any other way I can do this

Thanks!



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello,

I figured out that I have turn off "User Account Control" to copy the *.SYS to System32\\Drivers

does anyone know how to turn off UAC by code





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Aaron Margosis - MSFT

Is this file copy part of a program installation, or something that your program does every time it runs Is this just for your own system, or something you're providing to other users



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Chris Jackson - MSFT

Aaron is spot on. You can't just turn off a user's security features in code. The app needs to run elevated. If it's an installer, then either manifest the installing exe to requireAdministrator, or package in an MSI and have that pick it up. You shouldn't need to drop files in that directory at runtime.



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello,

Because the DLLs and SYSs we bought need to be put in \\System32\\drivers, otherwise it wont be able to function.

So This really bother me.

I dont really understand what you guys mean "The app needs to run elevated",

Can anyone explain thie concept

Thanks!





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Aaron Margosis - MSFT

"elevated" generally means "as administrator". Start here to learn more about User Account Control: http://www.microsoft.com/technet/windowsvista/security/uac.mspx



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello, Arron

Like I meationed at the beginning of this post threads, I am sure I am the administrator in my computer,

I really dont think I need to "elevate" myself as an administrator





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Aaron Margosis - MSFT

With Windows Vista's "User Account Control", even if you're a member of the Administrators group, everything runs with Standard User privileges unless/until you choose to allow something to run with full administrative privileges.



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello Aaron

Oh~ I see, so may I say that turning UAC off will change my privleges to Administrator

And I can change my privileges to administrator by setting some propertities

Some articles said that I can run secpol.msc to change properities about User, but I just cannot see anything.

Can you give me a clue

Thanks for reply : )





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Aaron Margosis - MSFT

Don't turn off UAC. Right-click on the app and choose "Run as administrator" instead.



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Suren Reddy

Does any one tried to do this similar task programatically. My app. is trying to copy a dll into System32 folder but Copyfile() returns error code 5(access denied). Also this is not a install app. Any suggestions please let me know.



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello,

My solution is to build a Setup.exe by InstallSheild and make it silently installed via ShellExecute to fix this program.

If you get any solution, let me know too : )





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Aaron Margosis - MSFT

Nothing executed in the user's context will elevate silently -- it will always require user interaction.

If a DLL needs to be copied into system32 (why, though ), it should be done as part of a proper application installation, not something that the end user who runs the program should be expected to do.





Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

nothingmag

Hello, What I mean is I made a setup.exe, which simply included the driver I want to throw into System32 Folder, and I will send a commend "setup.exe /s /v /qn" by ShellExecute, then it would not show any UI during the installing.



Re: Application Compatibility for Windows Vista Copy File to System32\Drivers

Konstantin Kamanin

It seems to me nothingmag wants to cheat the Vista during installation :) Why don't you consider the use of manifest-files instead of such tricks as ShellExecute calling and UAC turning off Just generate a manifest, compile it into an installation package - and the problem will be solved.