Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Defines the entry point for the DLL application.
- #include "stdafx.h"
- // Injectar desde dll SndDrv
- #include "exports.h"
- // Addy para cambiar armas
- #define WeaponMgr 0xA68F80
- BOOL WINAPI Iniciador(LPVOID param);
- // Cshell
- DWORD dllfile;
- // Entrada
- BOOL APIENTRY DllMain( HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hModule);
- // 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;
- }
- 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;
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement