BenBE
Beiträge: 8721
Erhaltene Danke: 191
Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
|
Verfasst: Mi 23.03.05 01:46
Da ich selber daran mit Unterstützung durch uall@ogc gearbeitet hab, eh das so funktionierte, wie es sollte, hab ich mir überlegt den gefundenen Source für Exception-Handling mit reinem ASM mal zu veröffentlichen:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55:
| Function IsSoftIce1: Boolean; Asm PUSH EBP XOR EDX, EDX PUSH OFFSET @@MyHandler PUSH DWORD PTR FS:[EDX] MOV FS:[EDX], ESP MOV [EBP-$00000004], ESP
MOV EBP, 'BCHK' MOV EAX, $00000004 INT $03 CMP AL, $03 SETNZ AL
JMP @@BehindMyHandler @@MyHandler: MOV ESP, [EBP-$4]
XOR EAX, EAX @@BehindMyHandler: XOR EDX, EDX POP DWORD PTR FS:[EDX] POP EDX POP EBP
End; |
Für Try-Finally muss man nur eine Zeile ändern (gibt immer False zurück):
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53:
| Function IsSoftIce1: Boolean; Asm
PUSH EBP XOR EDX, EDX PUSH OFFSET @@MyHandler PUSH DWORD PTR FS:[EDX] MOV FS:[EDX], ESP MOV [EBP-$00000004], ESP
MOV EBP, 'BCHK' MOV EAX, $00000004 INT $03 CMP AL, $03 SETNZ AL
JMP @@BehindMyHandler @@MyHandler: MOV ESP, [EBP-$4] @@BehindMyHandler: XOR EAX, EAX
XOR EDX, EDX POP DWORD PTR FS:[EDX] POP EDX POP EBP End; |
That's it!
Moderiert von raziel: Topic aus Algorithmen, Optimierung und Assembler verschoben am Do 24.03.2005 um 09:52
Moderiert von Tino: Topic aus Neue Einträge / Hinweise / etc. verschoben am Do 26.05.2005 um 09:44
_________________ Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
|