Interrupt-Hook
-
hi ich wollte den int 21h hooken
.model tiny .data str db "hi,my name is...$" .code org 100h; START: mov bx,21 shl bx,2 mov ax,[bx] mov off_set_,ax mov ax,offset put mov [bx],ax add bx,2 mov ax,[bx] mov seg_ment_,ax mov bx,offset put; mov ax,ds; mov [bx],ax jmp bye; db 9ah;im moment bedeutungslos,war nur zum testen da.... off_set dw ?; seg_ment dw ?; bye: mov ah,9h mov dx,offset str int 21h; mov ah,4ch int 21h; put: mov ah,0eh mov al,'X' int 10h; db 9ah; off_set_ dw ?; seg_ment_ dw ?; ret; END START;
wenn der int 21h ausgeführt wird soll auch jedesmal put: ausgeführt werden...
-
Wie du schon bemerkt hast: int 21h und nicht int 21.
(siehe Zeile 7)
und weiter: put wird in einem Interrupt aufgerufen und nicht durch einen near call. also muss da wenn schon "iret" hin.
du solltest das dann aber eher so loesen:put:
push ax
push bx
mov ah,0eh
mov al,'X'
mov bx,000Ah
int 10h;
pop bx
pop ax
db 0eah;jmp ptr16:16
off_set_ dw ?;
seg_ment_ dw ?;
kein ret noetig, da der int 21h selbst am Ende zurueckspringt.
-
Danke!
Aber leider funzt es immer noch nicht.
Wenn ich es aus der Konsole aufrufe passiert garnichts.Im Moment hat das Programm folgenden Zustand:
.model tiny .data str db "hi,my name is...$" .code org 100h; START: mov bx,33 shl bx,2 mov ax,[bx] mov off_set_,ax mov ax,offset put mov [bx],ax add bx,2 mov ax,[bx] mov seg_ment_,ax mov bx,offset put; mov ax,ds; mov [bx],ax jmp bye; db 9ah;im moment bedeutungslos,war nur zum testen da.... off_set dw ?; seg_ment dw ?; bye: mov ah,9h mov dx,offset str int 21h; mov ah,4ch int 21h; put: push ax push bx mov ah,0eh mov al,'X' mov bx,000Ah int 10h; pop bx pop ax db 0eah; off_set_ dw ?; seg_ment_ dw ?; END START;
[ Dieser Beitrag wurde am 15.07.2002 um 14:11 Uhr von Bigor editiert. ]
-
Da hab ich wohl noch was uebersehen, sorry :p
Die Interrupt table liegt bei 00000. In deinem Programm wird der neue Interrupt pointer ins psp geschrieben...
*
mov bx,offset put;
mov ax,ds;
mov [bx],ax
jmp bye;
*
was soll das denn bringen? bx muss doch weiterhin auf den Interruptvector zeigen...nunja. Hier nochmal die nachbearbeitete Codestelle...
push ds xor ax,ax mov ds,ax mov bx,0084h ;33*4 mov ax,[word ptr ds:bx] mov [word ptr cs:off_set_],ax mov ax,offset put mov [word ptr ds:bx],ax add bx,2 mov ax,[word ptr ds:bx] mov [word ptr cs:seg_ment_],ax mov ax,cs; mov [bx],ax pop ds
...
-
Vielen Dank,
Segment register und indirekte Adressierung gucke ich mir besser nochmal an...
Aber etwas komisch is da noch etwas:Wenn ich das Programm anklicke geht alles wunderbar,aber wenn ich es aus einer Konsole heraus starten will passiert nix.Könnte das an doskey liegen?[ Dieser Beitrag wurde am 15.07.2002 um 22:43 Uhr von Bigor editiert. ]
-
Die DOS Konsole unter Windows? Wenn ich es da starte (Win98 SE) geht alles wunderbar. Welches OS benutzt du denn?
-
Hm,ich hatte das Programm Call,com genannt,daran lag es.Ich habe es jetzt in hook.com umbenannt,geht alles wunderbar.
BTW:erstaunlich wie oft der int21h ausgeführt wird.
-
Jo. sieht nett aus mit den ganzen 'X'en