C # code decompile get project to run source code
Excerpt from: http://www.cnblogs.com/know/archive/2011/03/15/1985026.html
When it comes to "C # code decompile," You might think of the Reflector Code Anti-compilation tool, which should not be too unfamiliar to them; it is an indispensable utility for C # development. Through it we can easily view the source code of an assembly (this is its most basic use, is also commonly used), but also easy to crack software ..., and I want to share with you this article is: using reflector to the development of C # software [Project] (this article is about the WinForm project , for project code restoration that can be used or referenced by. NET projects--decompile to get the project source to run. I do the anti-compilation, is not ' cracked ', its use of the premise or situation is: The company originally invited people to develop the ' catering software (Kindergarten version) ', the existing customer consultation wants to buy, and there are some problems in the software needs to be changed,-not I developed, the software also no source code, want to modify can only find ways to The specific ' crack ' method is recorded in the next, convenient for you to view later! (PS: ' Crack ' The method, you have been groping before. But trapped in the anti-compilation after the error is more, no patience, some problems feel more bizarre, try to give up a few times-this is the indirect explanation: the real hacker, should be more patient, hehe ..., but do software development, but do not need this? )
A. Tools used: Reflector, specifically: Reflector plug-in file Disassembler (specifically what and how to use, direct online search).
B. Open the reflector, select the software (. exe) main program to ' crack ', then select and click on:, on the right side of the assembly (output) Type selection interface to select the type ' Windows Appliction ' (because it is the WinForm application, if the other is selected as ' Class library, you need to change the output type in the project properties in the following steps, which is not recommended),
Click Generate to get the source of this main assembly, other related assemblies to do so again! --don't think it's done, it's just the first step, the trouble is behind!
C. will generate the source code in VS Open (project), first try to run, (generally) will error, exclude ' XXX assembly does not exist ' such errors, I encountered the following:
UsingSystem;
UsingSystem.Collections.Generic;
UsingSystem.Runtime.CompilerServices;
UsingSystem.Runtime.InteropServices;
[Compilergenerated]
InternalClass<Privateimplementationdetails>{1ff4f699-35E0-4117-Bdbc-9E44A1B0F9F5}
{
InternalStaticDictionary<String,Int>$ $method 0x600012e-1;
InternalStaticDictionary<String,Int>$ $method 0x6000137-1;
InternalStaticDictionary<String,Int>$ $method 0x6000137-2;
InternalStaticDictionary<String,Int>$ $method 0x600014a-1;
InternalStaticDictionary<String,Int>$ $method 0x6000169-1;
InternalStaticDictionary<String,Int>$ $method 0x60001b6-1;
InternalStatic__staticarrayinittypesize=20$ $method 0x6000213-1;//Data size:20 bytes
InternalStatic__staticarrayinittypesize=20$ $method 0x6000213-2;//Data size:20 bytes
InternalStatic__staticarrayinittypesize=20$ $method 0x6000213-3;//Data size:20 bytes
InternalStatic__staticarrayinittypesize=20 $ $method 0x6000213 -4// data size:20 bytes
[StructLayout (layoutkind.explicit, Size=20=1)]
privatestruct __staticarrayinittypesize=20 {
}
} /span>
The source file will appear a _privateimplementationdetails_{1ff4f699-35e0-4117-bdbc-9e44a1b0f9f5}.cs file name is very long content, such as the garbled class on this workaround: note this class or delete it directly. "Program-related files, tablets, databases, etc. to remember to put in the project associated location, usually under the bin/debug/folder"
D. Add a reference to the related assembly and set the startup object. Here, almost the program can run, but it's not finished-because the post-compilation code, the location of the folder, and the interface to the resource reference are basically all messed up. So the key problem to solve now is to restore the association and references between files (other problems, which can be solved by debugging). :
The. cs and. resx (Resource) files for the form are not in the same folder, and the. resx files for the form are prefixed with the project or solution name (Zhiyisystem.)--this is point! This is the key to solving the problem: To recover the association between the. cs and. resx files of a form, the operation is roughly in two steps:1. Place the form's. cs and. resx files in the same file-that is, the same directory. 2. Get rid of the form of the. resx file prefix-that is, modify the file name, if it is a document to modify, the form is more, is a very repetitive and boring things, so on the Internet to find "batch modified file name" tool, downloaded one or two feelings are not good use, can not find, only own, and then this thing simple, To be blunt is to traverse the file in the folder and ' rename ' (the code is not posted, the article is attached to its own written "Batch change file name" tool).
In this way, the program can really run up. Although I write it, it seems ' cracked ' is a moment of the matter, but I do, but after several toss a few times feel "forget, and stuck ...", some of the big or small problems, here because of the reasons for the time and some steps 1:30 will not remember, but the main method should not fall, if there are not understand the friend , can message exchange, then do the answer, also hope in the ' crack ' method has experience, can make more comments, share your ' crack ' experience!
Post-Attach:
Batch modify file Name tool. rar
(Reflector plugin) Reflector.FileDisassembler.rar
C # code decompile get project to run source code