hii i have problem with the line

CopyFile ("\\svchost.exe","c:\\%windir%\\svchost.exe",0);

i have already tryed to put _T before (
but he won't compile CopyFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR'

i want that copyfile the file copies to the windows map

srry for bad english

TCHblabla Path[] = _T("c:\\%windir%\\svchost.exe");

int DoStartupRegKey(){
	HKEY hKey;
	if( RegblaKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"), 0, 0, 0, 0, 0, &hKey, NULL) == ERROR_SUCCESS ){
		RegSetValueEx(hKey, _T("svchost"),0,REG_SZ, (const BYTE *)Path, _tcslen(Path));
	}
	return 1;
}


int WINAPI _tWinMain(blabla
	char i;
	
	DoStartupblablay();
	
	while (1){
	std::stringstream bestandsnaam;                                                          
        bestandsnaam << "svchost.exe"; 
		CopyFile ("\\svchost.exe","c:\\%windir%\\svchost.exe",0);

You tried it like this?

CopyFile(_T("\\svchost.exe","c:\\%windir%\\svchost.exe"), 0);

yes

error C2660: 'CopyFileW' : function does not take 2 arguments
warning C4002: too many actual parameters for macro '_T'

error C2660: 'CopyFileW' : function does not take 2 arguments

This is a different error. Read the documentation for CopyFile() and you will see that it takes 3 arguments, not 2.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.