; GhostFix by Paul Ingemi .Model small ; 64k max size .Stack 100h ; Reserve 256 bytes for the stack .Data ; because star trek is cool verstr db "GFix v1.0n by Paul Ingemi (pingemi at wpi.edu)... ","$" foundstr db "Found packet driver.",13,10,"$" failedstr db "No packet driver found.",13,10,"$" .CODE .8086 ;----- ;macros ;----- savereg MACRO push ax push bx push cx push dx ENDM restreg MACRO pop dx pop cx pop bx pop ax ENDM patchint MACRO intnum, isr, iss savereg ; save working registers push es cli ; turn off interrupts mov ah, 035h mov al, intnum int 21h mov word ptr iss[2], es ; save old int segment mov word ptr iss[0], bx ; save old int offset push ds ; save current data segment mov ax, seg isr ; Load new routine's code segment mov ds, ax ; Point ds to segment of handler mov dx, offset isr ; Load offset of handler mov ah, 25h ; save new handler address mov al, intnum int 21h sti pop ds pop es restreg ENDM ;----- ;procedures ;----- gtap: jmp gtapstart pktline db 'PKT DRVR' ; Identifies our head patch as a packet driver myline db 'PACKET DRIVER patched by Paul!' ; facilitates debugging realpktdrvr dd 00h ; real packet driver address filehandle dw 00h ; file handle for logging oldds dw 00h ; the old ds, needed for some operations oldcx dw 00h ; the old cs oldax dw 00h ; the old ax oldsi dw 00h ; the old si filename db "gfixlog.txt",0 counter db 00h ; counter bufsize dw 00h db 'START>' pktbuffer db 256 dup(00h) ; buffer stores 256 bytes db '