Jump to content
Windows Dragon

Criar DLL C++

Recommended Posts

Windows Dragon

Boas pessoal... bem eu tenho este codigo em C++

#include <windows.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
using namespace std;

HWND hwnd;
HANDLE process;
HANDLE thread;
DWORD pid;
DWORD tid;

int resolution[2];
int weapon[2];
int ammo1[2];
int ammo2[2];

HDC hdc;
HBRUSH hBrush;
LOGBRUSH lbBrush;
HPEN hPen;
HFONT hFont;

int main()
{

printf("Ammo Readings By Hitman.pt\n\n");
while(!(hwnd = FindWindow(NULL,"alterIWnet")))
	Sleep(10);
printf("Finding Window Modern Warfare 2\n\n");
while(!(hdc = GetWindowDC(hwnd)))
	Sleep(10);
printf("Geting window Window\n\n");
while(!(tid = GetWindowThreadProcessId(hwnd,&pid)))
	Sleep(10);
while(!(process = OpenProcess(PROCESS_ALL_ACCESS,false,pid)))
	Sleep(10);
printf("Opening Process 0x%X\n\n",pid);
printf("Reading data\n\n",pid);
	ReadProcessMemory(process,(PVOID)(0x033C202C),&resolution,8,NULL);
ReadProcessMemory(process,(PVOID)(0x033CB3E0),&weapon,8,NULL);
ReadProcessMemory(process,(PVOID)(0x033C1FAC),&ammo1,8,NULL);
ReadProcessMemory(process,(PVOID)(0x033CE4AC),&ammo2,8,NULL);
printf("Current Mag: Weapon1: %u Weapon2: %u\n",resolution[0],weapon[0]);
printf("Other Mags Ammo: Weapon1: %u Weapon2: %u\n\n",ammo1[0],ammo2[0]);

while(FindWindow(NULL,"Modern Warfare 2"))
	Sleep(10);
ofstream out("C:\\Users\\Hitman\\Documents\\data.txt");
if( !out )
   {
      cout << "Couldn't open file."  << endl;
      return 1;
   }

out << resolution[1] + "\n" + weapon[1];

   out.close();
   system("PAUSE");
   return 0;	
}

Ja tentei usar este codigo para gerar o dll mas nem sequer consigo compilar

#include <windows.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
using namespace std;

HWND hwnd;
HANDLE process;
HANDLE thread;
DWORD pid;
DWORD tid;

int resolution[2];
int weapon[2];
int ammo1[2];
int ammo2[2];

HDC hdc;
HBRUSH hBrush;
LOGBRUSH lbBrush;
HPEN hPen;
HFONT hFont;
int codmw2_currentmag_ammo()
{
while(!(hwnd = FindWindow(NULL,"alterIWnet")))
	Sleep(10);

while(!(hdc = GetWindowDC(hwnd)))
	Sleep(10);

while(!(tid = GetWindowThreadProcessId(hwnd,&pid)))
	Sleep(10);
while(!(process = OpenProcess(PROCESS_ALL_ACCESS,false,pid)))
	Sleep(10);

ReadProcessMemory(process,(PVOID)(0x033C202C),&resolution,8,NULL);
              return resolution[0];
}

mas estou sempre a obter erro no compilador... alguma ajuda? :S

Share this post


Link to post
Share on other sites
lordfokas

Eu já tentei criar uma DLL, mas também tive problemas.

Eu uso o Dev-Cpp v4.9.9.2, e ao tentar compilar ele dava-me um erro num ficheiro incluido pelo windows.h :S

entretanto dei tantas voltas naquilo que acabei por desistir da DLL e fazer aquilo sob a forma de biblioteca, visto que era para um projecto pessoal que estou a desenvolver.

No entanto, se alguém me puder esclarecer acerca do sucedido, ficaria grato.

Atenciosamente,

LordFokas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.