Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ml NoEquipLoss_113c.asm /link /kernel /dll /emitpogophaseinfo /debug:none /noimplib /noexp /out:NoEquipLoss_113c.dll
- .386
- .model flat,stdcall
- option casemap:none
- includelib kernel32.lib
- DisableThreadLibraryCalls PROTO STDCALL :DWORD
- VirtualProtect PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
- GetModuleHandleA PROTO STDCALL :DWORD
- .data
- D2Game db "D2Game.dll",0
- .code
- DllEntry proc hInstDLL:DWORD, reason:DWORD, reserved1:DWORD
- local hD2Game:DWORD
- local oldProtect:DWORD
- local patchAddr:DWORD
- cmp reason, 1 ; DLL_PROCESS_ATTACH
- jnz finish
- push hInstDLL
- call DisableThreadLibraryCalls
- ; Get D2Game.dll base address
- push offset D2Game
- call GetModuleHandleA
- test eax, eax
- jz finish
- mov hD2Game, eax
- ; Calculate patch address (base + 79237h)
- add eax, 79237h
- mov patchAddr, eax
- ; Verify the instruction is JBE (76 13)
- cmp word ptr [eax], 1376h
- jnz finish
- ; Change memory protection
- lea eax, oldProtect
- push eax ; lpflOldProtect
- push 40h ; PAGE_EXECUTE_READWRITE
- push 2 ; dwSize (2 bytes)
- push patchAddr ; lpAddress
- call VirtualProtect
- test eax, eax
- jz finish
- ; Apply patch (JMP 08)
- mov eax, patchAddr
- mov word ptr [eax], 08EBh
- ; Restore protection
- lea eax, oldProtect
- push eax ; lpflOldProtect
- push oldProtect ; flNewProtect
- push 2 ; dwSize
- push patchAddr ; lpAddress
- call VirtualProtect
- finish:
- mov eax, 1
- ret 0Ch
- DllEntry endp
- end DllEntry
Advertisement
Add Comment
Please, Sign In to add comment