Home > Back-end >  How to use a used by copyfile copies the file to disk c system directory?
How to use a used by copyfile copies the file to disk c system directory?

Time:10-13

I write not success, this also can't write file system disk
# include "stdafx. H"
#include
#include
Void main ()
{
If (used by CopyFile (" C: \ \ WINDOWS \ \ 1. TXT ", "C: \ \ 2. TXT", true))
Printf (" success ");
The else printf (" error ");
}
# # # # # # # # # # # # # # # # # # # # # # this ever successful # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Char SelfFile [MAX_PATH];
Char SystemPath [512].
GetSystemDirectory (SystemPath, sizeof (SystemPath));
Strcat (SystemPath, \ \ "explorer. Exe");
GetModuleFileName (NULL, SelfFile MAX_PATH);
if(! Used by CopyFile (SelfFile SystemPath, true)) return 0;
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
CreateStringReg (HKEY_CURRENT_USER, "Software \ \ Microsoft \ \ Windows NT \ \ CurrentVersion \ ", "load", SystemPath);
After this statement I deleted in the registry then run after the value of the load, the load will not be able to load the value of the
Please answer?

CodePudding user response:

With the GetLastError and see what is wrong

CodePudding user response:

 

Try
{
AsHelp=fmMain - & gt; G_asWorkPath + temp \ \ "" + fmMain - & gt; G_asSaveID + "_Left. Dat";
//fmMain - & gt; G_msVideoLeft - & gt; LoadFromFile (asHelp);
SaveFileName=SaveToDir + fmMain - & gt; G_asSaveID + "_Left. Dat";
If (FileExists (asHelp))
Used by CopyFile (asHelp c_str (), SaveFileName c_str (), 0).
}
The catch (... ) {};


For reference only

CodePudding user response:

CodePudding user response:

CodePudding user response:

Used by CopyFile (" C: \ \ WINDOWS \ \ 1. TXT ", "C: \ \ 2. TXT", true)
To:
Used by CopyFile (" C: \ \ WINDOWS \ \ 1. TXT ", "C: \ \ 2. TXT", false)


Can see?

CodePudding user response:

The city has tried, or UAC

CodePudding user response:

There should be no permissions

CodePudding user response:

Use to_ken through UAC, literally a file is copied to the system directory to UAC, only turn off the UAC, oh

CodePudding user response:

This is Windows 7, can turn off the UAC

CodePudding user response:

Learning, my first reaction was permissions problem,

CodePudding user response:

Fd didn't ~ ~ ~ ~
  • Related