home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Stone / windows / stnapih.arj / FLAF.ASM < prev    next >
Assembly Source File  |  1998-02-20  |  2KB  |  83 lines

  1. Comment % This DLL represents the absolutely most abusive way of doing a DLL
  2.       Infact I doubt it even returns the right values - I sorta just
  3.       played with it till it loaded!! :)
  4.  
  5.       The "main" part should be done with some "real" code! I just didn't 
  6.       have the includes - so i sorta quick debugged the LoadLibraryA 
  7.       function and made some brutal code that would allow it to load. 
  8.       
  9.     %
  10.  
  11. .386P
  12. Locals
  13. jumps
  14.  
  15. .Model Flat ,StdCall
  16.  
  17.  
  18. ;Define the needed external functions and constants here.
  19. Extrn        GetModuleHandleA : PROC
  20. Extrn        OpenProcess     : PROC
  21. Extrn        ExitProcess     : PROC
  22. Extrn        MessageBoxA     : PROC
  23.  
  24. PUBLICDLL    FLAF
  25.  
  26. .Data                                        
  27. Godnat db "flaffer",0
  28. ReturnAddress dd 0
  29.  
  30. .Code                                  
  31. ;──────────────────────────────────────────────────────────────────────────────
  32. Main:
  33. ;    int 3h
  34.     push 0
  35.     call GetModuleHandleA
  36.  
  37.     push 0
  38.     push 0
  39.     push eax
  40.     pop eax
  41.     pop eax
  42.     pop eax
  43.     mov eax, 01
  44.     ret  0ch
  45. .data
  46.  
  47. FLAF PROC  
  48.  
  49.     jmp RunOn
  50.  
  51.     dd offset MiniIAT            ; Address of the IAT 
  52.                         ; for the debugger to find it
  53.  
  54. RunOn:
  55.     push eax                ; store EAX
  56.     mov eax, [esp+4h]            ; fetch the return address
  57.     mov [ReturnAddress], eax        ; save it
  58.     mov dword ptr [esp+4], offset return    ; change it to chain our code
  59.  
  60.     push 0                    ; show us a messagebox to say
  61.     push offset Godnat            ; it works!
  62.     push offset Godnat
  63.     push 0
  64.     call MessageBoxA
  65.  
  66.     pop eax                    ; restore EAX
  67.         
  68.     
  69.     jmp dword ptr [MiniIAT]            ; do the function
  70. return:
  71.  
  72.     push eax
  73.     mov eax, [ReturnAddress]        ; restore the original return 
  74.     mov dword ptr [esp+4], eax        ; address
  75.     pop eax
  76.     ret                    ; and return to the mother!
  77.  
  78. MiniIAT dd 0
  79.  
  80. FLAF ENDP
  81.  
  82. ;──────────────────────────────────────────────────────────────────────────────
  83. End Main