Ok, thanks for all the info,I used info from all the tutorials/base/source, its my first try (detected by using mlang.dll and SndDrv.dll :| ) but I want to share it with you, to see my flaws,
all the coding its on the dllmain.cpp source file:
I use the SndDrv inject/load from other post, so Ive included the exportsh / exports.def, modified the linker settings.
I define an 'Addy' for the weapon changing pointers
Code:
#include "stdafx.h"
// Injectar desde dll SndDrv
#include "exports.h"
// Addy para cambiar armas
#define WeaponMgr 0xA68F80
BOOL WINAPI Iniciador(LPVOID param);
// Cshell (this is fine?)
DWORD dllfile;
THis is the dll main entry, I create a thread with my other function
Code:
// Entrada
BOOL APIENTRY DllMain( HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// Lanzar hilo del iniciador
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Iniciador, NULL, NULL, NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
// Nada
break;
}
return TRUE;
}
Wait 9.8 secs, until the cshell module its loaded, keeps calling the thread, when the cshell module its loaded it calls the hack function (principal).
Code:
BOOL WINAPI Iniciador(LPVOID) {
// Esperar a que se cargue el módulo Cshell
Sleep(9800);
try {
dllfile = (DWORD)GetModuleHandleA("Cshell.dll");
// Si no se ha cargado ir a la excepción 1
if(dllfile == false) {
throw 1;
}
}
catch (int error) {
switch(error) {
case 1:
// Si el módulo CShell no se ha cargado, crear un nuevo hilo (Iniciador)
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Iniciador, NULL, NULL, NULL);
break;
default:
//Error!
return false;
}
}
// Beep indicador
Beep(1000,1000);
// Si el módulo ya se cargó, iniciar el hilo principal
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Principal, NULL, NULL, NULL);
return true;
}
I just change m4a1 for a m4a1-a silver :O
Code:
DWORD WINAPI Principal(LPVOID param) {
DWORD pWeaponMgr = *(PDWORD)(dllfile+WeaponMgr);
if (pWeaponMgr){
DWORD* m4a1 = (DWORD*)((*(DWORD*)(dllfile + WeaponMgr))+11*4);
DWORD* m4a1asilver = (DWORD*)((*(DWORD*)(dllfile + WeaponMgr))+351*4);
*m4a1 = *m4a1asilver;
}
return true;
}
Well, its detected, I dont want to use any other injector, burn my code then.. xD
Formated Source:
[C++] RSHCK12 - Pastebin.com