mirror of https://github.com/x64dbg/zydis
Minor bugfixes and refactorings
* Fixed some instruction Definitions * Implemented a primitive diffing-mode to compare different versions of the instruction-database (InstructionEditor)
This commit is contained in:
parent
317976afbf
commit
4c911f91b9
|
@ -1,4 +1,4 @@
|
|||
object frmGenerator: TfrmGenerator
|
||||
object frmCodeGenerator: TfrmCodeGenerator
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsDialog
|
|
@ -1,4 +1,4 @@
|
|||
unit formGenerator;
|
||||
unit formCodeGenerator;
|
||||
|
||||
interface
|
||||
|
||||
|
@ -8,7 +8,7 @@ uses
|
|||
Vcl.ComCtrls, Zydis.InstructionEditor;
|
||||
|
||||
type
|
||||
TfrmGenerator = class(TForm)
|
||||
TfrmCodeGenerator = class(TForm)
|
||||
GroupBox: TGroupBox;
|
||||
btnClose: TButton;
|
||||
btnGenerate: TButton;
|
||||
|
@ -35,7 +35,7 @@ type
|
|||
end;
|
||||
|
||||
var
|
||||
frmGenerator: TfrmGenerator;
|
||||
frmCodeGenerator: TfrmCodeGenerator;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -46,12 +46,12 @@ uses
|
|||
|
||||
{ TfrmGenerator }
|
||||
|
||||
procedure TfrmGenerator.btnCloseClick(Sender: TObject);
|
||||
procedure TfrmCodeGenerator.btnCloseClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmGenerator.btnGenerateClick(Sender: TObject);
|
||||
procedure TfrmCodeGenerator.btnGenerateClick(Sender: TObject);
|
||||
var
|
||||
Generator: TCodeGenerator;
|
||||
Statistics: TCodeGeneratorStatistics;
|
||||
|
@ -72,7 +72,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmGenerator.GeneratorWork(Sender: TObject; WorkCount: Integer);
|
||||
procedure TfrmCodeGenerator.GeneratorWork(Sender: TObject; WorkCount: Integer);
|
||||
begin
|
||||
pbTotalProgress.Position := pbTotalProgress.Max - pbCurrentOperation.Max + WorkCount;
|
||||
pbCurrentOperation.Position := WorkCount;
|
||||
|
@ -82,7 +82,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmGenerator.GeneratorWorkEnd(Sender: TObject);
|
||||
procedure TfrmCodeGenerator.GeneratorWorkEnd(Sender: TObject);
|
||||
begin
|
||||
lblOperationName.Caption := '';
|
||||
pbTotalProgress.Position := pbTotalProgress.Max;
|
||||
|
@ -90,7 +90,7 @@ begin
|
|||
Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
procedure TfrmGenerator.GeneratorWorkStart(Sender: TObject; const OperationName: String;
|
||||
procedure TfrmCodeGenerator.GeneratorWorkStart(Sender: TObject; const OperationName: String;
|
||||
OperationCount, OperationNumber: Integer; MinWorkCount, MaxWorkCount: Integer);
|
||||
begin
|
||||
lblOperationName.Caption := OperationName;
|
|
@ -51,7 +51,7 @@ object frmMain: TfrmMain
|
|||
ToolbarName = 'barView'
|
||||
end
|
||||
item
|
||||
ToolbarName = 'barGenerator'
|
||||
ToolbarName = 'barTools'
|
||||
end>
|
||||
Index = 0
|
||||
end
|
||||
|
@ -243,6 +243,8 @@ object frmMain: TfrmMain
|
|||
OnGetImageIndex = EditorTreeGetImageIndex
|
||||
OnKeyDown = EditorTreeKeyDown
|
||||
OnMouseUp = EditorTreeMouseUp
|
||||
ExplicitLeft = 370
|
||||
ExplicitTop = 133
|
||||
Columns = <
|
||||
item
|
||||
Position = 0
|
||||
|
@ -406,6 +408,10 @@ object frmMain: TfrmMain
|
|||
Visible = True
|
||||
ItemName = 'lbMnemonicFilter'
|
||||
end
|
||||
item
|
||||
Visible = True
|
||||
ItemName = 'lbDiffingMode'
|
||||
end
|
||||
item
|
||||
BeginGroup = True
|
||||
Distributed = False
|
||||
|
@ -423,10 +429,10 @@ object frmMain: TfrmMain
|
|||
Visible = True
|
||||
WholeRow = False
|
||||
end
|
||||
object barGenerator: TdxBar
|
||||
Caption = 'Generator'
|
||||
object barTools: TdxBar
|
||||
Caption = 'Tools'
|
||||
CaptionButtons = <>
|
||||
DockedLeft = 754
|
||||
DockedLeft = 806
|
||||
DockedTop = 0
|
||||
FloatLeft = 1118
|
||||
FloatTop = 8
|
||||
|
@ -435,7 +441,7 @@ object frmMain: TfrmMain
|
|||
ItemLinks = <
|
||||
item
|
||||
Visible = True
|
||||
ItemName = 'lbGenerate'
|
||||
ItemName = 'lbCodeGenerator'
|
||||
end>
|
||||
OneOnRow = False
|
||||
Row = 0
|
||||
|
@ -565,13 +571,13 @@ object frmMain: TfrmMain
|
|||
ImageIndex = 5
|
||||
OnClick = bbDeleteDefinitionClick
|
||||
end
|
||||
object lbGenerate: TdxBarLargeButton
|
||||
object lbCodeGenerator: TdxBarLargeButton
|
||||
Caption = 'Code Generator'
|
||||
Category = 0
|
||||
Hint = 'Code Generator'
|
||||
Visible = ivAlways
|
||||
LargeImageIndex = 5
|
||||
OnClick = lbGenerateClick
|
||||
OnClick = lbCodeGeneratorClick
|
||||
AutoGrayScale = False
|
||||
SyncImageIndex = False
|
||||
ImageIndex = 3
|
||||
|
@ -692,6 +698,18 @@ object frmMain: TfrmMain
|
|||
ImageIndex = 7
|
||||
OnClick = bbCollapseLeafClick
|
||||
end
|
||||
object lbDiffingMode: TdxBarLargeButton
|
||||
Caption = 'Diffing Mode'
|
||||
Category = 0
|
||||
Hint = 'Diffing Mode'
|
||||
Visible = ivAlways
|
||||
AllowAllUp = True
|
||||
ButtonStyle = bsChecked
|
||||
LargeImageIndex = 8
|
||||
OnClick = lbDiffingModeClick
|
||||
SyncImageIndex = False
|
||||
ImageIndex = 12
|
||||
end
|
||||
end
|
||||
object SkinController: TdxSkinController
|
||||
SkinName = 'Seven'
|
||||
|
@ -1145,6 +1163,43 @@ object frmMain: TfrmMain
|
|||
FFFFCED0D2FF92908EFF1211111E000000000000000000000000000000000000
|
||||
000000000000000000000808080D656361A9959291FF959291FF959291FF9592
|
||||
91FF656361A90808080D00000000000000000000000000000000}
|
||||
end
|
||||
item
|
||||
Image.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000000000000000000000000000000000000000000000000
|
||||
0000000000330000003300000033000000330000000000000000000000220000
|
||||
003300000033000000330000003300000033000000330000002C000000000000
|
||||
00003C3E40FF818283FF7C7D80FF767B83FF000000000000002D7A572BBBB681
|
||||
41FFB68141FFB68141FFB68141FFB68141FFB78242FF9E723BE1000000000000
|
||||
00330000003300000033000000330000003300000033C0955AE9F4C584FFFED0
|
||||
8DFFFFD38FFFFFD490FFFFD48FFFFFD38FFFFFD491FFB78242FF00000000C18A
|
||||
47FFC48C45FFC48A42FFC38941FFC08741FFB9823EFFFFDCA5FFFED69FFFFFD2
|
||||
92FF5D4C3CFF8D7255FF8D7154FF896F53FFFFDDA5FFB68140FF000000000000
|
||||
00000000003300000033000000330000003300000000957854A4FCD6A7FFFFE5
|
||||
B8FFFFE8BAFFFFE9BBFFFFE8BAFFFFE8BAFFFFE9BEFFB68141FF000000000000
|
||||
0000303842FF797F87FF767C84FF737B85FF0000000000000000A57437E9B680
|
||||
3EFFB7813EFFB7813DFFB6803DFFB6803DFFB7813FFF8F6735C5000000230000
|
||||
0033000000330000003300000033000000330000003300000022000000000000
|
||||
0000000000330000003300000033000000330000000000000000815C2FC0BA83
|
||||
3FFFBD843CFFBD8239FFBC8138FFBA8039FFB7803CFF7A572ABB000000210000
|
||||
0000303741FF787F87FF757C84FF737B84FF0000000000000000B6813FFFFFED
|
||||
C6FFFFECC2FFFFECC2FFFFECC1FFFFEAC0FFFFE8C0FFEAC18FFF755226B50000
|
||||
0033000000330000003300000033000000330000003300000023B57F3DFFFFEB
|
||||
C2FF5E4B38FF8D7151FF8C7051FF886C4EFFFFE0B3FFFFE3BAFFE8BE8BFFCB98
|
||||
59FFD19C5BFFD29C59FFD19A58FFCF9A59FFCE9B5DFF7F5A2EC0B57F3DFFFFEA
|
||||
C1FFFFE0A7FFFFE2A9FFFFE1A9FFFFDEA6FFFFD7A1FFFED7A7FFFFDEB2FFFFE2
|
||||
B6FFFFE7B9FFFFE8B9FFFFE7B9FFFFE6B8FFFFEBC3FFB6813FFFB57F3DFFFFEB
|
||||
C2FF5F4C3AFF8F7254FF8D7254FF896E51FFFDD296FFF8CE92FFF9CE91FFFED2
|
||||
94FF5C4A37FF8C7050FF8B6F50FF886C4EFFFFEAC1FFB57F3EFFB57F3DFFFFEA
|
||||
C2FFFFD48DFFFFD68FFFFFD58FFFFFD28DFFFACB87FFFBD198FFFFE1BAFFFFE6
|
||||
BEFFFFEBC1FFFFECC3FFFFECC2FFFFEBC2FFFFECC5FFB6813FFFB57F3EFFFFEB
|
||||
C2FF5E4C3AFF8E7253FF8D7153FF886D50FFFED294FFFFE4BCFFE9BF8DFFB37D
|
||||
39FFB6803CFFB7803DFFB6803CFFB6803DFFB7813FFF805C2FB0B6813FFFFFED
|
||||
C6FFFFECC3FFFFECC3FFFFECC3FFFFEBC2FFFFE9C1FFEBC18FFF765227A30000
|
||||
0000000000330000003300000033000000330000000000000000AD7D40EFB681
|
||||
3FFFB6803EFFB5803DFFB5803DFFB57F3DFFB5803EFF8B6231C0000000000000
|
||||
0000343A42FF7B8087FF777D83FF767C83FF0000000000000000}
|
||||
end>
|
||||
end
|
||||
object imgIcons32: TcxImageList
|
||||
|
@ -2216,6 +2271,139 @@ object frmMain: TfrmMain
|
|||
66FF686564FF656261FF63615EFF615E5DFF0000000600000000000000000000
|
||||
00067B7977FF757271FF6F6D6BFF6A6866FF686564FF656261FF63615EFF615E
|
||||
5DFF000000060000000000000000000000000000000000000000}
|
||||
end
|
||||
item
|
||||
Image.Data = {
|
||||
36100000424D3610000000000000360000002800000020000000200000000100
|
||||
2000000000000010000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000006000000110000001600000016000000120000000E000000120000
|
||||
0016000000160000001600000016000000160000001100000006000000000000
|
||||
00050000000F0000001600000016000000160000001600000016000000160000
|
||||
0016000000160000001600000016000000160000000F00000005000000000000
|
||||
00000000000B000000220000002D0000002D000000240000001B000000240000
|
||||
002D0000002D0000002D0000002D0000002D000000220000000B000000050000
|
||||
0019000000340000004100000043000000430000004300000043000000430000
|
||||
0043000000430000004300000043000000420000002F0000000F000000000000
|
||||
000000000006424242FF818181FF7D7D7DFF7D7D7DFF1D1D1D443F3F3FFF8181
|
||||
81FF7D7D7DFF7D7D7DFF7D7D7DFF7D7D7DFF7C7D7EFF0000000A000000190000
|
||||
0039A1733AE9B78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78342FFA4763EEA00000016000000050000
|
||||
000F000000160000001600000016000000160000001600000016000000160000
|
||||
0016000000160000001600000016000000160000001600000020000000399D70
|
||||
38E6E8BF8CFFFFE1B8FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0
|
||||
B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE4BCFFB78342FF000000160000000F0000
|
||||
002F000000420000004300000043000000430000004300000043000000430000
|
||||
00430000004300000043000000430000004300000043000000489E7038E7E8BE
|
||||
8BFFFFDFB5FFFFDBAEFFFFDEAFFFFFDFAFFFFFDEAFFFFFDEAFFFFFDDAFFFFFDB
|
||||
ADFFFFDEAFFFFFDEAFFFFFDAACFFFFE0B7FFB78241FF0000001600000016A476
|
||||
3EEAB78342FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78241FFB78241FFB5803EFFE7BE8BFFFFDF
|
||||
B5FFFDD7A8FFFFDAA6FF67533FFF947656FF927555FF927555FF8F7253FFFFDE
|
||||
A9FF67533FFF907353FFFFD9A5FFFFE0B7FFB78241FF0000001600000016B783
|
||||
42FFFFE6BDFFFFE2B4FFFFE3B5FFFFE2B5FFFFE2B5FFFFE1B4FFFFE0B3FFFFE3
|
||||
B5FFFFE3B5FFFFE1B4FFFFE0B3FFFFE3B5FFFFE3B5FFFFE1B3FFFFDCAEFFFCD6
|
||||
A4FFFBD39CFFFFD8A0FFFFDDA4FFFFDDA4FFFFDCA4FFFFDBA3FFFFD8A1FFFFD9
|
||||
A1FFFFDCA4FFFFDAA2FFFCD39CFFFFE1B8FFB78241FF0000001600000014B782
|
||||
41FFFFE5BAFF67523DFF937655FF927554FF927554FF8F7252FFFFD396FF6753
|
||||
3EFF937655FF8F7252FFFFD396FF67533EFF937655FF8F7252FFFCD093FFF9CD
|
||||
93FFFED297FF695541FF6D5844FF947758FF937657FF907455FFFFD599FF6854
|
||||
41FF947758FF907455FFFCD094FFFFE1B8FFB78241FF000000160000000DB783
|
||||
42FFFFE6BDFFFFE6BBFFFFE6BCFFFFE6BCFFFFE6BCFFFFE5BBFFFFE3BAFFFFE6
|
||||
BCFFFFE6BCFFFFE5BBFFFFE3BAFFFFE6BCFFFFE6BCFFFFE4BAFFFFDFB6FFFAD1
|
||||
99FFF8CC8CFFFED191FFFFD694FFFFD694FFFFD492FFFED191FFFFD291FFFFD5
|
||||
93FFFFD593FFFFD292FFF9CC8CFFFFE1B9FFB78241FF00000016000000047B58
|
||||
2EACB78342FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78241FFB78241FFB5803EFFE7BE8BFFFFDF
|
||||
B6FFF9CF95FFF9CA85FF6A5644FF6D5946FF927559FFFDCD89FF695543FF9478
|
||||
5AFF937759FF907458FFF8C984FFFFE1B9FFB78241FF00000016000000000000
|
||||
000000000006000000110000001600000016000000110000000B000000110000
|
||||
001600000016000000110000000B000000110000001600000014765329ACE8BE
|
||||
8CFFFFDFB7FFF8CE90FFF8C77BFFF9C87DFFF7C67BFFF5C47AFFF8C77CFFF8C7
|
||||
7CFFF7C77CFFF7C67BFFF3C277FFFFE1B9FFB78241FF00000014000000000000
|
||||
00000000000B000000220000002D0000002D0000002200000016000000220000
|
||||
002D0000002D0000002200000016000000220000002D000000220000000F7754
|
||||
29ABE8BF8DFFFFE2BAFFFFE1B9FFFFE1BAFFFFE1BAFFFFE1BAFFFFE1BAFFFFE1
|
||||
BAFFFFE1BAFFFFE1BAFFFFE1B9FFFFE5BCFFB78342FF0000000D000000000000
|
||||
000000000006414242FF818181FF7D7D7DFF7F8081FF0000000B414242FF8181
|
||||
81FF7D7D7DFF7C7D7EFF0000000B7C7D7EFF7D7D7DFF7C7D7EFF000000060000
|
||||
000378562CABB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78342FF7B582EAC00000004000000040000
|
||||
000D000000140000001600000016000000160000001600000016000000160000
|
||||
0016000000160000001600000016000000140000000D00000003000000000000
|
||||
0006000000110000001600000016000000160000001600000016000000110000
|
||||
000B0000001100000016000000110000000600000000000000000000000D0000
|
||||
002B0000003F0000004300000043000000430000004300000043000000430000
|
||||
00430000004300000043000000430000003F0000002E00000014000000030000
|
||||
000B000000220000002D0000002D0000002D0000002D0000002D000000220000
|
||||
0016000000220000002D000000220000000B0000000000000000000000147B58
|
||||
2EBDB78342FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78241FF78562CC100000031000000140000
|
||||
0009464646FF424242FF818181FF7D7D7DFF7D7D7DFF7D7D7DFF7F8081FF0000
|
||||
000B414242FF818181FF7C7D7EFF00000006000000000000000000000016B783
|
||||
42FFFFE4BCFFFFE0B6FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE0
|
||||
B7FFFFE0B7FFFFE0B7FFFFE0B7FFFFE1B8FFE8BF8CFF76542ABF000000330000
|
||||
001D000000160000001600000016000000160000001600000016000000160000
|
||||
0016000000160000001600000016000000140000000D0000000400000016B782
|
||||
41FFFFE0B7FFFEDAADFFFEDAADFFFEDAADFFFEDAADFFFEDAADFFFEDAADFFFEDA
|
||||
ADFFFEDAADFFFEDAADFFFEDAADFFFEDAAFFFFFDFB4FFE8BE8BFF755429C00000
|
||||
0046000000430000004300000043000000430000004300000043000000430000
|
||||
00430000004300000043000000430000003F0000002B0000000D00000016B782
|
||||
41FFFFE0B7FFFFD9A8FFFFDDACFFFFDDACFFFFDDACFFFFDCACFFFFDAAAFFFFDD
|
||||
ACFFFFDDACFFFFDDACFFFFDCACFFFED9A9FFFEDAACFFFFDFB5FFE7BE8BFFB580
|
||||
3EFFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78342FF7B582EBD0000001400000016B782
|
||||
41FFFFE0B7FFFFD9A6FF67533FFF947656FF927556FF8F7253FFFFDCA9FF6753
|
||||
3FFF947656FF927556FF8F7253FFFFD8A6FFFCD5A3FFFDD7A8FFFFDBB0FFFFDE
|
||||
B2FFFFDEB3FFFFDEB3FFFFDEB3FFFFDEB3FFFFDEB3FFFFDEB3FFFFDEB3FFFFDE
|
||||
B3FFFFDEB3FFFFDEB3FFFFDEB3FFFFE4BCFFB78342FF0000001600000016B782
|
||||
41FFFFE1B8FFFED59FFFFFDDA6FFFFDEA6FFFFDDA6FFFFDCA5FFFFDAA3FFFFDC
|
||||
A5FFFFDBA4FFFFDDA6FFFFDCA4FFFDD59FFFFBD39EFFFBD39EFFFBD39DFFFCD4
|
||||
9EFFFFD8A1FFFFD9A2FFFFD7A1FFFED59FFFFFD8A1FFFFD8A1FFFFD8A1FFFFD8
|
||||
A1FFFFD8A1FFFFD7A0FFFCD39DFFFFE1B7FFB78241FF0000001600000016B782
|
||||
41FFFFE1B8FFFED59CFF685440FF947757FF937657FF937657FF937657FF8F73
|
||||
54FFFFD89FFF685440FF917455FFFED49CFFFAD19AFFFAD19AFFFAD19AFFFFD5
|
||||
9DFF695541FF6C5843FF917455FFFFD89FFF685440FF947757FF937657FF9376
|
||||
57FF937657FF8F7354FFFDD49BFFFFE1B8FFB78241FF0000001600000016B782
|
||||
41FFFFE1B8FFFCD095FFFFD89CFFFFD99DFFFFD89CFFFFD89CFFFFD79BFFFFD4
|
||||
99FFFFD59AFFFFD89CFFFFD69BFFFBD096FFF9CE95FFF9CE95FFF9CE95FFFCD0
|
||||
97FFFFD89CFFFFDA9DFFFFD79BFFFFD59AFFFFD79BFFFFD59AFFFFD89CFFFFD8
|
||||
9CFFFFD89CFFFFD69AFFFBCF95FFFFE1B8FFB78241FF0000001600000016B782
|
||||
41FFFFE1B8FFFBCF91FF695642FF6D5944FF947859FF937758FF907456FFFFD3
|
||||
94FF685541FF947859FF907456FFFACF92FFF7CC90FFF7CC90FFF7CC90FFFBD0
|
||||
93FF695642FF6D5944FF947859FF937758FF907456FFFFD394FF685541FF9478
|
||||
59FF937758FF907456FFFACE90FFFFE1B8FFB78241FF0000001600000016B782
|
||||
41FFFFE1B9FFF8CB8AFFFFD491FFFFD591FFFFD391FFFFD290FFFDD08FFFFED1
|
||||
8FFFFFD391FFFFD391FFFFD18FFFF8CC8CFFF6CA8BFFF6C98AFFF5C989FFF7CA
|
||||
89FFFBCE8CFFFCCF8CFFFBCE8CFFFBCE8CFFFACD8BFFF8CB8AFFFBCE8CFFFBCE
|
||||
8CFFFBCE8CFFFACD8BFFF6C987FFFFE1B8FFB78241FF0000001400000016B782
|
||||
41FFFFE1B9FFF9CB86FF695543FF94785AFF937759FF907458FFFDCF8AFF6955
|
||||
43FF94785AFF937759FF907458FFF8CB87FFF4C784FFF9CF95FFFFDFB6FFFFE0
|
||||
B8FFFFE1B9FFFFE1B9FFFFE1B9FFFFE1B9FFFFE1B9FFFFE1B9FFFFE1B9FFFFE1
|
||||
B9FFFFE1B9FFFFE1B9FFFFE1B8FFFFE5BCFFB78342FF0000000D00000016B782
|
||||
41FFFFE1B9FFF5C57FFFF9C984FFFACA84FFF9C984FFF8C983FFF7C782FFF9C9
|
||||
84FFFACA84FFF9C984FFF8C983FFF5C57FFFF8CE92FFFFDFB7FFE7BE8BFFB580
|
||||
3EFFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78342FF7B582EAC0000000400000014B782
|
||||
41FFFFE1B9FFF2C076FFF2C178FFF2C178FFF2C178FFF2C178FFF2C178FFF2C1
|
||||
78FFF2C178FFF2C178FFF2C178FFF7CC8FFFFFE0B7FFE8BE8CFF765429AA0000
|
||||
000F000000220000002D0000002D0000002D0000002200000016000000220000
|
||||
002D0000002D0000002D000000220000000B00000000000000000000000DB783
|
||||
42FFFFE5BCFFFFE1B9FFFFE2BAFFFFE2BAFFFFE2BAFFFFE2BAFFFFE2BAFFFFE2
|
||||
BAFFFFE2BAFFFFE2BAFFFFE1B9FFFFE2BAFFE8BF8DFF76542AAB000000030000
|
||||
00063C3F43FF7C7F83FF797C80FF797C80FF7C7F83FF0000000B3C3F43FF7C7F
|
||||
83FF797C80FF797C80FF797C80FF000000060000000000000000000000047B58
|
||||
2EACB78342FFB78241FFB78241FFB78241FFB78241FFB78241FFB78241FFB782
|
||||
41FFB78241FFB78241FFB78241FFB78241FF78562CAB00000003000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000}
|
||||
end>
|
||||
end
|
||||
object DockingManager: TdxDockingManager
|
||||
|
@ -2490,6 +2678,80 @@ object frmMain: TfrmMain
|
|||
DCFFEFE7DDFFE2D9D0FFD2CABFFFB6B0A4FF4E4C467100000000000000000000
|
||||
000025242135747068A8A8A297F5AEA89CFFAEA89CFFAEA89CFFAEA89CFFAEA8
|
||||
9CFFAEA89CFFA8A297F5747068A8252421350000000000000000}
|
||||
end
|
||||
item
|
||||
Image.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000A000000250000003300000033000000330000
|
||||
0033000000250000000A00000000000000000000000000000000000000000000
|
||||
00000000000000000022001D105C006738C9008C4BFF008B4AFF008B4AFF008C
|
||||
4BFF006738C9001D105C0000001E000000000000000000000000000000000000
|
||||
00000000001E005E33BB009050FF01A169FF00AA76FF00AB77FF00AB77FF00AA
|
||||
76FF01A169FF009050FF00532DAA0000001E0000000000000000000000000000
|
||||
000A00532DAA009152FF02AC77FF00C38CFF00D699FF18DEA8FF18DEA8FF00D6
|
||||
99FF00C38CFF01AB76FF009253FF00532DAA0000000A0000000000000000001C
|
||||
1051009051FF0FB483FF02D299FF00D69BFF00D193FFFFFFFFFFFFFFFFFF00D1
|
||||
93FF00D69BFF00D198FF01AB76FF009050FF001D105100000000000000000067
|
||||
36C916AB78FF11C997FF00D49AFF00D297FF00CD8EFFFFFFFFFFFFFFFFFF00CD
|
||||
8EFF00D297FF00D59BFF00C18CFF01A169FF006838C90000000000000000008A
|
||||
48FF38C49CFF00D198FF00CD92FF00CB8EFF00C787FFFFFFFFFFFFFFFFFF00C7
|
||||
87FF00CB8EFF00CE93FF00D09AFF00AB76FF008C4BFF00000000000000000089
|
||||
46FF51D2AFFF12D4A3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFF00CF97FF00AD78FF008B4AFF00000000000000000088
|
||||
45FF66DDBEFF10D0A2FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFF00CD97FF00AD78FF008B4AFF00000000000000000088
|
||||
46FF76E0C5FF00CA98FF00C590FF00C48EFF00C187FFFFFFFFFFFFFFFFFF00C1
|
||||
87FF00C48EFF00C793FF00CB99FF00AB76FF008C4BFF00000000000000000065
|
||||
34BE59C9A4FF49DEBCFF00C794FF00C794FF00C38EFFFFFFFFFFFFFFFFFF00C3
|
||||
8EFF00C896FF00CB9AFF06C190FF00A168FF006838BF0000000000000000001C
|
||||
0F330A9458FFADF8E9FF18D0A7FF00C494FF00C290FFFFFFFFFFFFFFFFFF00C3
|
||||
91FF00C799FF05C89BFF18B787FF009050FF001C0F3300000000000000000000
|
||||
0000005C30AA199C63FFBCFFF7FF5DE4C9FF00C397FF00BF90FF00C091FF00C4
|
||||
98FF22CAA2FF31C297FF039355FF00522C950000000000000000000000000000
|
||||
00000000000000512A950E9659FF74D5B6FF9FF3E0FF92EFDAFF79E5CAFF5DD6
|
||||
B5FF2EB586FF039152FF005D33AA000000000000000000000000000000000000
|
||||
00000000000000000000001C0F33006433BB008744FF008743FF008744FF0089
|
||||
46FF006636BB001C0F3300000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000}
|
||||
end
|
||||
item
|
||||
Image.Data = {
|
||||
36040000424D3604000000000000360000002800000010000000100000000100
|
||||
2000000000000004000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000001E000000310000003300000033000000330000
|
||||
00310000001E0000000000000000000000000000000000000000000000000000
|
||||
00000000000E000000331B2471AA2B3ABAF92B3BBEFF2B3ABEFF2B3BBEFF2B3A
|
||||
BAF91B2471AA000000330000000E000000000000000000000000000000000000
|
||||
000E0D11356B2B3BBEFF4A5BE2FF6175FCFF697DFFFF697CFFFF697DFFFF6175
|
||||
FCFF4A5BE2FF2B3BBEFF0D11356B0000000E0000000000000000000000000D11
|
||||
356B2F3FC2FF596DF6FF6276FFFF6074FEFF5F73FEFF5F73FDFF5F73FEFF6074
|
||||
FEFF6276FFFF596DF6FF2F3FC2FF0D11356B00000000000000000000001E2C3C
|
||||
BFFF5669F4FF5D71FCFF5B6FFAFF5A6EF9FF5A6EF9FF5A6EF9FF5A6EF9FF5A6E
|
||||
F9FF5B6FFAFF5D71FCFF5669F4FF2C3CBFFF0000001E000000001B2471A94256
|
||||
DEFF576DFBFF5369F8FF5268F7FF5267F7FF5267F7FF5267F7FF5267F7FF5267
|
||||
F7FF5268F7FF5369F8FF576DFBFF4256DEFF1B2471A9000000002C3CBAF94E64
|
||||
F4FF4C63F7FF425AF4FF3E56F4FF3D55F4FF3D55F4FF3D55F4FF3D55F4FF3D55
|
||||
F4FF3E56F4FF425AF4FF4C63F7FF4E64F4FF2C3CBAF9000000002C3CBFFF5369
|
||||
F8FF3E56F3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFF3E56F3FF5369F8FF2C3CBFFF000000002B3BBFFF6378
|
||||
F7FF334DF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFF334DF0FF6378F7FF2B3BBFFF000000002A39BFFF8696
|
||||
F8FF2F4BEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFF2F4BEEFF8696F8FF2A39BFFF000000002837BAF8A1AC
|
||||
F4FF3852EDFF2D48ECFF2B46EBFF2A46EBFF2A46EBFF2A46EBFF2A46EBFF2A46
|
||||
EBFF2B46EBFF2D48ECFF3852EDFFA1ACF4FF2837BAF800000000192271956F7C
|
||||
DDFF8494F5FF2E4AE9FF334DE9FF354FEAFF3650EAFF3650EAFF3650EAFF354F
|
||||
EAFF334DE9FF2E4AE9FF8494F5FF6F7CDDFF1922719500000000000000002737
|
||||
BFFF9AA7F0FF7F90F3FF324CE9FF2D49E7FF304CE8FF314CE8FF304CE8FF2D49
|
||||
E7FF324CE9FF7F90F3FF9AA7F0FF2737BFFF0000000000000000000000000C11
|
||||
35462F3FC3FF97A3EFFF9EACF7FF6075EDFF3E57E9FF2441E5FF3E57E9FF6075
|
||||
EDFF9EACF7FF97A3EFFF2F3FC3FF0C1135460000000000000000000000000000
|
||||
00000C1035462737BFFF6A77DCFF9EA9F2FFAFBAF8FFAFBBF8FFAFBAF8FF9EA9
|
||||
F2FF6A77DCFF2737BFFF0C103546000000000000000000000000000000000000
|
||||
00000000000000000000192271952736BAF72737BFFF2737BFFF2737BFFF2736
|
||||
BAF7192271950000000000000000000000000000000000000000}
|
||||
end>
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,8 +38,8 @@ type
|
|||
Splitter: TcxSplitter;
|
||||
bbDuplicateDefinition: TdxBarButton;
|
||||
bbDeleteDefinition: TdxBarButton;
|
||||
barGenerator: TdxBar;
|
||||
lbGenerate: TdxBarLargeButton;
|
||||
barTools: TdxBar;
|
||||
lbCodeGenerator: TdxBarLargeButton;
|
||||
pnlInspector: TPanel;
|
||||
DockingManager: TdxDockingManager;
|
||||
imgMisc: TcxImageList;
|
||||
|
@ -69,6 +69,7 @@ type
|
|||
dxBarSeparator4: TdxBarSeparator;
|
||||
bbExpandLeaf: TdxBarButton;
|
||||
bbCollapseLeaf: TdxBarButton;
|
||||
lbDiffingMode: TdxBarLargeButton;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormResize(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
|
@ -85,7 +86,7 @@ type
|
|||
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure lbCreateDefinitionClick(Sender: TObject);
|
||||
procedure lbGenerateClick(Sender: TObject);
|
||||
procedure lbCodeGeneratorClick(Sender: TObject);
|
||||
procedure bbDeleteDefinitionClick(Sender: TObject);
|
||||
procedure InspectorItemChanged(Sender: TObject; AOldRow: TcxCustomRow; AOldCellIndex: Integer);
|
||||
procedure bbDuplicateDefinitionClick(Sender: TObject);
|
||||
|
@ -105,7 +106,9 @@ type
|
|||
procedure EditorTreeGetImageIndex(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||
var Ghosted: Boolean; var ImageIndex: System.UITypes.TImageIndex);
|
||||
procedure lbDiffingModeClick(Sender: TObject);
|
||||
strict private
|
||||
FFilename: String;
|
||||
FEditor: TInstructionEditor;
|
||||
FUpdating: Boolean;
|
||||
FHasUnsavedChanges: Boolean;
|
||||
|
@ -162,20 +165,28 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
System.IniFiles, Vcl.Clipbrd, SynCrossPlatformJSON, formCreateDefinition, formGenerator,
|
||||
untHelperClasses, untPropertyHints,
|
||||
|
||||
System.Math;
|
||||
System.IniFiles, Vcl.Clipbrd, SynCrossPlatformJSON, formCreateDefinition, formCodeGenerator,
|
||||
untHelperClasses, untPropertyHints;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
type
|
||||
TEditorNodeType = (ntFilterTable, ntInstructionDefinition);
|
||||
TEditorNodeType = (
|
||||
ntFilterTable,
|
||||
ntInstructionDefinition
|
||||
);
|
||||
|
||||
TDiffingState = (
|
||||
dsDefault,
|
||||
dsAdded,
|
||||
dsRemoved
|
||||
);
|
||||
|
||||
PEditorNodeData = ^TEditorNodeData;
|
||||
TEditorNodeData = record
|
||||
public
|
||||
NodeType: TEditorNodeType;
|
||||
DiffingState: TDiffingState;
|
||||
case Integer of
|
||||
0: (DataClass: TPersistent);
|
||||
1: (Filter: TInstructionFilter);
|
||||
|
@ -777,6 +788,10 @@ begin
|
|||
begin
|
||||
Assert(NodeDataB^.NodeType = ntInstructionDefinition);
|
||||
Result := CompareStr(NodeDataA^.Definition.Mnemonic, NodeDataB^.Definition.Mnemonic);
|
||||
if (Result = 0) then
|
||||
begin
|
||||
Result := Ord(NodeDataA^.DiffingState) - Ord(NodeDataB^.DiffingState);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -806,7 +821,11 @@ begin
|
|||
end;
|
||||
ntInstructionDefinition:
|
||||
begin
|
||||
ImageIndex := 2;
|
||||
case NodeData^.DiffingState of
|
||||
dsDefault: ImageIndex := 2;
|
||||
dsAdded : ImageIndex := 3;
|
||||
dsRemoved: ImageIndex := 4;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -1092,69 +1111,147 @@ begin
|
|||
DefinitionCreate;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.lbGenerateClick(Sender: TObject);
|
||||
|
||||
procedure DeleteDuplicates(T: TInstructionFilter);
|
||||
procedure TfrmMain.lbCodeGeneratorClick(Sender: TObject);
|
||||
var
|
||||
L: TList<TInstructionDefinition>;
|
||||
D: TInstructionDefinition;
|
||||
I, J: Integer;
|
||||
B: Boolean;
|
||||
frmGenerator: TfrmCodeGenerator;
|
||||
begin
|
||||
if (T is TDefinitionContainer) then
|
||||
begin
|
||||
L := TList<TInstructionDefinition>.Create;
|
||||
try
|
||||
for I := (T as TDefinitionContainer).DefinitionCount - 1 downto 0 do
|
||||
begin
|
||||
D := (T as TDefinitionContainer).Definitions[I];
|
||||
B := true;
|
||||
for J := 0 to L.Count - 1 do
|
||||
begin
|
||||
if (D.Equals(L[J])) then
|
||||
begin
|
||||
D.Free;
|
||||
B := false;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if (B) then L.Add(D);
|
||||
end;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
for I := 0 to T.Capacity - 1 do
|
||||
begin
|
||||
if Assigned(T.Items[I]) then
|
||||
begin
|
||||
DeleteDuplicates(T.Items[I]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
frmGenerator: TfrmGenerator;
|
||||
begin
|
||||
frmGenerator := TfrmGenerator.Create(Application);
|
||||
frmGenerator := TfrmCodeGenerator.Create(Application);
|
||||
try
|
||||
frmGenerator.Editor := FEditor;
|
||||
frmGenerator.ShowModal;
|
||||
finally
|
||||
frmGenerator.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Exit;
|
||||
FEditor.BeginUpdate;
|
||||
DeleteDuplicates(FEditor.RootTable);
|
||||
FEditor.EndUpdate;
|
||||
procedure TfrmMain.lbDiffingModeClick(Sender: TObject);
|
||||
var
|
||||
OpenDialog: TOpenDialog;
|
||||
Node: PVirtualNode;
|
||||
NodeData: PEditorNodeData;
|
||||
Editor: TInstructionEditor;
|
||||
I, J: Integer;
|
||||
B: Boolean;
|
||||
D: TInstructionDefinition;
|
||||
begin
|
||||
if (lbDiffingMode.Down) then
|
||||
begin
|
||||
OpenDialog := TOpenDialog.Create(Application);
|
||||
try
|
||||
OpenDialog.Title := 'Open second instruction database';
|
||||
OpenDialog.Filter := 'Instruction Database Files (*.json)|*.json';
|
||||
OpenDialog.DefaultExt := 'json';
|
||||
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
|
||||
if (not OpenDialog.Execute(WindowHandle)) then
|
||||
begin
|
||||
lbDiffingMode.Down := false;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
EditorTree.BeginUpdate;
|
||||
try
|
||||
for I := 0 to FEditor.DefinitionCount - 1 do
|
||||
begin
|
||||
Node := GetTreeNode(FEditor.Definitions[I]);
|
||||
NodeData := EditorTree.GetNodeData(Node);
|
||||
NodeData^.DiffingState := dsRemoved;
|
||||
end;
|
||||
|
||||
Editor := TInstructionEditor.Create;
|
||||
try
|
||||
Editor.OnWorkStart := EditorWorkStart;
|
||||
Editor.OnWork := EditorWork;
|
||||
Editor.OnWorkEnd := EditorWorkEnd;
|
||||
try
|
||||
Editor.LoadFromFile(OpenDialog.Filename);
|
||||
{if (lbMnemonicFilter.Down) then
|
||||
begin
|
||||
SetMnemonicFilter(edtMnemonicFilter.Text, bbExactMatch.Down);
|
||||
end;}
|
||||
FEditing := false;
|
||||
FEditor.BeginUpdate;
|
||||
try
|
||||
EditorWorkStart(Editor, 0, Editor.DefinitionCount);
|
||||
for I := 0 to Editor.DefinitionCount - 1 do
|
||||
begin
|
||||
B := false;
|
||||
for J := 0 to FEditor.DefinitionCount - 1 do
|
||||
begin
|
||||
if (Editor.Definitions[I].Equals(FEditor.Definitions[J])) then
|
||||
begin
|
||||
B := true;
|
||||
Node := GetTreeNode(FEditor.Definitions[J]);
|
||||
NodeData := EditorTree.GetNodeData(Node);
|
||||
NodeData^.DiffingState := dsDefault;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if (not B) then
|
||||
begin
|
||||
D := FEditor.CreateDefinition(Editor.Definitions[I].Mnemonic);
|
||||
D.Assign(Editor.Definitions[I]);
|
||||
Node := GetTreeNode(D);
|
||||
NodeData := EditorTree.GetNodeData(Node);
|
||||
NodeData^.DiffingState := dsAdded;
|
||||
end;
|
||||
EditorWork(Editor, I + 1);
|
||||
end;
|
||||
EditorWorkEnd(Editor);
|
||||
finally
|
||||
FEditor.EndUpdate;
|
||||
FEditing := true;
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Application.MessageBox(PChar(E.Message), 'Error', MB_ICONERROR);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Editor.Free;
|
||||
end;
|
||||
finally
|
||||
EditorTree.EndUpdate;
|
||||
end;
|
||||
finally
|
||||
OpenDialog.Free;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
EditorTree.BeginUpdate;
|
||||
try
|
||||
FEditing := false;
|
||||
FEditor.BeginUpdate;
|
||||
try
|
||||
EditorWorkStart(FEditor, 0, FEditor.DefinitionCount);
|
||||
J := 0;
|
||||
for I := FEditor.DefinitionCount - 1 downto 0 do
|
||||
begin
|
||||
Node := GetTreeNode(FEditor.Definitions[I]);
|
||||
NodeData := EditorTree.GetNodeData(Node);
|
||||
case NodeData^.DiffingState of
|
||||
dsAdded : NodeData^.Definition.Free;
|
||||
dsRemoved: NodeData^.DiffingState := dsDefault;
|
||||
end;
|
||||
Inc(J);
|
||||
EditorWork(FEditor, J);
|
||||
end;
|
||||
EditorWorkEnd(FEditor);
|
||||
finally
|
||||
FEditor.EndUpdate;
|
||||
FEditing := true;
|
||||
end;
|
||||
finally
|
||||
EditorTree.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
UpdateControls;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.lbLoadDatabaseClick(Sender: TObject);
|
||||
var
|
||||
ID: Integer;
|
||||
OpenDialog: TOpenDialog;
|
||||
begin
|
||||
if (FHasUnsavedChanges) then
|
||||
begin
|
||||
|
@ -1165,10 +1262,23 @@ begin
|
|||
Exit;
|
||||
end;
|
||||
end;
|
||||
OpenDialog := TOpenDialog.Create(Application);
|
||||
try
|
||||
OpenDialog.Filter := 'Instruction Database Files (*.json)|*.json';
|
||||
OpenDialog.DefaultExt := 'json';
|
||||
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
|
||||
if (not OpenDialog.Execute(WindowHandle)) then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
FFilename := OpenDialog.FileName;
|
||||
finally
|
||||
OpenDialog.Free;
|
||||
end;
|
||||
FEditing := false;
|
||||
try
|
||||
ExpandAllNodes(false);
|
||||
FEditor.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'instructions.json');
|
||||
FEditor.LoadFromFile(FFilename);
|
||||
if (lbMnemonicFilter.Down) then
|
||||
begin
|
||||
SetMnemonicFilter(edtMnemonicFilter.Text, bbExactMatch.Down);
|
||||
|
@ -1176,6 +1286,7 @@ begin
|
|||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
FFilename := '';
|
||||
Application.MessageBox(PChar(E.Message), 'Error', MB_ICONERROR);
|
||||
end;
|
||||
end;
|
||||
|
@ -1199,8 +1310,26 @@ begin
|
|||
end;
|
||||
|
||||
procedure TfrmMain.lbSaveDatabaseClick(Sender: TObject);
|
||||
var
|
||||
SaveDialog: TSaveDialog;
|
||||
begin
|
||||
FEditor.SaveToFile(ExtractFilePath(ParamStr(0)) + 'instructions.json');
|
||||
if (FFilename = '') then
|
||||
begin
|
||||
SaveDialog := TSaveDialog.Create(Application);
|
||||
try
|
||||
SaveDialog.Filter := 'Instruction Database Files (*.json)|*.json';
|
||||
SaveDialog.DefaultExt := 'json';
|
||||
SaveDialog.InitialDir := ExtractFilePath(ParamStr(0));
|
||||
if (not SaveDialog.Execute(WindowHandle)) then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
FFilename := SaveDialog.FileName;
|
||||
finally
|
||||
SaveDialog.Free;
|
||||
end;
|
||||
end;
|
||||
FEditor.SaveToFile(FFilename);
|
||||
FHasUnsavedChanges := false;
|
||||
UpdateControls;
|
||||
end;
|
||||
|
@ -1351,15 +1480,15 @@ procedure TfrmMain.UpdateControls;
|
|||
var
|
||||
NodeData: PEditorNodeData;
|
||||
begin
|
||||
lbSaveDatabase.Enabled := FHasUnsavedChanges;
|
||||
lbLoadDatabase.Enabled := (not lbDiffingMode.Down);
|
||||
lbSaveDatabase.Enabled := FHasUnsavedChanges and (not lbDiffingMode.Down);
|
||||
|
||||
NodeData := EditorTree.GetNodeData(EditorTree.FocusedNode);
|
||||
bbDuplicateDefinition.Enabled :=
|
||||
Assigned(NodeData) and (NodeData^.NodeType = ntInstructionDefinition);
|
||||
bbDeleteDefinition.Enabled :=
|
||||
Assigned(NodeData) and (NodeData^.NodeType = ntInstructionDefinition);
|
||||
bbClipboardCopy.Enabled :=
|
||||
Assigned(NodeData) {and (NodeData^.NodeType = ntInstructionDefinition)};
|
||||
bbClipboardCopy.Enabled := Assigned(NodeData);
|
||||
bbClipboardCut.Enabled :=
|
||||
Assigned(NodeData) and (NodeData^.NodeType = ntInstructionDefinition);
|
||||
bbExpandLeaf.Enabled :=
|
||||
|
|
|
@ -12,9 +12,10 @@ uses
|
|||
untPropertyHints in 'untPropertyHints.pas',
|
||||
formCreateDefinition in 'Forms\formCreateDefinition.pas' {frmCreateDefinition},
|
||||
formEditorX86Registers in 'Forms\Editors\formEditorX86Registers.pas' {frmEditorX86Registers},
|
||||
formGenerator in 'Forms\formGenerator.pas' {frmGenerator},
|
||||
formCodeGenerator in 'Forms\formCodeGenerator.pas' {frmCodeGenerator},
|
||||
Zydis.CodeGenerator in 'Zydis.CodeGenerator.pas',
|
||||
untPropertyEditors in 'untPropertyEditors.pas';
|
||||
untPropertyEditors in 'untPropertyEditors.pas',
|
||||
formCompareDatabases in 'Forms\formCompareDatabases.pas' {frmCompareDatabases};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
|
|
@ -150,12 +150,16 @@
|
|||
<Form>frmEditorX86Registers</Form>
|
||||
<FormType>dfm</FormType>
|
||||
</DCCReference>
|
||||
<DCCReference Include="Forms\formGenerator.pas">
|
||||
<Form>frmGenerator</Form>
|
||||
<DCCReference Include="Forms\formCodeGenerator.pas">
|
||||
<Form>frmCodeGenerator</Form>
|
||||
<FormType>dfm</FormType>
|
||||
</DCCReference>
|
||||
<DCCReference Include="Zydis.CodeGenerator.pas"/>
|
||||
<DCCReference Include="untPropertyEditors.pas"/>
|
||||
<DCCReference Include="Forms\formCompareDatabases.pas">
|
||||
<Form>frmCompareDatabases</Form>
|
||||
<FormType>dfm</FormType>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
|
@ -177,8 +181,8 @@
|
|||
<Source Name="MainSource">InstructionEditor.dpr</Source>
|
||||
</Source>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k230.bpl">Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp230.bpl">Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
|
@ -188,27 +192,12 @@
|
|||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
|
@ -560,12 +549,27 @@
|
|||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
|
|
Binary file not shown.
|
@ -146,6 +146,7 @@ type
|
|||
cfMMX,
|
||||
cfMOVBE,
|
||||
cfMPX,
|
||||
cfMWAITX,
|
||||
cfPCLMUL,
|
||||
cfPOPCNT,
|
||||
cfPREFETCHW,
|
||||
|
@ -563,6 +564,7 @@ type
|
|||
ifAcceptsXRELEASE,
|
||||
ifAcceptsEVEXAAA,
|
||||
ifAcceptsEVEXZ,
|
||||
ifIsPrivileged,
|
||||
ifHasEVEXBC,
|
||||
ifHasEVEXRC,
|
||||
ifHasEVEXSAE
|
||||
|
@ -613,7 +615,8 @@ type
|
|||
procedure Update; inline;
|
||||
procedure EndUpdate; inline;
|
||||
public
|
||||
function Equals(const Value: TInstructionDefinition): Boolean; reintroduce;
|
||||
function Equals(const Value: TInstructionDefinition;
|
||||
const CheckComment: Boolean = false): Boolean; reintroduce;
|
||||
public
|
||||
procedure LoadFromJSON(JSON: PJSONVariantData);
|
||||
procedure SaveToJSON(JSON: PJSONVariantData);
|
||||
|
@ -952,6 +955,7 @@ const
|
|||
'mmx',
|
||||
'movbe',
|
||||
'mpx',
|
||||
'mwaitx',
|
||||
'pclmul',
|
||||
'popcnt',
|
||||
'prefetchw',
|
||||
|
@ -1189,6 +1193,7 @@ const
|
|||
'accepts_xrelease',
|
||||
'accepts_evex_aaa',
|
||||
'accepts_evex_z',
|
||||
'privileged',
|
||||
'has_evex_bc',
|
||||
'has_evex_rc',
|
||||
'has_evex_sae'
|
||||
|
@ -2559,6 +2564,7 @@ begin
|
|||
D.FImplicitRead.Assign(FImplicitRead);
|
||||
D.FImplicitWrite.Assign(FImplicitWrite);
|
||||
D.FX86Flags.Assign(FX86Flags);
|
||||
D.FEVEXCD8Scale := FEVEXCD8Scale;
|
||||
D.FComment := FComment;
|
||||
D.Update;
|
||||
finally
|
||||
|
@ -2631,16 +2637,18 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TInstructionDefinition.Equals(const Value: TInstructionDefinition): Boolean;
|
||||
function TInstructionDefinition.Equals(const Value: TInstructionDefinition;
|
||||
const CheckComment: Boolean): Boolean;
|
||||
begin
|
||||
// Comment is excluded from the equality check
|
||||
Result :=
|
||||
(Value.FMnemonic = FMnemonic) and (Value.FEncoding = FEncoding) and
|
||||
(Value.FOpcodeMap = FOpcodeMap) and (Value.FOpcode = FOpcode) and
|
||||
(Value.FExtensions.Equals(FExtensions)) and (Value.FCPUID.Equals(FCPUID)) and
|
||||
(Value.FOperands.Equals(FOperands)) and (Value.FFlags = FFlags) and
|
||||
(Value.FEVEXCD8Scale = FEVEXCD8Scale) and
|
||||
(Value.FImplicitRead.Equals(FImplicitRead)) and
|
||||
(Value.FImplicitWrite.Equals(FImplicitWrite)) and (Value.FX86Flags.Equals(FX86Flags));
|
||||
(Value.FImplicitWrite.Equals(FImplicitWrite)) and (Value.FX86Flags.Equals(FX86Flags)) and
|
||||
((not CheckComment) or (Value.FComment = FComment));
|
||||
end;
|
||||
|
||||
function TInstructionDefinition.GetConflictState: Boolean;
|
||||
|
@ -2784,14 +2792,25 @@ begin
|
|||
end;
|
||||
|
||||
procedure TInstructionDefinition.SetMnemonic(const Value: String);
|
||||
var
|
||||
S: String;
|
||||
C: Char;
|
||||
begin
|
||||
if (Value = '') then
|
||||
S := '';
|
||||
for C in Value do
|
||||
begin
|
||||
if (CharInSet(C, ['a'..'z', 'A'..'Z', '0'..'9'])) then
|
||||
begin
|
||||
S := S + C;
|
||||
end;
|
||||
end;
|
||||
if (S = '') then
|
||||
begin
|
||||
raise Exception.Create('Mnemonic can not be empty.');
|
||||
end;
|
||||
if (FMnemonic <> Value) then
|
||||
if (FMnemonic <> S) then
|
||||
begin
|
||||
FMnemonic := LowerCase(Value);
|
||||
FMnemonic := LowerCase(S);
|
||||
UpdateValues;
|
||||
end;
|
||||
end;
|
||||
|
|
198934
assets/instructions.json
198934
assets/instructions.json
File diff suppressed because it is too large
Load Diff
|
@ -74,60 +74,54 @@ enum ZydisDisassemblerModes
|
|||
typedef uint32_t ZydisInstructionFlags;
|
||||
|
||||
/**
|
||||
* @brief Values that represent instruction flags.
|
||||
* @brief The instruction has one or more operand with position-relative offsets.
|
||||
*/
|
||||
enum ZydisInstructionFlag
|
||||
{
|
||||
/**
|
||||
* @brief The instruction has one or more operand with position-relative offsets.
|
||||
*/
|
||||
ZYDIS_IFLAG_RELATIVE = 0x00000001,
|
||||
/**
|
||||
* @brief The instruction has the modrm byte.
|
||||
*/
|
||||
ZYDIS_IFLAG_HAS_MODRM = 0x00000002,
|
||||
/**
|
||||
* @brief The instruction has the sib byte.
|
||||
*/
|
||||
ZYDIS_IFLAG_HAS_SIB = 0x00000004,
|
||||
/**
|
||||
* @brief An error occured while decoding the current instruction.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_MASK = 0x7F000000,
|
||||
/**
|
||||
* @brief The instruction is invalid.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_INVALID = 0x01000000,
|
||||
/**
|
||||
* @brief The instruction length has exceeded the maximum of 15 bytes.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_INSTRUCTION_LENGTH = 0x02000000,
|
||||
/**
|
||||
* @brief An error occured while decoding the vex-prefix.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_MALFORMED_VEX = 0x04000000,
|
||||
/**
|
||||
* @brief An error occured while decoding the evex-prefix.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_MALFORMED_EVEX = 0x08000000,
|
||||
/**
|
||||
* @brief An error occured while decoding the xop-prefix.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_MALFORMED_XOP = 0x10000000,
|
||||
/**
|
||||
* @brief A rex-prefix was found while decoding a vex/evex/xop instruction.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_ILLEGAL_REX = 0x20000000,
|
||||
/**
|
||||
* @brief An invalid constellation was found while decoding an instruction that uses the VSIB
|
||||
* addressing mode.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_INVALID_VSIB = 0x40000000,
|
||||
/**
|
||||
* @brief An error occured while decoding the instruction-operands.
|
||||
*/
|
||||
ZYDIS_IFLAG_ERROR_OPERANDS = 0x40000000
|
||||
};
|
||||
#define ZYDIS_IFLAG_RELATIVE 0x00000001
|
||||
/**
|
||||
* @brief The instruction has the modrm byte.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_HAS_MODRM 0x00000002
|
||||
/**
|
||||
* @brief The instruction has the sib byte.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_HAS_SIB 0x00000004
|
||||
/**
|
||||
* @brief An error occured while decoding the current instruction.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_MASK 0x7F000000
|
||||
/**
|
||||
* @brief The instruction is invalid.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_INVALID 0x01000000
|
||||
/**
|
||||
* @brief The instruction length has exceeded the maximum of 15 bytes.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_INSTRUCTION_LENGTH 0x02000000
|
||||
/**
|
||||
* @brief An error occured while decoding the vex-prefix.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_MALFORMED_VEX 0x04000000
|
||||
/**
|
||||
* @brief An error occured while decoding the evex-prefix.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_MALFORMED_EVEX 0x08000000
|
||||
/**
|
||||
* @brief An error occured while decoding the xop-prefix.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_MALFORMED_XOP 0x10000000
|
||||
/**
|
||||
* @brief A rex-prefix was found while decoding a vex/evex/xop instruction.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_ILLEGAL_REX 0x20000000
|
||||
/**
|
||||
* @brief An invalid constellation was found while decoding an instruction that uses the VSIB
|
||||
* addressing mode.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_INVALID_VSIB 0x40000000
|
||||
/**
|
||||
* @brief An error occured while decoding the instruction-operands.
|
||||
*/
|
||||
#define ZYDIS_IFLAG_ERROR_OPERANDS 0x40000000
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Prefix flags */
|
||||
|
@ -139,144 +133,138 @@ enum ZydisInstructionFlag
|
|||
typedef uint32_t ZydisPrefixFlags;
|
||||
|
||||
/**
|
||||
* @brief Values that represent instruction encodings.
|
||||
* @brief The instruction has the rex-prefix (0x40 - 0x4F).
|
||||
*/
|
||||
enum ZydisPrefixFlag
|
||||
{
|
||||
/**
|
||||
* @brief The instruction has the rex-prefix (0x40 - 0x4F).
|
||||
*/
|
||||
ZYDIS_PREFIX_REX = 0x00000001,
|
||||
/**
|
||||
* @brief The instruction has the xop-prefix (0x8F).
|
||||
*/
|
||||
ZYDIS_PREFIX_XOP = 0x00000002,
|
||||
/**
|
||||
* @brief The instruction has the vex-prefix (0xC4 or 0xC5).
|
||||
*/
|
||||
ZYDIS_PREFIX_VEX = 0x00000004,
|
||||
/**
|
||||
* @brief The instruction has the evex-prefix (0x62).
|
||||
*/
|
||||
ZYDIS_PREFIX_EVEX = 0x00000008,
|
||||
/**
|
||||
* @brief The instruction has the lock-prefix (0x0F)
|
||||
*/
|
||||
ZYDIS_PREFIX_LOCK = 0x00000010,
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
ZYDIS_PREFIX_REP = 0x00000020,
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
ZYDIS_PREFIX_REPE = 0x00000020,
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
ZYDIS_PREFIX_REPZ = 0x00000020,
|
||||
/**
|
||||
* @brief The instruction has the repne/repnz-prefix (0xF2)
|
||||
*/
|
||||
ZYDIS_PREFIX_REPNE = 0x00000040,
|
||||
/**
|
||||
* @brief The instruction has the repne/repnz-prefix (0xF2)
|
||||
*/
|
||||
ZYDIS_PREFIX_REPNZ = 0x00000040,
|
||||
/**
|
||||
* @brief The instruction has a segment-override prefix.
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_MASK = 0x00001F80,
|
||||
/**
|
||||
* @brief The instruction has the cs segment-override prefix (0x2E).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_CS = 0x00000080,
|
||||
/**
|
||||
* @brief The instruction has the ss segment-override prefix (0x36).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_SS = 0x00000100,
|
||||
/**
|
||||
* @brief The instruction has the ds segment-override prefix (0x3E).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_DS = 0x00000200,
|
||||
/**
|
||||
* @brief The instruction has the es segment-override prefix (0x26).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_ES = 0x00000400,
|
||||
/**
|
||||
* @brief The instruction has the fs segment-override prefix (0x64).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_FS = 0x00000800,
|
||||
/**
|
||||
* @brief The instruction has the gs segment-override prefix (0x65).
|
||||
*/
|
||||
ZYDIS_PREFIX_SEGMENT_GS = 0x00001000,
|
||||
/**
|
||||
* @brief The instruction has the operand-size-override prefix (0x66).
|
||||
*/
|
||||
ZYDIS_PREFIX_OPERANDSIZE = 0x00002000,
|
||||
/**
|
||||
* @brief The instruction has the address-size-override prefix (0x67).
|
||||
*/
|
||||
ZYDIS_PREFIX_ADDRESSSIZE = 0x00004000,
|
||||
/**
|
||||
* @brief The instruction has the xacquire prefix (0xF2).
|
||||
*/
|
||||
ZYDIS_PREFIX_XACQUIRE = 0x00008000,
|
||||
/**
|
||||
* @brief The instruction has the xrelease prefix (0xF3).
|
||||
*/
|
||||
ZYDIS_PREFIX_XRELEASE = 0x00010000,
|
||||
/**
|
||||
* @brief The instruction has the branch-not-taken hint (0x2E).
|
||||
*/
|
||||
ZYDIS_PREFIX_BRANCH_NOT_TAKEN = 0x00020000,
|
||||
/**
|
||||
* @brief The instruction has the branch-taken hint (0x3E).
|
||||
*/
|
||||
ZYDIS_PREFIX_BRANCH_TAKEN = 0x00040000,
|
||||
/**
|
||||
* @brief The instruction accepts the lock-prefix.
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_LOCK = 0x00080000,
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_REP = 0x00100000,
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_REPE = 0x00100000,
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_REPZ = 0x00100000,
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_REPNE = 0x00100000,
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
ZYDIS_PREFIX_ACCEPTS_REPNZ = 0x00100000,
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the first prefix-group (0x0F, 0xF3, 0xF2).
|
||||
*/
|
||||
ZYDIS_PREFIX_MULTIPLE_GRP1 = 0x01000000,
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the second prefix-group (0x2E, 0x36,
|
||||
* 0x3E, 0x26, 0x64, 0x65).
|
||||
*/
|
||||
ZYDIS_PREFIX_MULTIPLE_GRP2 = 0x02000000,
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the third prefix-group (0x66).
|
||||
*/
|
||||
ZYDIS_PREFIX_MULTIPLE_GRP3 = 0x04000000,
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the fourth prefix-group (0x67).
|
||||
*/
|
||||
ZYDIS_PREFIX_MULTIPLE_GRP4 = 0x08000000,
|
||||
};
|
||||
#define ZYDIS_PREFIX_REX 0x00000001
|
||||
/**
|
||||
* @brief The instruction has the xop-prefix (0x8F).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_XOP 0x00000002
|
||||
/**
|
||||
* @brief The instruction has the vex-prefix (0xC4 or 0xC5).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_VEX 0x00000004
|
||||
/**
|
||||
* @brief The instruction has the evex-prefix (0x62).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_EVEX 0x00000008
|
||||
/**
|
||||
* @brief The instruction has the lock-prefix (0x0F)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_LOCK 0x00000010
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_REP 0x00000020
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_REPE 0x00000020
|
||||
/**
|
||||
* @brief The instruction has the rep/repe/repz-prefix (0xF3)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_REPZ 0x00000020
|
||||
/**
|
||||
* @brief The instruction has the repne/repnz-prefix (0xF2)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_REPNE 0x00000040
|
||||
/**
|
||||
* @brief The instruction has the repne/repnz-prefix (0xF2)
|
||||
*/
|
||||
#define ZYDIS_PREFIX_REPNZ 0x00000040
|
||||
/**
|
||||
* @brief The instruction has a segment-override prefix.
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_MASK 0x00001F80
|
||||
/**
|
||||
* @brief The instruction has the cs segment-override prefix (0x2E).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_CS 0x00000080
|
||||
/**
|
||||
* @brief The instruction has the ss segment-override prefix (0x36).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_SS 0x00000100
|
||||
/**
|
||||
* @brief The instruction has the ds segment-override prefix (0x3E).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_DS 0x00000200
|
||||
/**
|
||||
* @brief The instruction has the es segment-override prefix (0x26).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_ES 0x00000400
|
||||
/**
|
||||
* @brief The instruction has the fs segment-override prefix (0x64).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_FS 0x00000800
|
||||
/**
|
||||
* @brief The instruction has the gs segment-override prefix (0x65).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_SEGMENT_GS 0x00001000
|
||||
/**
|
||||
* @brief The instruction has the operand-size-override prefix (0x66).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_OPERANDSIZE 0x00002000
|
||||
/**
|
||||
* @brief The instruction has the address-size-override prefix (0x67).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ADDRESSSIZE 0x00004000
|
||||
/**
|
||||
* @brief The instruction has the xacquire prefix (0xF2).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_XACQUIRE 0x00008000
|
||||
/**
|
||||
* @brief The instruction has the xrelease prefix (0xF3).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_XRELEASE 0x00010000
|
||||
/**
|
||||
* @brief The instruction has the branch-not-taken hint (0x2E).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_BRANCH_NOT_TAKEN 0x00020000
|
||||
/**
|
||||
* @brief The instruction has the branch-taken hint (0x3E).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_BRANCH_TAKEN 0x00040000
|
||||
/**
|
||||
* @brief The instruction accepts the lock-prefix.
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_LOCK 0x00080000
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_REP 0x00100000
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_REPE 0x00100000
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_REPZ 0x00100000
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_REPNE 0x00100000
|
||||
/**
|
||||
* @brief The instruction accepts the string prefixes (rep/repe/repz/repne/repnz).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_ACCEPTS_REPNZ 0x00100000
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the first prefix-group (0x0F, 0xF3, 0xF2).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_MULTIPLE_GRP1 0x01000000
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the second prefix-group (0x2E, 0x36,
|
||||
* 0x3E, 0x26, 0x64, 0x65).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_MULTIPLE_GRP2 0x02000000
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the third prefix-group (0x66).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_MULTIPLE_GRP3 0x04000000
|
||||
/**
|
||||
* @brief The instruction has multiple prefixes of the fourth prefix-group (0x67).
|
||||
*/
|
||||
#define ZYDIS_PREFIX_MULTIPLE_GRP4 0x08000000
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Instruction encoding */
|
||||
|
@ -631,6 +619,10 @@ typedef struct ZydisOperandInfo_
|
|||
*/
|
||||
uint8_t dataOffset;
|
||||
} imm;
|
||||
/**
|
||||
* @brief This field is intended for custom data and may be freely set by the user.
|
||||
*/
|
||||
void* userData;
|
||||
} ZydisOperandInfo;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
@ -685,7 +677,7 @@ typedef struct ZydisInstructionInfo_
|
|||
/**
|
||||
* @brief Detailed info for all instruction operands.
|
||||
*/
|
||||
ZydisOperandInfo operand[4];
|
||||
ZydisOperandInfo operand[5];
|
||||
/**
|
||||
* @brief The operand mode (16, 32, 64).
|
||||
*/
|
||||
|
@ -920,6 +912,10 @@ typedef struct ZydisInstructionInfo_
|
|||
uint8_t l;
|
||||
} internal;
|
||||
} details;
|
||||
/**
|
||||
* @brief This field is intended for custom data and may be freely set by the user.
|
||||
*/
|
||||
void* userData;
|
||||
} ZydisInstructionInfo;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -49,9 +49,9 @@ extern "C" {
|
|||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @brief A macro that defines zydis version.
|
||||
* @brief A macro that defines the zydis version.
|
||||
*/
|
||||
#define ZYDIS_VERSION 0x0002000000000000
|
||||
#define ZYDIS_VERSION (uint64_t)0x0002000000000000
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper macros */
|
||||
|
|
|
@ -194,15 +194,13 @@ static ZydisDecoderStatus ZydisInputNext(ZydisInstructionDecoder* decoder,
|
|||
/* Decoder functions */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
// TODO: Make ZydisInstructionInfo the first parameter
|
||||
|
||||
/**
|
||||
* @brief Decodes the rex-prefix.
|
||||
*
|
||||
* @param rexByte The rex byte.
|
||||
* @param info A pointer to the @c ZydisInstructionInfo struct.
|
||||
*/
|
||||
static void ZydisDecodeRexPrefix(uint8_t rexByte, ZydisInstructionInfo* info)
|
||||
static void ZydisDecodeRexPrefix(ZydisInstructionInfo* info, uint8_t rexByte)
|
||||
{
|
||||
ZYDIS_ASSERT(info);
|
||||
ZYDIS_ASSERT((rexByte & 0xF0) == 0x40);
|
||||
|
@ -513,7 +511,7 @@ static ZydisDecoderStatus ZydisCollectOptionalPrefixes(ZydisInstructionDecoder*
|
|||
|
||||
if (info->prefixFlags & ZYDIS_PREFIX_REX)
|
||||
{
|
||||
ZydisDecodeRexPrefix(info->details.rex.data[0], info);
|
||||
ZydisDecodeRexPrefix(info, info->details.rex.data[0]);
|
||||
}
|
||||
|
||||
if (groups[0] > 1)
|
||||
|
@ -681,6 +679,8 @@ static ZydisDecoderStatus ZydisDecodeOperandRegister(ZydisInstructionInfo* info,
|
|||
operand->reg = ZydisRegisterGetById(registerClass, registerId);
|
||||
}
|
||||
|
||||
// TODO: Return critical error, if an invalid register was found
|
||||
|
||||
return ZYDIS_STATUS_DECODER_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1246,13 +1246,14 @@ static ZydisDecoderStatus ZydisDecodeOperand(ZydisInstructionDecoder* decoder,
|
|||
{
|
||||
if (info->details.modrm.rm != 0x04)
|
||||
{
|
||||
//info->flags |= ZYDIS_IFLAG_ERROR_INVALID_VSIB; // TODO: Fatal error?
|
||||
info->flags |= ZYDIS_IFLAG_ERROR_INVALID_VSIB;
|
||||
return ZYDIS_STATUS_DECODER_INVALID_VSIB;
|
||||
}
|
||||
switch (info->addressMode)
|
||||
{
|
||||
case 16:
|
||||
//info->flags |= ZYDIS_IFLAG_ERROR_INVALID_VSIB; // TODO: Fatal error?
|
||||
break;
|
||||
info->flags |= ZYDIS_IFLAG_ERROR_INVALID_VSIB;
|
||||
return ZYDIS_STATUS_DECODER_INVALID_VSIB;
|
||||
case 32:
|
||||
operand->mem.index = operand->mem.index - ZYDIS_REGISTER_EAX + vsibBaseRegister;
|
||||
break;
|
||||
|
@ -1490,7 +1491,9 @@ static ZydisDecoderStatus ZydisDecodeOperands(ZydisInstructionDecoder* decoder,
|
|||
ZYDIS_ASSERT(decoder);
|
||||
ZYDIS_ASSERT(info);
|
||||
ZYDIS_ASSERT(definition);
|
||||
ZYDIS_ASSERT(definition->operandCount <= 6);
|
||||
|
||||
info->operandCount = definition->operandCount;
|
||||
for (int i = 0; i < definition->operandCount; ++i)
|
||||
{
|
||||
ZydisSemanticOperandType type = definition->operands[i].type;
|
||||
|
@ -1498,7 +1501,6 @@ static ZydisDecoderStatus ZydisDecodeOperands(ZydisInstructionDecoder* decoder,
|
|||
{
|
||||
break;
|
||||
}
|
||||
++info->operandCount;
|
||||
ZydisInstructionEncoding encoding = definition->operands[i].encoding;
|
||||
ZydisDecoderStatus status =
|
||||
ZydisDecodeOperand(decoder, info, &info->operand[i], type, encoding);
|
||||
|
@ -2494,11 +2496,22 @@ ZydisStatus ZydisDecoderDecodeNextInstruction(ZydisInstructionDecoder* decoder,
|
|||
return ZYDIS_STATUS_NO_MORE_DATA;
|
||||
}
|
||||
|
||||
void* userData[6];
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
userData[i] = info->operand[i].userData;
|
||||
}
|
||||
userData[5] = info->userData;
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->mode = decoder->disassemblerMode;
|
||||
info->operandMode = (decoder->disassemblerMode == ZYDIS_DISASSEMBLER_MODE_16BIT) ? 16 : 32;
|
||||
info->addressMode = decoder->disassemblerMode;
|
||||
info->instrAddress = decoder->instructionPointer;
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
info->operand[i].userData = userData[i];
|
||||
}
|
||||
info->userData = userData[5];
|
||||
|
||||
uint8_t bufferPosRead = decoder->buffer.posRead;
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ static ZydisStatus ZydisFormatterFormatInstructionIntel(ZydisInstructionFormatte
|
|||
case 1:
|
||||
case 2:
|
||||
typecast = (info->operand[i - 1].size != info->operand[i].size) ?
|
||||
info->operand[i - 1].size : 0;
|
||||
info->operand[i].size : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue