[Post] Use reflector and filedisassembler to decompile. Net Windows programs

Source: Internet
Author: User
Tags reflector

A problem occurs when using filedisassembler to decompile windows application. The resx resource file does not match the CS file. The project compilation does not work. After modifying the resx file to the CS folder

Problem, but you cannot directly modify the control "Visually" in the form design. This is troublesome and not intuitive, so you should modify it.Source codeIn line with the source file layout of vs2008.

The following describes the modification steps:

1. Because filedisassembler generates a directory for each namespace and stores the sourceCodeThe resource resx file is directly added to the project directory, and all resources should be put back to the source directory. For example

For tryassemb. form1.resx in the project folder, change it to form1.resx and move it to the tryassemb directory.

2. Open the "view designer" on the form and you will find the following error:



The modification method is for all systems. windows. forms. the control in the namespace must be declared in the full namespace, for example, the base in the namespace. autoscalemode = autoscalemode. font; it should be changed to base. autoscalemode = system. windows. forms. autoscalemode. font; and textbox textbox1; should also be changed to private system. windows. forms. textbox textbox1; then vs2008 can recognize that this control is to be drawn on the form.
 

PS. At the beginning, I thought I was about to split form1 into form1.cs and form1.designer. CS like vs. Every time I had to work hard to split it, I finally found that it was not needed at all, ^ _ ^.

 

 

 

Believe that most. netProgramPersonnel have experience in using reconfigurator. For whatever purpose, if you want to modify the code after decompiling the hosting program with the recycltor, the list in this article may be a useful reference.

 

After decompiling the code using the filegenerator plug-in of recycltor, you can obtain the source code including the project file. However, there are various problems in the Code and it is generally not possible to compile the code at a time. The following will discuss these issues in detail:

Enumeration problems

 

For code readability, it may take some time to check metadata to modify the int value back to the enumerated value. In particular, if you want to use the Form Designer, vs2008 may not understand the int value.

Attribute Problems

 

For example, after a property called names is decompiled, it may be restored to the set_names (names) and get_names () methods, which may be slow to replace one by one. You can replace it with a regular expression.
The set_xxx (XXX) method can be replaced.
Set _ {[A-Z] *} \ (
Is
\ 1 = (
The get_xxx () method can be replaced.
Get _ {[A-Z] *} \ (\)
Is
\ 1
Then, fix the incorrect methods.

Delegation and callback Functions

 

It is generally restored to the add_xxx (methodsname) method, and needs to be changed to + = methodsname

Resource problems

 

Use the resgen.exe tool under the. NET Framework SDK to decompile and embed the *. Resources file into the *. resx file,
Syntax: resgen.exe *. resources *. resx, and then set *. if resx is included in the project, it will automatically file with the same name as the form file *. CS Association. If there is no association, You can first exclude it and then add the big method.

Namespace Problems

 

If you want to switch to the IDE Form Designer without errors, you also need to add a namespace prefix such as system. Windows. Forms in *. CS.

Form Designer RecognitionProblem

 

The following code is required:
Componentresourcemanager manager = new componentresourcemanager (typeof (classname ));
Replace
System. componentmodel. componentresourcemanager resources = new system. componentmodel. componentresourcemanager (typeof (classname ));
The Form Designer can be recognized normally.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.