?
Solved

Dot Net IL Code to C# conversion

Posted on 2010-05-27
16
Medium Priority
?
1,337 Views
Last Modified: 2013-12-17
Hi All,

I wanna build Dot Net Reflector (which is a tool needs to be build in one of my client's application, hence i cannot use third party tool, such as .NET Reflector by Red Gate). I already succeded to read the code in a function or method in IL code. What i  require now is to convert th IL code into C# kangauge. Is any body help me for this problem.

As already said i am bound not to use third party tool hence i need to re-invent the tool to convert IL to C#.

Any help will be appritiated.

Thanks and
Warm Regards

Pradip
0
Comment
Question by:pradipkkoli
  • 6
  • 3
  • 2
  • +2
14 Comments
 
LVL 8

Expert Comment

by:rambovn
ID: 32859834
there is an open source prj here: http://legacy.saurik.com/net/exemplar/
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 32859863
Perhaps you could use Reflector against Reflector and learn how it handles the problem.
0
 
LVL 8

Expert Comment

by:rambovn
ID: 32859884
it is protected by {sa} ;)
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 53

Expert Comment

by:Dhaest
ID: 32859921
@rambovn: I never tried it, but I already thought that there would be some protection on that code :) Anyway, I don't see the use of reinventing the hot water when there is a free tool on the market
0
 

Author Comment

by:pradipkkoli
ID: 32866992
Hi rambovn,

The dowloading from link http://legacy.saurik.com/net/exemplar/ is not working. Any other reference.

Thanks and
Warm Regards
Pradip
0
 
LVL 8

Expert Comment

by:rambovn
ID: 32867443
0
 

Author Comment

by:pradipkkoli
ID: 32878175
Hi Rambovn,

 The reference link provided is no use for me! The link provide an application or the code in langauge other then C#. Hence entire reference is useless.

I think my points are not clear to the experts. All experts are either providing me the reference for a tool or for reflection in C# dotnet. THIS ALL I HAVE TRIED!  

PLEASE UNDERSTAND I AM NOT LOOKING FOR A TOOL (MEANS .EXE .DLL FILES) NEITHER I AM LOOKING FOR SOURCE CODE IN OTHER LANGAUGE.  I REQUIRE REFERENCE IN C# TO READ METHOD IN DLL I HAD ALREADY TRIED THIS WITH REFLECTION BUT IT JUST PROVIDE THE METHOD NAME OR PROPERTY NAME.  PLEASE TRY AND UNDER STAND MY POINT.

1) I DO NOT REQUIRE ANY TOOL MEANS ANY EXE OR DLL FILES (THIS I HAD ALREADY GOT AND IS USELESS FOR ME)
2) I WANNA ONLY USE C# DOT NET 2.0 OR +

Please advice
0
 
LVL 42

Expert Comment

by:Meir Rivkin
ID: 32906174
>>I already succeded to read the code in a function or method in IL code
how did u manage to do it?
can u post some relevant code so it can give me a reference to the conversion code you need?
0
 

Author Comment

by:pradipkkoli
ID: 32907328
Hai sedgwick,

Thanks for your reply. Yes there are many code which can read dll and convert to IL code, in .net one of the useful reference i found long ago is as follow:

http://www.codeproject.com/KB/dotnet/NetDasm.aspx

We can see that code from dll for a method in an assembly is easily converted into IL code. Now the issue is converting this IL code to C# again.

Thanks and
Warm Regards
Pradip
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 32914005
This is a duplicate question.  You have to use the following COM API library from Microsoft along with the original PDB files to do this.  If you don't have the PDB files it is impossible.

http://msdn.microsoft.com/en-us/library/x93ctkx8%28VS.80%29.aspx
0
 

Author Comment

by:pradipkkoli
ID: 32914511
Hai tedbilly,

Thanks for your reply. Yes i think as per the expert comments i am nearer to the solution of my question (problem). Still there are some doubt and difficulties i will be thankful if you can advice me :

1) The reference provided is pure c++, i am not aware completely how to set up visual studio for this language (besides comm c++ program i did in my college). Hence it is not compulsory but a request, if u can provide me the project set up for the source, as there is no support for any .NET language (please refer to the link you have provided.)

2) I am surprise tedbilly, you said that with pdb files only we can read actual contains of a method in an assembly. But my surprise is how some of the free tools out there are able to do this without PDB file for an assembly. This is bothering me, how that tool read method details by using just DLLs!

Hence to be clear and simple, i already have this tools but the problem is i wanna integrate this tool in my application and i m bound not to use third party tool. And requirement is only to read DLL made in any .NET language.

Please advice your suggestion or alternative.

Thanks and
Warm Regards
Pradip
0
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 2000 total points
ID: 32914608
I've used those tools on some of my code by first compiling my code, then decompiling it and to be honest those tools don't do a perfect job.

What you are trying to do is very complex and will take a LONG time.  There isn't an easy solution.

I can point you in the right direction but you will have to do a lot of work yourself.  If you don't have the experience to mix C++ with .NET I think you are going to struggle to complete this work.
0
 

Author Comment

by:pradipkkoli
ID: 32930262
Hai tedbilly,

  Thanks for your reply. Hmmm.... so it is really not easy task, fine i m ok with your comments.

Thanks and
Warm Regards
Pradip
0
 

Author Closing Comment

by:pradipkkoli
ID: 32930268
thnks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question