|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
TRADUCTION DU "LENGTH-DISASSEMBLER ENGINE, 32-BIT" DE ZOMBIE
Information sur la source
Description
Utilisé la fonction GetInstrLen pour connaitre la talle de instruction ASM situé a une adresse précise. Ce n'est qu'un encapsulage de la fonction ASM de ZOMBIE dans une unité Delphi
Source
- unit LDE32;
- // Original Coder :
- // LDE32, Length-Disassembler Engine, 32-bit, (x) 1999-2000 Z0MBiE
- // special edition for REVERT tool
- //
- // version 1.05
- //
- // Delphi Convertion - DevNull - 2004
- interface
- Uses types;
-
- const
- table_1: array[$00..$FF] of DWord =
- ($4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
- $4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, $4000, $4000, $0008, $0008, $1008, $1008,
- $2000, $6000, $0100, $4100, 0, 0, 0, 0,
- $0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
- $0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
- $4100, $6000, $4100, $4100, $4000, $4000, $4000, $4000,
- $4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, $2002, 0, 0, 0, 0, 0,
- $0020, $0020, $0020, $0020, 0, 0, 0, 0,
- $0100, $2000, 0, 0, 0, 0, 0, 0,
- $0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
- $2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
- $4100, $4100, $0200, 0, $4000, $4000, $4100, $6000,
- $0300, 0, $0200, 0, 0, 0, 0, 0,
- $4000, $4000, $4000, $4000, $0100, $0100, 0, 0,
- $4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
- $0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
- $2000, $2000, $2002, $0100, 0, 0, 0, 0,
- $0008, 0, $0008, $0008, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, $4000, $4000);
-
- table_0F: array[$00..$FF] of Integer =
- ($4000, $4000, $4000, $4000, -1, -1, 0, -1,
- 0, 0, 0, 0, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- $2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
- $2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
- $4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
- $4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
- 0, 0, 0, $4000, $4100, $4000, -1, -1,
- 0, 0, 0, $4000, $4100, $4000, -1, $4000,
- $4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
- -1, -1, $4100, $4000, $4000, $4000, $4000, $4000,
- $4000, $4000, -1, -1, -1, -1, -1, -1,
- 0, 0, 0, 0, 0, 0, 0, 0,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1) ;
- Function GetInstrLen(Pos : Pointer): byte;
-
- implementation
-
- Function GetInstrLen(Pos : Pointer): byte;
- Var
- pOpCode: pointer;
- asm
- mov pOpCode, Pos
- mov ecx, Pos // ECX = opcode ptr
-
- xor edx, edx // EDX = 0
- xor eax, eax // EAX = 0
-
- @@Prefix:
- and dl , not $0008
-
- mov al, [ecx]
- inc ecx
-
- or edx, DWord(table_1[eax*4])
-
- test dl, $0008
- jnz @@Prefix
-
- cmp al, 0F6h
- je @@test
- cmp al, 0F7h
- je @@test
-
- cmp al, 0CDh
- je @@int
-
- cmp al, 0Fh
- je @@0F
- @@cont:
- test dh, $8000 shr 8
- jnz @@dataw0
- @@dataw0done:
- test dh, $4000 shr 8
- jnz @@modrm
- @@exitmodrm:
- test dl, $0020
- jnz @@mem67
- @@mem67done:
- test dh, $2000 shr 8
- jnz @@data66
- @@data66done:
- mov eax, ecx
- sub eax, pOpCode
-
- and edx,$0001+$0002+$0004+$0100+$0200+$0400
- add al, dl
- add al, dh
-
- @@exit: pop ecx
- pop ebp
- ret
-
- @@test: or dh, $4000 shr 8
- test byte ptr [ecx], 00111000b // F6/F7 -- test
- jnz @@cont
- or dh, $8000 shr 8
- jmp @@cont
-
- @@int: or dh, $0100 shr 8
- cmp byte ptr [ecx], 20h
- jne @@cont
- or dh, $0400 shr 8
- jmp @@cont
-
- @@0F: mov al, [ecx]
- inc ecx
- or edx, DWord(table_0F[eax*4])
-
- cmp edx, -1
- jne @@cont
-
- @@error: mov eax, edx
- jmp @@exit
-
- @@dataw0: xor dh, $2000 shr 8
- test al, 00000001b
- jnz @@dataw0done
- xor dh, ($2000+$0100) shr 8
- jmp @@dataw0done
-
- @@mem67: xor dl, $0002
- test dl, $0010
- jnz @@mem67done
- xor dl, $0004+$0002
- jmp @@mem67done
-
- @@data66: xor dh, $0200 shr 8
- test dh, $1000 shr 8
- jnz @@data66done
- xor dh, ($0400+$0200) shr 8
- jmp @@data66done
-
- @@modrm: mov al, [ecx]
- inc ecx
-
- mov ah, al // ah=mod, al=rm
-
- and ax, 0C007h
- cmp ah, 0C0h
- je @@exitmodrm
-
- test dl, $0010
- jnz @@modrm16
-
- @@modrm32: cmp al, 04h
- jne @@a
-
- mov al, [ecx] // sib
- inc ecx
- and al, 07h
-
- @@a: cmp ah, 40h
- je @@mem1
- cmp ah, 80h
- je @@mem4
-
- cmp ax, 0005h
- jne @@exitmodrm
-
- @@mem4: or dl, $0004
- jmp @@exitmodrm
-
- @@mem1: or dl, $0001
- jmp @@exitmodrm
-
- @@modrm16: cmp ax, 0006h
- je @@mem2
- cmp ah, 40h
- je @@mem1
- cmp ah, 80h
- jne @@exitmodrm
-
- @@mem2: or dl, $0002
- jmp @@exitmodrm
- end;
- end.
unit LDE32;
// Original Coder :
// LDE32, Length-Disassembler Engine, 32-bit, (x) 1999-2000 Z0MBiE
// special edition for REVERT tool
//
// version 1.05
//
// Delphi Convertion - DevNull - 2004
interface
Uses types;
const
table_1: array[$00..$FF] of DWord =
($4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
$4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
$4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
$4000, $4000, $4000, $4000, $8000, $8000, 0, 0,
$4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
$4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
$4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
$4000, $4000, $4000, $4000, $8000, $8000, $0008, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, $4000, $4000, $0008, $0008, $1008, $1008,
$2000, $6000, $0100, $4100, 0, 0, 0, 0,
$0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
$0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
$4100, $6000, $4100, $4100, $4000, $4000, $4000, $4000,
$4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, $2002, 0, 0, 0, 0, 0,
$0020, $0020, $0020, $0020, 0, 0, 0, 0,
$0100, $2000, 0, 0, 0, 0, 0, 0,
$0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
$2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
$4100, $4100, $0200, 0, $4000, $4000, $4100, $6000,
$0300, 0, $0200, 0, 0, 0, 0, 0,
$4000, $4000, $4000, $4000, $0100, $0100, 0, 0,
$4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
$0100, $0100, $0100, $0100, $0100, $0100, $0100, $0100,
$2000, $2000, $2002, $0100, 0, 0, 0, 0,
$0008, 0, $0008, $0008, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, $4000, $4000);
table_0F: array[$00..$FF] of Integer =
($4000, $4000, $4000, $4000, -1, -1, 0, -1,
0, 0, 0, 0, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
$2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
$2000, $2000, $2000, $2000, $2000, $2000, $2000, $2000,
$4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
$4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
0, 0, 0, $4000, $4100, $4000, -1, -1,
0, 0, 0, $4000, $4100, $4000, -1, $4000,
$4000, $4000, $4000, $4000, $4000, $4000, $4000, $4000,
-1, -1, $4100, $4000, $4000, $4000, $4000, $4000,
$4000, $4000, -1, -1, -1, -1, -1, -1,
0, 0, 0, 0, 0, 0, 0, 0,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1) ;
Function GetInstrLen(Pos : Pointer): byte;
implementation
Function GetInstrLen(Pos : Pointer): byte;
Var
pOpCode: pointer;
asm
mov pOpCode, Pos
mov ecx, Pos // ECX = opcode ptr
xor edx, edx // EDX = 0
xor eax, eax // EAX = 0
@@Prefix:
and dl , not $0008
mov al, [ecx]
inc ecx
or edx, DWord(table_1[eax*4])
test dl, $0008
jnz @@Prefix
cmp al, 0F6h
je @@test
cmp al, 0F7h
je @@test
cmp al, 0CDh
je @@int
cmp al, 0Fh
je @@0F
@@cont:
test dh, $8000 shr 8
jnz @@dataw0
@@dataw0done:
test dh, $4000 shr 8
jnz @@modrm
@@exitmodrm:
test dl, $0020
jnz @@mem67
@@mem67done:
test dh, $2000 shr 8
jnz @@data66
@@data66done:
mov eax, ecx
sub eax, pOpCode
and edx,$0001+$0002+$0004+$0100+$0200+$0400
add al, dl
add al, dh
@@exit: pop ecx
pop ebp
ret
@@test: or dh, $4000 shr 8
test byte ptr [ecx], 00111000b // F6/F7 -- test
jnz @@cont
or dh, $8000 shr 8
jmp @@cont
@@int: or dh, $0100 shr 8
cmp byte ptr [ecx], 20h
jne @@cont
or dh, $0400 shr 8
jmp @@cont
@@0F: mov al, [ecx]
inc ecx
or edx, DWord(table_0F[eax*4])
cmp edx, -1
jne @@cont
@@error: mov eax, edx
jmp @@exit
@@dataw0: xor dh, $2000 shr 8
test al, 00000001b
jnz @@dataw0done
xor dh, ($2000+$0100) shr 8
jmp @@dataw0done
@@mem67: xor dl, $0002
test dl, $0010
jnz @@mem67done
xor dl, $0004+$0002
jmp @@mem67done
@@data66: xor dh, $0200 shr 8
test dh, $1000 shr 8
jnz @@data66done
xor dh, ($0400+$0200) shr 8
jmp @@data66done
@@modrm: mov al, [ecx]
inc ecx
mov ah, al // ah=mod, al=rm
and ax, 0C007h
cmp ah, 0C0h
je @@exitmodrm
test dl, $0010
jnz @@modrm16
@@modrm32: cmp al, 04h
jne @@a
mov al, [ecx] // sib
inc ecx
and al, 07h
@@a: cmp ah, 40h
je @@mem1
cmp ah, 80h
je @@mem4
cmp ax, 0005h
jne @@exitmodrm
@@mem4: or dl, $0004
jmp @@exitmodrm
@@mem1: or dl, $0001
jmp @@exitmodrm
@@modrm16: cmp ax, 0006h
je @@mem2
cmp ah, 40h
je @@mem1
cmp ah, 80h
jne @@exitmodrm
@@mem2: or dl, $0002
jmp @@exitmodrm
end;
end.
Sources du même auteur
Sources de la même categorie
Sources en rapport avec celle ci
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Comment utiliser l'instruction "Goto"? [ par Manthis ]
Salut,Je voudrais savoir comment utiliser l'instruction Goto.Je sais qu'en VB il suffit de faire:Goto Fin...(et plus loin dans le code)...Fin: instruc
Defference de type dans une instruction [ par apz ]
Salut, j'utilise la requete suivante et quand je fais passer le TQUERY1.Active a false le message suivant apparait : defferrence de type dans une inst
syntaxe attente instruction terminer [ par raylp ]
Salut à tousje débute en delphi et j'aurrai une question de débutantquelle syntaxe utiliser pour attendre qu'une intructionsoit terminer avant de pass
assembleur et delphi [ par barbulille ]
bonjour, peut-on inserer de l'assembleur dans du code delphi/kylix ?merci.le_barbu is on linusc...linusc is everywhere.
Windows XP Delphi 5 Procédures Assembleur [ par EMMENE ]
Bonjour,Je travaille maintenant sous Windows XP.J'utilise Delphi 5 et je m'aperçois que mes programmes contenant une procédure Assembleur avec Lecture
PROBLEME avec les progressbar et les thread [ par rome ]
salut, j'ai un pb sous delphi6. ACCROCHEZ VOUS Je veux executer dans mon programme, lorsque j'appuie sur 1 bouton une progressbar. Celle-ci sera b
Inport($adr) [ par Zadigon ]
bonjour, je viens de compiler une application avec delphi4 et apparament il ne reconnait pas l'instruction "Inport", quelle est la version qui reco
favoris réseau et cible [ par toutptit ]
Bonjour, Avec l'instruction Shelltreeview.path, quand je pointe sur un favori réseau je récupère un chemin du type : c:\Documents and Settings\(nomuti
comment creer une instruction a partir d'un string ? [ par thone08 ]
Bonjour j'aimerai savoir comment creer une instruction a partir d'un string a la maniere du eval() du javascript ? Mon probleme est de gerer des table
DOTNET (.NET) : Utilité, Avantages, Contraintes [ par aafi ]
Ce forum est initié à la suite des derniers messages de DELPHIPROG , MANCHESTER , et moi-même , sur le sujet n° ID29593 (par JAPEE
|
Téléchargements
Logiciels à télécharger sur le même thème :
|