Skip to content

Commit 5f495c6

Browse files
authored
Merge pull request #21 from dividereis/patch-1
Update README.md
2 parents ee9394f + a03759f commit 5f495c6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
[![Join the chat at https://gitter.im/dnpatch/Lobby](https://badges.gitter.im/dnpatch/Lobby.svg)](https://gitter.im/dnpatch/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
99

1010
## What is dnpatch?
11-
dnpatch is the ultimate library for all your .NET patching needs. It offers automated assembly patching, signature scanning and last but but not least bypassing of obfuscators by it's ability to find methods in renamed/obfuscated types. Since the stars on GitHub exploded in a few days, dnpatch has been extended by a couple of projects. The most important one is dnpatch.deobfuscation which integrates de4dot directly into dnpatch. Also there is dnpatch.script, which gives you the ability to write patchers with pure JSON!
12-
The library itself, uses dnlib (see next part).
11+
dnpatch is the ultimate library for all your .NET patching needs. It offers automated assembly patching, signature scanning and last but but not least bypassing of obfuscators by its ability to find methods in renamed/obfuscated types. Since the stars on GitHub exploded in a few days, dnpatch has been extended by a couple of projects. The most important one is dnpatch.deobfuscation which integrates de4dot directly into dnpatch. Also there is dnpatch.script, which gives you the ability to write patchers with pure JSON!
12+
The library itself uses dnlib (see next part).
1313

1414
## Notes
15-
Since dnpatch uses dnlib, it is highly recommended to use dnSpy to analyze your assemblies first, so it is guaranteed that you will use the correct names, offsets, etc, because it does use dnlib aswell.
15+
Since dnpatch uses dnlib, it is highly recommended to use dnSpy to analyze your assemblies first, to ensure that you use the correct names, offsets, etc, because it uses dnlib aswell.
1616

1717
## Recommendations
18-
It is highly recommended to calculate the position of instructions instead of defining indexes, to ensure that the patcher will still work after assembly updates.
18+
It is highly recommended that you calculate the instruction's index instead of defining it, to improve the likelihood of compatibility with future updates.
1919

2020
## Patching
2121
The constructor takes the filename of the assembly.
@@ -28,7 +28,7 @@ Patcher patcher = new Patcher("Test.exe", true);
2828
```
2929

3030
### Targeting Methods
31-
All methods take an object called Target as argument. The object is defined as follows:
31+
All methods take an object called Target as an argument. The object is defined as follows:
3232
```cs
3333
public string Namespace { get; set; } // needed
3434
public string Class { get; set; } // needed
@@ -85,7 +85,7 @@ var target = new Target
8585
If you want to patch multiple methods create a Target[] and pass it to the functions, it is accepted by the most of them.
8686

8787
### Creating Instructions
88-
Reference dnlib and create an Instruction[] or Instruction with your Instruction(s) and assign Indexes (int[]) or Index with the indexes where the Instructions are. You can find them by reverse engineering your assembly via dnSpy or some other decompiler.
88+
Reference dnlib and create an Instruction[] or Instruction with your Instruction(s), then assign assign indexes where the Instructions are.You can find them by reverse engineering your assembly via dnSpy or any other decompiler.
8989

9090
Small Example:
9191
```cs
@@ -137,7 +137,7 @@ patcher.Patch(Target[]);
137137
```
138138

139139
### Finding an instruction
140-
In some cases it might be useful to have find an instruction within a method, for example if the method got updated.
140+
In some cases, it might be useful to find an instruction within a method, for example if the method was updated.
141141
```cs
142142
Instruction opCode = Instruction.Create(OpCodes.Ldstr, "TheTrain");
143143
Instruction toFind = Instruction.Create(OpCodes.Ldstr, "TheWord");
@@ -152,7 +152,7 @@ target.Index = p.FindInstruction(target, toFind);
152152
// now you have the full Target object
153153
```
154154

155-
Let's say there are multiple identical instructions. What now, baoss? Well, it's simple. There's an overload that takes and int which is the occurence of the instruction which you'd like to find.
155+
Let's say there are multiple identical instructions. What now, baoss? Well, it's simple. There's an overload that takes an int which is the occurence of the instruction which you'd like to find.
156156
```cs
157157
Instruction opCode = Instruction.Create(OpCodes.Ldstr, "TheTrain");
158158
Instruction toFind = Instruction.Create(OpCodes.Ldstr, "TheWord");
@@ -294,7 +294,7 @@ p.FindInstructionsByOpcode(OpCode[]);
294294
Both ways return an Target[] which contains all targets pointing to the findings.
295295

296296
#### Find instructions in methods or classes
297-
If you want to find the instructions and you know the class and optionally the method you can let this method return a Target[] with the pathes and indexes.
297+
If you want to find the instructions and you know the class (and optionally the method), you can let this method return a Target[] with the pathes and indexes.
298298
```cs
299299
p.FindInstructionsByOperand(Target,int[],bool);
300300
// int[]: the operands
@@ -305,7 +305,7 @@ p.FindInstructionsByOpcode(Target,int[],bool);
305305
```
306306

307307
### Patch properties
308-
Now you can rewrite a propertie's getter and setter like this:
308+
Now you can rewrite a property's getter and setter like this:
309309
```cs
310310
target = new Target()
311311
{
@@ -374,7 +374,7 @@ patcher.InjectMethod(target);
374374
For now refer to this page: https://github.com/0xd4d/dnlib/blob/master/Examples/Example2.cs
375375

376376
### Saving the patched assembly
377-
If you want to safe the assembly under a different name use this:
377+
If you want to save the assembly under a different name use this:
378378
```cs
379379
patcher.Save(String); // filename here
380380
```

0 commit comments

Comments
 (0)