#include <iostream>
#include <Windows.h>
usingnamespace std;
int main (int argv, int argc)
{
if(argv = NULL) {int percent = 100;} else {int percent = argv;}; // set the percent to 100 or an argument
if(percent = argv); else {cout << "Enter the speed as a %: "; cin >> percent;}
HWND hWnd = FindWindow(NULL, "World of Warcraft"); // get the window handle
if(hWnd == 0) {
cout << "\nError: WoW must be running.\n";
} else {
DWORD pid;
GetWindowThreadProcessId(hWnd, &pid); // get its process id from its window handle
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); // open the process
if(!hProcess) {
cout << "Error: Could not attach.\n";
} else {
DWORD datasize = sizeof( percent ); // get the size of the new value
(WriteProcessMemory(hProcess, (LPVOID) 0xE96AFFFFFF909090, &percent, datasize, NULL) // write the new speed
(WriteProcessMemory(hProcess, (LPVOID) 0x85F60F86F2000000, &percent, datasize, NULL)));
{
cout << "Speed set to" << percent << "%.\n";
}
CloseHandle(hProcess); // close the handle to the process
}
}
if (argv = NULL) {
main; // restart
}
return 0;
}
I searched google and couldn't find anything. Anyone know how to fix the errors?
error LNK2028: unresolved token (0A000488) "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2019: unresolved external symbol "extern "C" unsigned long __stdcall GetWindowThreadProcessId(struct HWND__ *,unsigned long *)" (?GetWindowThreadProcessId@@$$J18YGKPAUHWND__@@PAK@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowA(char const *,char const *)" (?FindWindowA@@$$J18YGPAUHWND__@@PBD0@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
You probably forgot to link something, I guess googling for the error message will help you with that.
But first fix the remaining errors:
1. The main declaration should be: int main (int argc, char** argv)
2. The equality comparison operator is ==, not =.
3. main is not a function call. It just takes main's address and discards it. You cannot call main yourself anyway, since that results in undefined behavior. Use loops instead.