Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #define patch(a, v, s) _patch((void*)(a), (DWORD)(v), (s))
- BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID);
- void _patch(void*,DWORD,DWORD);
- void LoadCustomParticle(void);
- void DestroyCustomParticle(void);
- DWORD* _textLampShad64 = (DWORD*)0xC4040C;
- DWORD* _RwTTailight = (DWORD*)0xC403E8;
- const char aTailName[] = "shad_exp";
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
- {
- if(reason==DLL_PROCESS_ATTACH)
- {
- patch(0x706DA6, 0xE9, 1);
- patch(0x706DA7, (DWORD)&LoadCustomParticle - 0x706DAB, 4);
- patch(0x706F5C, 0xE9, 1);
- patch(0x706F5D, (DWORD)&DestroyCustomParticle - 0x706F61, 4);
- }
- return TRUE;
- }
- void _patch(void* pAddress, DWORD data, DWORD iSize)
- {
- unsigned long dwProtect[2];
- VirtualProtect(pAddress, iSize, PAGE_EXECUTE_READWRITE, &dwProtect[0]);
- switch(iSize)
- {
- case 1: *(BYTE*)pAddress = (BYTE)data;
- break;
- case 2: *(WORD*)pAddress = (WORD)data;
- break;
- case 4: *(DWORD*)pAddress = (DWORD)data;
- break;
- default: memset(pAddress, data, iSize);
- break;
- }
- VirtualProtect(pAddress, iSize, dwProtect[0], &dwProtect[1]);
- }
- void __declspec(naked) LoadCustomParticle()
- {
- _asm
- {
- mov _textLampShad64, eax
- push ebx
- push offset aTailName
- mov eax, 7F3AC0h
- call eax
- mov _RwTTailight, eax
- add esp, 30h
- mov eax, 706DAEh
- jmp eax
- }
- }
- void __declspec(naked) DestroyCustomParticle()
- {
- _asm
- {
- mov eax, _RwTTailight
- push eax
- mov ecx, 7F3820h
- call ecx
- add esp, 34h
- ret
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment