lo mismo que dice el de arriba xd sustituye el system("PAUSE > NULL"); por system("pause");
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúchar str[10];
strcpy( str, "test");
std::cout<<str<<std::endl;
str[2] = '\0';
std::cout<<str<<std::endl;
bool SPRITE::LoadBMP(const char * path, GLuint * texture)
{
/**/
std::ifstream img(path, std::ios::binary);
if( !img )
return(False);
/**/
BITMAPINFOHEADER imgHeader;
BITMAPFILEHEADER imgInfo;
img.read( (char*)&imgHeader,sizeof(BITMAPFILEHEADER) );
img.read( (char*)&imgInfo, sizeof( BITMAPINFOHEADER ) );
/**/
if (imgHeader.bfType != 0x4D42)
{
img.close();
return(False);
}
/**/
int W = imgInfo.biWidth;
int w = 4* ( ( W * 24 + 31 ) /32 );
int h = imgInfo.biHeight;
int size = abs(w*h);
/**/
BYTE * pix = new BYTE[size];
img.seekg(imgHeader.bfOffBits);
img.read( (char*)pix, size );
/**/
BYTE * data = new BYTE[size];
bool done = true;
switch(imgInfo.biBitCount)
{
case 24:
BMP_24_TO_24( pix, data, (W*h) );
}
/**/
if( done )
{
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, W, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glBindTexture(GL_TEXTURE_2D, NULL);
}
/**/
delete[] pix;
delete[] data;
/**/
return(True);
}
void SPRITE::BMP_24_TO_24( BYTE * data, BYTE * new_data, int Size )
{
int index = 0;
do
{
new_data[(index*3)+0] = data[(index*3)+2];
new_data[(index*3)+1] = data[(index*3)+1];
new_data[(index*3)+2] = data[(index*3)+0];
index++;
}while( index < Size );
}
bool SPRITE::LoadBMP(const char * path, GLuint * texture)
{
std::ifstream img(path, std::ios::binary);
if( !img )
return(False);
BITMAPFILEHEADER imgHeader;
BITMAPINFOHEADER imgInfo;
img.read( (char*)&imgHeader,sizeof(BITMAPFILEHEADER) );
img.read( (char*)&imgInfo, sizeof( BITMAPINFOHEADER ) );
if (imgHeader.bfType != 0x4D42)
return(False);
int size = ( imgInfo.biSizeImage );
BYTE * pix =new BYTE[size];
img.read( (char*)pix, size );
img.close();
BYTE * data = new BYTE[size];
for (int i = 0; i < size; i += 3)
{
data[i+0] = pix[i+2];
data[i+1] = pix[i+1];
data[i+2] = pix[i+0];;
}
unsigned int w = imgInfo.biWidth;
unsigned int h = imgInfo.biHeight;
glGenTextures(1, texture);
glBindTexture(GL_TEXTURE_2D, *texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glBindTexture(GL_TEXTURE_2D, NULL);
return(True);
}
#include "stdafx.h"
#include "util.h"
#include <tlhelp32.h>
#include <shlwapi.h>
#define PROCESS_NAME "victima.exe"
int readMemory(DWORD pId);
DWORD getModuleBase(DWORD pId, char[64]);
DWORD getProcessId(IN PCHAR szExeName);
int main()
{
DWORD pId=getProcessId(PROCESS_NAME);
if(!pId)
return(0);
int result=readMemory(pId);
std::cout<<result<<std::endl;
system("pause");
return 0;
}
int readMemory(DWORD pId)
{
int memory;
int memory1;
int memory2;
int memory3;
int memory4;
int memory5;
int result;
HANDLE hProc = OpenProcess(PROCESS_VM_READ, FALSE, pId);
DWORD baseAddress = getModuleBase( pId, PROCESS_NAME )+0x00017154;
ReadProcessMemory(hProc, (LPVOID)(baseAddress),(LPVOID)&memory,4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(memory+0x180),(LPVOID) &memory1, 4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(memory1+0x4fC),(LPVOID) &memory2, 4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(memory2+0x624),(LPVOID) &memory3, 4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(memory3+0x51C),(LPVOID) &memory4, 4, NULL);
ReadProcessMemory(hProc,(LPCVOID)(memory4+0x8),(LPVOID) &memory5, 4, NULL);
std::cout<<memory5<<std::endl; // Fuck yeah xd
return(0);
}
DWORD getProcessId(IN PCHAR szExeName)
{
DWORD dwRet = 0;
DWORD dwCount = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 pe = {0};
pe.dwSize = sizeof(PROCESSENTRY32);
BOOL bRet = Process32First(hSnapshot, &pe);
while (bRet)
{
if (!_stricmp(cw(pe.szExeFile), szExeName))
{
dwCount++;
dwRet = pe.th32ProcessID;
}
bRet = Process32Next(hSnapshot, &pe);
}
if (dwCount > 1)
dwRet = 0xFFFFFFFF;
CloseHandle(hSnapshot);
}
return dwRet;
}
DWORD getModuleBase(DWORD pId,char ModuleName[64])
{
char mModuleName[36];
MODULEENTRY32 mModule;
HANDLE hTool = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pId);
mModule.dwSize = sizeof( MODULEENTRY32 );
BOOL bModule = Module32First(hTool, &mModule);
BOOL founded = false;
strcpy(mModuleName,cw(mModule.szModule));
while(bModule)
{
if(!strcmp(ModuleName,mModuleName))
{
founded = true;
break;
}
strcpy(mModuleName,cw(mModule.szModule));
bModule = Module32Next(hTool, &mModule);
}
CloseHandle( hTool );
if(!founded)
return(0);
return((DWORD)mModule.modBaseAddr);
}
#include "stdafx.h"
#include "util.h"
#include <tlhelp32.h>
#include <shlwapi.h>
#define PROCESS_NAME "victima.exe"
int readMemory(DWORD pId);
DWORD getProcessId(IN PCHAR szExeName);
int main()
{
DWORD pId=getProcessId(PROCESS_NAME);
if(!pId)
return(0);
int result=readMemory(pId);
std::cout<<result<<std::endl;
system("pause");
return 0;
}
int readMemory(DWORD pId)
{
int hex=0x0016FAC8, // esto lo obtengo con cheat engine
int offset = -8; // esto lo obtengo con cheat engine
int memory,pointerBase,result;
HANDLE hProc = OpenProcess(PROCESS_VM_READ, FALSE, pId);
ReadProcessMemory(hProc, (LPVOID)hex, &memory, 4, NULL);
pointerBase = memory-offset;
ReadProcessMemory(hProc, (LPVOID)pointerBase, &result,4, NULL);
return(result);
}
DWORD getProcessId(IN PCHAR szExeName)
{
DWORD dwRet = 0;
DWORD dwCount = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 pe = {0};
pe.dwSize = sizeof(PROCESSENTRY32);
BOOL bRet = Process32First(hSnapshot, &pe);
while (bRet)
{
if (!_stricmp(cw(pe.szExeFile), szExeName))
{
dwCount++;
dwRet = pe.th32ProcessID;
}
bRet = Process32Next(hSnapshot, &pe);
}
if (dwCount > 1)
dwRet = 0xFFFFFFFF;
CloseHandle(hSnapshot);
}
return dwRet;
}
wchar_t * wc(const char* word)
{
size_t newsize = strlen(word) + 1;
wchar_t * wcs = new wchar_t[newsize];
size_t convertedChars = 0;
mbstowcs_s(&convertedChars, wcs, newsize, word, _TRUNCATE);
return( wcs );
}
char * cw(const wchar_t* word)
{
size_t newsize = wcslen(word) + 1;
char * wcs = new char[newsize];
size_t convertedChars = 0;
wcstombs_s(&convertedChars, wcs, newsize, word, _TRUNCATE);
return( wcs );
}
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
int num=1000;
while(num>0)
{
std::cout<<num<<std::endl;
num-=10;
system("pause");
}
return 0;
}