void MW2Kills()
{
EnableDebugPriv(); //Enables debug privileges so you can write data to memory address
HWND hWndTarget = FindWindow( NULL, "Modern Warfare 2"); //Looks for window with given title
if(hWndTarget == 0){
MessageBox(0, "Cannot find window.", "Error", MB_OK|MB_ICONERROR); //If null show error
}
else {
DWORD dwProcessId;
GetWindowThreadProcessId(hWndTarget, &dwProcessId); //Gets process id of specified window and outputs return to dwProcessId
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId); //Opens process with all access
if(!hProcess){
MessageBox(0, "Could not open the process!", "Error!", MB_OK|MB_ICONERROR); //If OpenProcess fails show error
}
else {
char * p; //Char pointer because of the x
p = (char*)0x00000000; //Memory address here
int newdata = 1337; //Changes MW2 kills to 1337
if(WriteProcessMemory(hProcess, p, &newdata, sizeof(newdata), NULL)){
MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION); //If memory write was successful show success box
}
else {
MessageBox(NULL, "Cannot WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR); //If memory write failed show error box
}
CloseHandle(hProcess); //Close handle
}
}
}
char * p; //Char pointer because of the x
p = (char*)0x00000000; //Memory address here
int newdata = 1337; //Changes MW2 kills to 1337
if(WriteProcessMemory(hProcess, p, &newdata, sizeof(newdata), NULL)){
MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION); //If memory write was successful show success box
}
int newdata = 1337; //Changes MW2 kills to 1337
if(WriteProcessMemory(hProcess, (LPVOID)0x00000000, &newdata, sizeof(newdata), NULL)){
MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION); //If memory write was successful show success box
}
/* VisualCustomKick Function "EnableDebugPriv" (Date 09.04.2008)
This function enables you to access the Modern Warfare 2 process
Note: You have to be logged on on an administrator account
Courtesy of Listing
http://visualcustomkick.com/forums/index.php?PHPSESSID=25bbd05938190ecf656407dcbb688e8a&action=profile;u=1
*/
void EnableDebugPriv()
{
HANDLE hToken;
LUID sedebugnameValue;
TOKEN_PRIVILEGES tkp;
if ( ! OpenProcessToken( GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )
return;
if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue ) ){
CloseHandle( hToken );
return;
}
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Luid = sedebugnameValue;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if ( ! AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof tkp, NULL, NULL ) )
CloseHandle( hToken );
}

if u can't see the pic then here Imageshack - mainur.jpg