- 论坛徽章:
- 0
|
此程序是朋友给的可我输入中文显示出来会变成乱码应该是没有转码导致有高手能指点一下帮忙修改此程序吗
转换为UTF8 写入内存
#include <windows.h>
#include <psapi.h>
#include <iostream>
#include <Tlhelp32.h>
#include <fstream>
using namespace std;
// Debug Priviledges.
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 );
}
int main()
{
SetConsoleTitle("test."
cout <<" ||||||||||||||||||||||||||||||||||||||||||||||||||||\n";
cout <<" ~GayPimp's ";
cout <<"N";
cout <<"a";
cout <<"m";
cout <<"e";
cout <<"s";
cout <<"p";
cout <<"o";
cout <<"o";
cout <<"f";
cout <<"e";
cout <<"r";
cout <<" for 1.22.0.6328~\n";
cout <<" ||||||||||||||||||||||||||||||||||||||||||||||||||||\n" << endl;
cout <<" Do NOT use this program before playing a Battle.net Ladder game." << endl << endl;
cout <<" Yellow: |CFFFFFF00 ";
cout <<"NinjaTurtleGreen: |CFF008000" << endl;
cout <<" Pale Blue: |CFF008080 ";
cout <<"Wine Red: |CFF800000" << endl;
cout <<" Purple: |CFF800080 ";
cout <<"Mustard: |CFF808000" << endl;
cout <<" Pale Grey: |CFFC0C0C0 ";
cout <<"Grey: |CFF808080" << endl;
cout <<" Blue: |CFF0000FF ";
cout <<"Green: |CFF00FF00" << endl;
cout <<" Cyan: |CFF00FFFF ";
cout <<"Red: |CFFFF0000" << endl;
cout <<" Pink: |CFFFF0000 ";
cout <<"White: |CFFFFFFFF" << endl;
cout <<" Teal: |CFF000080 ";
cout <<"Black: |CFF000000 " << endl <<endl;
cout <<"Detecting Battle.net lobby... " << endl <<endl;
EnableDebugPriv();
TCHAR War3Name[32] = TEXT("Warcraft III"
HWND hWar3 = FindWindow(War3Name, NULL);
if(!hWar3)
{
cout << "Detect less than your side of the implementation of Program, please re-open your Program" << endl;
system( "pause" );
return 1;
}
DWORD pid;
GetWindowThreadProcessId( hWar3, &pid );
HANDLE hOpen = OpenProcess( PROCESS_ALL_ACCESS, false, pid );
if( !hOpen )
{
cout << "Can't open Warcraft III process." << endl;system( "pause" );
return 1;
}
// Finding the name's address.
DWORD Address = 764;
DWORD Buffer = 0;
DWORD WINAPI GetLastError(void);
SIZE_T BytesRead = 0;
for (;
{
ReadProcessMemory(hOpen, (LPCVOID)Address, &Buffer, 4, &BytesRead);
if(Buffer == 1463898675)
{
// ROC (3RAW).
Address -= 32;
break;
}
else if
(Buffer == 1462982736)
{
// TFT (PX3W).
Address-= 32;
break;
}
else
{
Address += 65536;
}
}
// Couting out name.
while(1)
{
char Name[16];
Name[15] = 0;
DWORD Address2 = 111665304;
for( unsigned int i = 0; i < 15; i++ )
{
ReadProcessMemory( hOpen, (LPVOID)( Address2 + i), &Buffer, 1, &BytesRead );
Name = Buffer;
}
//CloseHandle( hOpen );
cout << "Your current name is: ";
cout << Name << endl << endl;
cout << "lease type in a new name and press enter." << endl << endl;
// Changing the name.
SIZE_T BytesWritten = 0;
char NewName[16];
memset(NewName, 0, 16 );
cin.getline (NewName,16);
for( unsigned int j = 0; j < 15; j++ )
{
WriteProcessMemory( hOpen, (LPVOID)(Address + j), (LPCVOID)(NewName+ j), 1, &BytesWritten );
}
cout << "\n";
cout << "Your new name is: ";
cout << NewName << endl << endl;
}
} |
|