MapHack源代码

很多朋友都喜欢玩魔兽争霸,找到一份MapHack源代码.修改一下之后编译通过.不过在公司.没有测试.贴在这里.留个影..

#include <windows.h>

void EnableDebugPriv();


int main()
{
    //We have to set debug privileges for our app to be allowed to OpenProcess (war3.exe)
    EnableDebugPriv();

    //Get a Handle on Warcraft III window
    HWND hwar3 = FindWindow("Warcraft III",NULL);

    if (!hwar3) //If we can't find the window...
    {
        MessageBox(0, "Run Warcarft III First!", "", MB_OK);         
        return false;
    }

    DWORD pid;
    GetWindowThreadProcessId(hwar3, &pid);     
    HANDLE hopen = OpenProcess(PROCESS_ALL_ACCESS, false, pid);

    if (!hopen) //Can't open Warcarft III's process.. Must be a PID error.
    {
  MessageBox(0, "Your getting a PID error, use LoaderZ.", "", MB_OK);
  return false;
    }

    //Now we're ready to change the memory!   
    //We remember:  6F2A3B91   66:BF 0F00     MOV DI,0x0F     
    BYTE data[] = {0xBF,0x0F,0x00};     

    bool success = WriteProcessMemory(hopen,(LPVOID)0x6F2A3B92, &data,3, NULL);  

              if(success)//Everything worked
     {
                  MessageBox(NULL, "Hack Loaded - Remember to Vist www.SkillHackerZ.com", "", MB_OK);
     }
              else//There was an error!
     {
                  MessageBox(NULL, "Couldn't load hack", "", MB_OK);
     }

 

    // Remember to be clean
     CloseHandle(hopen);
    //Done!
    return true; 
}  

 

 

 

void EnableDebugPriv()
{     

    HANDLE hToken;     

    LUID sedebugnameValue;     

    TOKEN_PRIVILEGES tkp;

    OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken);

    LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue);

    tkp.PrivilegeCount = 1;     

    tkp.Privileges[0].Luid = sedebugnameValue;     

    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

    AdjustTokenPrivileges(hToken, false, &tkp, sizeof tkp, NULL, NULL);

    CloseHandle(hToken); 
}

posted @ 2008-06-27 14:42  brilliance-Nick  阅读(1787)  评论(5)    收藏  举报