Skip to content

Commit e21e76b

Browse files
committed
+ Deprecated old native instruction collection and enumerator
+ Updated documentation and code for new deferred instruction enumerator
1 parent e97109d commit e21e76b

File tree

6 files changed

+243
-118
lines changed

6 files changed

+243
-118
lines changed

Capstone.NET.sln

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,24 @@ Global
1717
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1818
.NET4Debug|x86 = .NET4Debug|x86
1919
.NET4Release|x86 = .NET4Release|x86
20-
Debug|x86 = Debug|x86
21-
Release|x86 = Release|x86
2220
EndGlobalSection
2321
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2422
{1297DCEE-009D-4739-8124-3F064EA9EA10}..NET4Debug|x86.ActiveCfg = .NET45Release|x86
2523
{1297DCEE-009D-4739-8124-3F064EA9EA10}..NET4Debug|x86.Build.0 = .NET45Release|x86
2624
{1297DCEE-009D-4739-8124-3F064EA9EA10}..NET4Release|x86.ActiveCfg = .NET45Release|x86
2725
{1297DCEE-009D-4739-8124-3F064EA9EA10}..NET4Release|x86.Build.0 = .NET45Release|x86
28-
{1297DCEE-009D-4739-8124-3F064EA9EA10}.Debug|x86.ActiveCfg = .NET45Debug|x86
29-
{1297DCEE-009D-4739-8124-3F064EA9EA10}.Debug|x86.Build.0 = .NET45Debug|x86
30-
{1297DCEE-009D-4739-8124-3F064EA9EA10}.Release|x86.ActiveCfg = .NET45Release|x86
31-
{1297DCEE-009D-4739-8124-3F064EA9EA10}.Release|x86.Build.0 = .NET45Release|x86
3226
{7D755424-C594-4605-820D-9AF880E091BC}..NET4Debug|x86.ActiveCfg = .NET45Release|x86
3327
{7D755424-C594-4605-820D-9AF880E091BC}..NET4Debug|x86.Build.0 = .NET45Release|x86
3428
{7D755424-C594-4605-820D-9AF880E091BC}..NET4Release|x86.ActiveCfg = .NET45Release|x86
3529
{7D755424-C594-4605-820D-9AF880E091BC}..NET4Release|x86.Build.0 = .NET45Release|x86
36-
{7D755424-C594-4605-820D-9AF880E091BC}.Debug|x86.ActiveCfg = .NET45Debug|x86
37-
{7D755424-C594-4605-820D-9AF880E091BC}.Debug|x86.Build.0 = .NET45Debug|x86
38-
{7D755424-C594-4605-820D-9AF880E091BC}.Release|x86.ActiveCfg = .NET45Release|x86
39-
{7D755424-C594-4605-820D-9AF880E091BC}.Release|x86.Build.0 = .NET45Release|x86
4030
{D1A6EC03-1420-4516-8548-4117A18DA8B3}..NET4Debug|x86.ActiveCfg = .NET45Release|x86
4131
{D1A6EC03-1420-4516-8548-4117A18DA8B3}..NET4Debug|x86.Build.0 = .NET45Release|x86
4232
{D1A6EC03-1420-4516-8548-4117A18DA8B3}..NET4Release|x86.ActiveCfg = .NET45Release|x86
4333
{D1A6EC03-1420-4516-8548-4117A18DA8B3}..NET4Release|x86.Build.0 = .NET45Release|x86
44-
{D1A6EC03-1420-4516-8548-4117A18DA8B3}.Debug|x86.ActiveCfg = .NET45Debug|x86
45-
{D1A6EC03-1420-4516-8548-4117A18DA8B3}.Debug|x86.Build.0 = .NET45Debug|x86
46-
{D1A6EC03-1420-4516-8548-4117A18DA8B3}.Release|x86.ActiveCfg = .NET45Release|x86
47-
{D1A6EC03-1420-4516-8548-4117A18DA8B3}.Release|x86.Build.0 = .NET45Release|x86
4834
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}..NET4Debug|x86.ActiveCfg = .NET4Debug|x86
4935
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}..NET4Debug|x86.Build.0 = .NET4Debug|x86
5036
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}..NET4Release|x86.ActiveCfg = .NET4Release|x86
5137
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}..NET4Release|x86.Build.0 = .NET4Release|x86
52-
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}.Debug|x86.ActiveCfg = .NET4Debug|x86
53-
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}.Debug|x86.Build.0 = .NET4Debug|x86
54-
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}.Release|x86.ActiveCfg = .NET4Release|x86
55-
{D8E7BF01-1424-4312-AF14-982E7DA9B9BC}.Release|x86.Build.0 = .NET4Release|x86
5638
EndGlobalSection
5739
GlobalSection(SolutionProperties) = preSolution
5840
HideSolutionNode = FALSE

CapstoneCMD/Program.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal static void Main(string[] args) {
3232
Program.ShowArm(DisassembleMode.Arm32);
3333
break;
3434
case "ARM32-V8":
35-
Program.ShowArm((int)DisassembleMode.Arm32 + DisassembleMode.ArmV8);
35+
Program.ShowArm((int) DisassembleMode.Arm32 + DisassembleMode.ArmV8);
3636
break;
3737
case "ARM32-Thumb":
3838
Program.ShowArm(DisassembleMode.ArmThumb);
@@ -74,16 +74,16 @@ internal static void ShowArm(DisassembleMode mode) {
7474
var code = new byte[0];
7575
switch (mode) {
7676
case DisassembleMode.Arm32:
77-
code = new byte[] {0xED, 0xFF, 0xFF, 0xEB, 0x04, 0xe0, 0x2d, 0xe5, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x22, 0xe5, 0xf1, 0x02, 0x03, 0x0e, 0x00, 0x00, 0xa0, 0xe3, 0x02, 0x30, 0xc1, 0xe7, 0x00, 0x00, 0x53, 0xe3, 0x00, 0x02, 0x01, 0xf1, 0x05, 0x40, 0xd0, 0xe8, 0xf4, 0x80, 0x00, 0x00};
77+
code = new byte[] { 0xED, 0xFF, 0xFF, 0xEB, 0x04, 0xe0, 0x2d, 0xe5, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x22, 0xe5, 0xf1, 0x02, 0x03, 0x0e, 0x00, 0x00, 0xa0, 0xe3, 0x02, 0x30, 0xc1, 0xe7, 0x00, 0x00, 0x53, 0xe3, 0x00, 0x02, 0x01, 0xf1, 0x05, 0x40, 0xd0, 0xe8, 0xf4, 0x80, 0x00, 0x00 };
7878
break;
79-
case (int)DisassembleMode.Arm32 + DisassembleMode.ArmV8:
79+
case (int) DisassembleMode.Arm32 + DisassembleMode.ArmV8:
8080
code = new byte[] { 0xe0, 0x3b, 0xb2, 0xee, 0x42, 0x00, 0x01, 0xe1, 0x51, 0xf0, 0x7f, 0xf5 };
8181
break;
8282
case DisassembleMode.ArmThumb:
83-
code = new byte[] {0x70, 0x47, 0xeb, 0x46, 0x83, 0xb0, 0xc9, 0x68, 0x1f, 0xb1, 0x30, 0xbf, 0xaf, 0xf3, 0x20, 0x84};
83+
code = new byte[] { 0x70, 0x47, 0xeb, 0x46, 0x83, 0xb0, 0xc9, 0x68, 0x1f, 0xb1, 0x30, 0xbf, 0xaf, 0xf3, 0x20, 0x84 };
8484
break;
8585
case (int) DisassembleMode.ArmThumb + DisassembleMode.ArmCortexM:
86-
code = new byte[] {0xef, 0xf3, 0x02, 0x80};
86+
code = new byte[] { 0xef, 0xf3, 0x02, 0x80 };
8787
break;
8888
}
8989

@@ -194,7 +194,7 @@ internal static void ShowArm64() {
194194
// Disassemble All Binary Code.
195195
//
196196
// ...
197-
var code = new byte[] {0x09, 0x00, 0x38, 0xd5, 0xbf, 0x40, 0x00, 0xd5, 0x0c, 0x05, 0x13, 0xd5, 0x20, 0x50, 0x02, 0x0e, 0x20, 0xe4, 0x3d, 0x0f, 0x00, 0x18, 0xa0, 0x5f, 0xa2, 0x00, 0xae, 0x9e, 0x9f, 0x37, 0x03, 0xd5, 0xbf, 0x33, 0x03, 0xd5, 0xdf, 0x3f, 0x03, 0xd5, 0x21, 0x7c, 0x02, 0x9b, 0x21, 0x7c, 0x00, 0x53, 0x00, 0x40, 0x21, 0x4b, 0xe1, 0x0b, 0x40, 0xb9, 0x20, 0x04, 0x81, 0xda, 0x20, 0x08, 0x02, 0x8b, 0x10, 0x5b, 0xe8, 0x3c};
197+
var code = new byte[] { 0x09, 0x00, 0x38, 0xd5, 0xbf, 0x40, 0x00, 0xd5, 0x0c, 0x05, 0x13, 0xd5, 0x20, 0x50, 0x02, 0x0e, 0x20, 0xe4, 0x3d, 0x0f, 0x00, 0x18, 0xa0, 0x5f, 0xa2, 0x00, 0xae, 0x9e, 0x9f, 0x37, 0x03, 0xd5, 0xbf, 0x33, 0x03, 0xd5, 0xdf, 0x3f, 0x03, 0xd5, 0x21, 0x7c, 0x02, 0x9b, 0x21, 0x7c, 0x00, 0x53, 0x00, 0x40, 0x21, 0x4b, 0xe1, 0x0b, 0x40, 0xb9, 0x20, 0x04, 0x81, 0xda, 0x20, 0x08, 0x02, 0x8b, 0x10, 0x5b, 0xe8, 0x3c };
198198
var instructions = disassembler.DisassembleAll(code, 0x2C);
199199

200200
var hexCode = BitConverter.ToString(code).Replace("-", " ");
@@ -327,11 +327,11 @@ internal static void ShowX86() {
327327
// Disassemble All Binary Code.
328328
//
329329
// ...
330-
var code = new byte[] {0x8d, 0x4c, 0x32, 0x08, 0x01, 0xd8, 0x81, 0xc6, 0x34, 0x12, 0x00, 0x00, 0x05, 0x23, 0x01, 0x00, 0x00, 0x36, 0x8b, 0x84, 0x91, 0x23, 0x01, 0x00, 0x00, 0x41, 0x8d, 0x84, 0x39, 0x89, 0x67, 0x00, 0x00, 0x8d, 0x87, 0x89, 0x67, 0x00, 0x00, 0xb4, 0xc6};
330+
var code = new byte[] { 0x8d, 0x4c, 0x32, 0x08, 0x01, 0xd8, 0x81, 0xc6, 0x34, 0x12, 0x00, 0x00, 0x05, 0x23, 0x01, 0x00, 0x00, 0x36, 0x8b, 0x84, 0x91, 0x23, 0x01, 0x00, 0x00, 0x41, 0x8d, 0x84, 0x39, 0x89, 0x67, 0x00, 0x00, 0x8d, 0x87, 0x89, 0x67, 0x00, 0x00, 0xb4, 0xc6 };
331331
#if DISASSEMBLE_STREAM
332-
//$REVIEW: uxmal: This exercises the lazy stream implementation of the disassembler.
333-
// It isn't greed and tries to disassembly all the instructions at once,
334-
// but only on demand.
332+
//$REVIEW: uxmal: This exercises the lazy stream implementation of the disassembler.
333+
// It isn't greed and tries to disassembly all the instructions at once,
334+
// but only on demand.
335335
var instructions = disassembler.DisassembleStream(code, 0, 0x1000);
336336
#else
337337
var instructions = disassembler.DisassembleAll(code);

0 commit comments

Comments
 (0)