Source code for Plants vs. zombie plug-ins

Source: Internet
Author: User
Code


Long setSunMoney ()
{
DWORD pId;

HWND myWnd, gameWnd;
GameWnd = FindWindow (NULL, _ T ("Chinese version of Plants vs. Zombies "));
MyWnd = FindWindow (NULL, _ T ("Plants vs. botnets "));

DWORD sun, money;
Sun = (DWORD) GetDlgItemInt (myWnd, IDC_EDIT_SUN, NULL, FALSE );
Money = (DWORD) GetDlgItemInt (myWnd, IDC_EDIT_MONEY, NULL, FALSE );
If (gameWnd = NULL)
{
// MessageBox (myWnd, _ T ("no game found! "), _ T (" Game "), MB_ OK );
Return FALSE;
}

GetWindowThreadProcessId (gameWnd, & pId );
HANDLE hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pId );
LPVOID lpOneBaseAddress = (LPVOID) 0x006a9ec0;
DWORD dwOne;
ReadProcessMemory (
Hprocess,
Lponebaseaddress,
(Lpvoid) & dwone,
Sizeof (DWORD ),
0
);

LPVOID lpTwoBaseAddress = (LPVOID) (dwOne + 0x768 );
DWORD dwTwo;

ReadProcessMemory (
HProcess,
LpTwoBaseAddress,
(LPVOID) & dwTwo,
Sizeof (DWORD ),
0
);
LPVOID lpTrueHPAddress = (LPVOID) (dwTwo + 0x5560 );
/* DWORD dwHP;
ReadProcessMemory (
HProcess,
LpTrueHPAddress,
(LPVOID) & dwHP,
Sizeof (DWORD ),
0
);*/
WriteProcessMemory (
HProcess,
LpTrueHPAddress,
(LPVOID) & sun,
Sizeof (DWORD ),
0
);

Lpvoid lponemoney = (lpvoid) 0x006a9ec0;
DWORD lponeinfo;
Readprocessmemory (hprocess, lponemoney, (lpvoid) & lponeinfo, sizeof (DWORD), 0 );
Lpvoid lptwomoney = (lpvoid) (lponeinfo + 0x82c );
DWORD lptwoinfo;
ReadProcessMemory (hProcess, lpTwoMoney, (LPVOID) & lpTwoInfo, sizeof (DWORD), 0 );
LPVOID lpThreeMoney = (LPVOID) (lpTwoInfo + 0x28 );
/* DWORD lpThreeInfo;
ReadProcessMemory (hProcess, lpThreeMoney, (LPVOID) & lpThreeInfo, sizeof (DWORD), 0 );*/
// DWORD money = 0xea60;
WriteProcessMemory (
HProcess, // HANDLE hProcess,
(LPVOID) lpThreeMoney, // LPVOID lpBaseAddress,
(LPVOID) & money, // LPVOID lpBuffer,
Sizeof (DWORD), // DWORD nSize,
0 // LPDWORD lpNumberOfBytesWritten
);

Return TRUE;
 
}

 

Code


DWORD GetWindowThreadProcessId (
HWND hWnd, // handle to window
LPDWORD lpdwProcessId // process identifier
);
 
 
BOOL ReadProcessMemory (
HANDLE hProcess, // handle to the process
LPCVOID lpBaseAddress, // base of memory area
LPVOID lpBuffer, // data buffer
Size_t nsize, // number of bytes to read
Size_t * lpnumberofbytesread // number of bytes read
);
 
Bool writeprocessmemory (
Handle hprocess, // handle to process
Lpvoid lpbaseaddress, // base of memory area
Lpvoid lpbuffer, // data buffer
Size_t nsize, // count of bytes to write
Size_t * lpnumberofbyteswritten // count of bytes written
);

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.