Guest User

Untitled

a guest
Jun 17th, 2025
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ml NoEquipLoss_113c.asm /link /kernel /dll /emitpogophaseinfo /debug:none /noimplib /noexp /out:NoEquipLoss_113c.dll
  2.  
  3. .386
  4. .model flat,stdcall
  5. option casemap:none
  6. includelib kernel32.lib
  7.  
  8. DisableThreadLibraryCalls PROTO STDCALL :DWORD
  9. VirtualProtect PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
  10. GetModuleHandleA PROTO STDCALL :DWORD
  11.  
  12. .data
  13.     D2Game db "D2Game.dll",0
  14. .code
  15.  
  16. DllEntry proc hInstDLL:DWORD, reason:DWORD, reserved1:DWORD
  17.     local hD2Game:DWORD
  18.     local oldProtect:DWORD
  19.     local patchAddr:DWORD
  20.    
  21.     cmp reason, 1  ; DLL_PROCESS_ATTACH
  22.     jnz finish
  23.    
  24.     push hInstDLL
  25.     call DisableThreadLibraryCalls
  26.    
  27.     ; Get D2Game.dll base address
  28.     push offset D2Game
  29.     call GetModuleHandleA
  30.     test eax, eax
  31.     jz finish
  32.     mov hD2Game, eax
  33.    
  34.     ; Calculate patch address (base + 79237h)
  35.     add eax, 79237h
  36.     mov patchAddr, eax
  37.    
  38.     ; Verify the instruction is JBE (76 13)
  39.     cmp word ptr [eax], 1376h
  40.     jnz finish
  41.    
  42.     ; Change memory protection
  43.     lea eax, oldProtect
  44.     push eax                ; lpflOldProtect
  45.     push 40h                ; PAGE_EXECUTE_READWRITE
  46.     push 2                  ; dwSize (2 bytes)
  47.     push patchAddr          ; lpAddress
  48.     call VirtualProtect
  49.     test eax, eax
  50.     jz finish
  51.    
  52.     ; Apply patch (JMP 08)
  53.     mov eax, patchAddr
  54.     mov word ptr [eax], 08EBh
  55.    
  56.     ; Restore protection
  57.     lea eax, oldProtect
  58.     push eax                ; lpflOldProtect
  59.     push oldProtect         ; flNewProtect
  60.     push 2                  ; dwSize
  61.     push patchAddr          ; lpAddress
  62.     call VirtualProtect
  63.  
  64. finish:
  65.     mov eax, 1
  66.     ret 0Ch
  67. DllEntry endp
  68.  
  69. end DllEntry
Advertisement
Add Comment
Please, Sign In to add comment