?
Solved

Dot Net IL Code to C# conversion

Posted on 2010-05-27
16
Medium Priority
?
1,282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +2
16 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
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:sedgwick
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

Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

777 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