

                      CRACKING -- THE ACTUAL PATCH
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

                                by Renegade


Once you've figured out where and what to patch in a program, you may want
to make your own crack for it.
Let's see two examples on how it's done.



Using the good ol' DOS this is one of the simplest patches:

__________________________________________________________________________


.model tiny
.code
radix 16
org 100

apri: lea dx, nome         ; -----\       
mov ax, 3d02               ;       \      we open the file  
int 21                     ;       /
cmp ax,02                  ; -----/
jne scrivi
scrivi: xchg bx,ax
xor cx,cx
mov cx,XXXXh               ;
mov dx,XXXXh               ;   Our offset where we want to apply the patch
mov ax,4200                ;   We point to it
int 21h
lea dx, string             ;   Load the string
mov ah,40                  ;   write to it
mov cx,XX                  ;   quantity of bytes we want to write
int 21h
esci: mov ah,3eh           ;   close file
int 21h
mov ax,4c00                ;   exit
int 21h
nome db XXX.XXX$",0        ;   name of the file
string dw XXXXh,0          ;   the actual string
end inizio
code ends


Then of course you can add a logo, a confirmation after the crack, and
every type of error message you like.




For the more advanced user :

___________________________________________________________________________


.386                           
.model flat, STDCALL            

extrn WriteFile: proc    
extrn OpenFile: proc
extrn ReadFile: proc
extrn CloseFile: proc
extrn GetLastError: proc
extrn SetFileAtributes: proc              ; our functions
extrn CreateFile: proc
extrn SetFilePointer: proc
extrn CloseHandle: proc
extrn ExitProcess: proc
extrn MessageBoxA: proc

include windows.inc                       ; the include file
                             
.data
nomefi dd ?    
file db "XXX.XXX",0                       ; name of the file
holdfile db 80h dup (0)     
   
                  
logo            db " 32-BIT ASM PATCH ",0ah,0dh
                db "      BY RENEGADE ",0ah,0dh
                db " ###########################################",0ah,0dh
                db " ASSOCIATION OF SATANIC MANIACS",0ah,0dh
                db " ###########################################",0ah,0dh
                db " by clicking OK you agree that changing this",0ah,0dh                                   
                db " program is illegal and that you want to be",0ah,0dh 
                db " arrested immediately!!!",0ah,0dh                
                db 0ah,0dh,0
                
                             
ndf             db " THERE IS NO SUCH FILE YOU FUCKING FOOL !!!!",0ah,0dh,0
bene            db " PROGRAM HAS BEEN CHANGED...",0ah,0dh
                db " I hope it was the right offset...",0ah,0dh,0
titolo          db " 32-BIT PATCH BY RENEGADE / ASM",0
bytes db XXh
fatto db 2h dup (0)
indirizzo dd 0000h                        ; offset of the file

.code
                              
inizia:   
        push MB_OKCANCEL  
        push offset titolo                ; loading the logoMSG
        push offset logo                    
        push 0                         
        call MessageBoxA                   
        cmp eax,00000002h                 
        jz esci                          
        push OF_READWRITE                
        push offset holdfile               
        push offset file               
        call OpenFile                     ; Opening the file        
        mov nomefi,eax                  
        cmp eax,-1                      
        jnz continua                         
        push MB_OK
        push offset titolo                
        push offset ndf                   ; error mex
        push 0
        call MessageBoxA                  ; display MsgBox
        jmp esci                           

continua:
        push 0                           
        push 0                           
        push dword ptr [indirizzo]        ; load the offset to patch      
        push nomefi                         
        call SetFilePointer               ; Point to it
        push 0                         
        push nomefi                       
        call ReadFile                     
        push 0                           
        push 0                           
        push dword ptr[indirizzo]         
        push nomefi                       
        call SetFilePointer                
        push 0                        
        push offset fatto             
        push offset bytes                 ; bytes to write
        push nomefi                       
        call WriteFile                    ; write to it     
        push MB_OK 
        push offset titolo  
        push offset bene 
        push 0
        call MessageBoxA                  ; load successful MSGBOX
esci:   push nomefi
        call CloseHandle                  ; close file
        push 0                         
        call ExitProcess                  ; exit
        end inizia

                        