0

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);

Edited by marijn1: n/a

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Tom Gunn
0

yes

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.