-
September 21st, 2009, 02:31 AM
#1
Not able to Copy files in System 32 folder Vista...!
Friends ,
I have used VC++ 2003, 2005 n 2008 on Vista 64 bit Home premium edition.
My program consists of a simple application which copied the file from one location to another (System32 folder in C:\Windows). But i keep on getting access denied error...
Hopefully someone will help me resolve this freak issue...
Thanks,
Bradd
-
September 21st, 2009, 03:56 AM
#2
Re: Not able to Copy files in System 32 folder Vista...!
I'm not a Vista user, but my first guess would be that you don't have to rights to copy the files.
-
September 21st, 2009, 04:32 AM
#3
Re: Not able to Copy files in System 32 folder Vista...!
Had it been the problem of rights then I wouldn't have been able to copy the files in explorer....
Able to copy files using batch files locally and also in explorer...
But when the same batch files is run using vc++ "Access denied error comes up"
Am I missing something....??
Pls help,
Thanks,
Bradd
-
September 21st, 2009, 04:47 AM
#4
Re: Not able to Copy files in System 32 folder Vista...!
Maybe your program have to run in admin mode.
( right-click and choose Run As Administrator)
My English is very bad. So tell me if Something I talked make u confuse.
My Ebook Store: www.coding.vn/book.php
-
September 21st, 2009, 05:11 AM
#5
Re: Not able to Copy files in System 32 folder Vista...!
I am not running an exe but instead just debugging the code...
Following is the code that i am using :-
***********************************
void main()
{
LPCWSTR source;
LPCWSTR destination;
source = L"D:\\Test\\abc.dll";
destination = L"C:\\Windows\\system32\\abc.dll";
if(!CopyFile(source, destination, FALSE))
ErrorExit(TEXT("CopyFile"));
MessageBox(NULL, L"Not Copied", L"NoCopy", MB_OK);
}
***********************************
Copyfile throws up the error....!
-
September 21st, 2009, 07:57 AM
#6
Re: Not able to Copy files in System 32 folder Vista...!
If you're debugging, you ARE running the EXE, just running it one line at a time.
-
September 21st, 2009, 08:01 AM
#7
Re: Not able to Copy files in System 32 folder Vista...!
That's right but i just wanted to clarify on the
"right click--> run as admin "
part...
Anyhow , any ideas what the problem might be..?
-
September 21st, 2009, 08:04 AM
#8
Re: Not able to Copy files in System 32 folder Vista...!
Had it been the problem of rights then I wouldn't have been able to copy the files in explorer....
CopyFile is a function that exists from the beginning. Maybe it doesn't now how to work with the Vista security levels. Try SHFileOperation. The explorer uses the same function (AFAIK).
edit : oops... after reading the posted link I noticed this:
Copies, moves, renames, or deletes a file system object. This function has been replaced in Windows Vista by IFileOperation.
Last edited by Skizmo; September 21st, 2009 at 08:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|