Search Results

Search found 32 results on 2 pages for 'ildasm'.

Page 1/2 | 1 2  | Next Page >

  • Guaranteed way to find the ildasm.exe and ilasm.exe files regardless of .NET version/environment?

    - by m-y
    Is there a way to programmatically get the FileInfo/Path of the ildasm.exe/ilasm.exe executables? I'm attempting to decompile and recompile a dll/exe file appropriately after making some alterations to it (I'm guessing PostSharp does something similar to alter the IL after the compilation). I found a blog post that pointed to: var pfDir = Environment.GetFolderPath(Environment.SpecialFolders.ProgramFiles)); var sdkDir = Path.Combine(pfDir, @"Microsoft SDKs\Windows\v6.0A\bin"); ... However, when I ran this code the directory did not exist (mainly because my SDK version is 7.1), so on my local machine the correct path is @"Microsoft SDKs\Windows\v7.1\bin". How do I ensure I can actually find the ildasm.exe? Similarly, I found another blog post on how to get access to ilasm.exe as: string windows = Environment.GetFolderPath(Environment.SpecialFolder.System); string fwork = Path.Combine(windows, @"..\Microsoft.NET\Framework\v2.0.50727"); ... While this works, I noticed that I have Framework and Framework64, and within Framework itself I have all of the versions up to v4.0.30319 (same with Framework64). So, how do I know which one to use? Should it be based on the .NET Framework version I'm targetting? Summary: How do I appropriately guarantee to find the correct path to ildasm.exe? How do I appropriately select the correct ilasm.exe to compile?

    Read the article

  • Using ILDASM with Visual Studio 2008

    - by pianoman
    I just installed Visual Studio 2008, and am looking to use the Microsoft Intermediate Language Disassembler (ILDASM.exe) to look at some DLLs. Problem is, "ildasm" is not recognized on the command line, and I cannot find ildasm.exe anywhere in my VS 2008 install directory (e.g. c:\programs\Visual_Studio_9.0\). Any ideas? UPDATE: Found it! At C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin This answer helped.

    Read the article

  • ildasm and dynamic exe files

    - by TonyNeallon
    Hi There, I am trying to create an application can modify properties in IL to create a slightly different executable. E.g Client A runs app and a label on the WinForm label Reads "Client A:". Client B runs the app and Label Says "Client B". Easy I know using config files or resource files but thats not an option for this project. The Main program needs to be able to generate .exe file dynamically based on some form fields entered by user. My solution was to create a standalone executable that contained all the elements which I needed to make dynamic. I then used ildasm to generate the IL and thought that I could use this IL and substitute tags for the elements i wanted to make dynamic. I could then replace those tags at runtime after user filled the form using regex etc. The problem is, the if i re save the IL file generated by ILDASM as an exe and try to run it. I just launches console and does nothing. Am I going about this the wrong way? I didnt want to delve into Reflection as the dynamic .exe is a really simple one and I thought reverse engineering IL with ildasm would be the quickest way. You thoughts and pointers are much appreciated. Tony

    Read the article

  • "From the Coal Face" - 1 - What ILDASM can reveal!

    - by TATWORTH
    In a place far, far away, there was a project where the Architect decided on using embedded TSQL in a Dot Net application, rather than use stored procedures. I located ILDASM.EXE (my Framework 3.5 version lives at C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin on my home development PC) and created a shortcut to it in the SendTo folder. Now I could set about doing a simple demonstration to the Architect by taking one of the Dot Net EXE's with the embedded TSQL and sending it to ILDASM.  Since I had written most of the embedded TSQL, it was a matter of seconds before I located the embedded TSQL within the Exe. The TSQL that was supposed to be safely hidden within the EXE was easily located and and copied. (It should also be noted that we could have encrypted the stored procedures on loading them to the database.)

    Read the article

  • "From the Coal Face" - 1 - What ILDASM can reveal!

    - by TATWORTH
    In a place far, far away, there was a project where the Architect decided on using embedded TSQL in a Dot Net application, rather than use stored procedures. I located ILDASM.EXE (my Framework 3.5 version lives at C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin on my home development PC) and created a shortcut to it in the SendTo folder. Now I could set about doing a simple demonstration to the Architect by taking one of the Dot Net EXE's with the embedded TSQL and sending it to ILDASM.  Since I had written most of the embedded TSQL, it was a matter of seconds before I located the embedded TSQL within the Exe. The TSQL that was supposed to be safely hidden within the EXE was easily located and and copied. (It should also be noted that we could have encrypted the stored procedures on loading them to the database.)

    Read the article

  • System.Reflection - Global methods aren't available for reflection

    - by mrjoltcola
    I have an issue with a semantic gap between the CLR and System.Reflection. System.Reflection does not (AFAIK) support reflecting on global methods in an assembly. At the assembly level, I must start with the root types. My compiler can produce assemblies with global methods, and my standard bootstrap lib is a dll that includes some global methods. My compiler uses System.Reflection to import assembly metadata at compile time. It seems if I depend on System.Reflection, global methods are not a possibility. The cleanest solution is to convert all of my standard methods to class static methods, but the point is, my language allows global methods, and the CLR supports it, but System.Reflection leaves a gap. ildasm shows the global methods just fine, but I assume it does not use System.Reflection itself and goes right to the metadata and bytecode. Besides System.Reflection, is anyone aware of any other 3rd party reflection or disassembly libs that I could make use of (assuming I will eventually release my compiler as free, BSD licensed open source).

    Read the article

  • Using unmanaged code, how can I find a type that has a given custom attribute assigned to it?

    - by Andrew
    I had thought I could enumerate the types using IMetaDataImport.EnumTypeDefs and for each of the tokens returned, call IMetaDataImport.EnumCustomAttributes. This works, in so much as I get an array of mdCustomAttribute tokens. Using these tokens I can get a metadata token representing the Type of the returned custom attribute, by calling IMetaDataImport.GetCustomAttributeProps. Comparing my results against ILDASM, I can see that this matches the "CustomAttribute Type" that ILDASM reports. However, I cannot work out how to determine the "CustomAttributeName" that ILDASM reports. This is what I really want! While I would be interested in knowing how to get the CustomAttributeName, I would settle for an alternate approach to solving the problem.

    Read the article

  • Embed resource in .NET Assembly without assembly prefix?

    - by Robert Fraser
    Hi all, When you embed a reosurce into a .NET assembly using Visual Studio, it is prefixed with the assembly name. However, assemblies can have embedded resources that are not assembly-name-prefixed. The only way I can see to do this is to disassemble the assembly using ildasm, then re-assemble it, adding the new resource -- which works, but... do I really need to finish that sentence? (Desktop .NET Framework 3.5, VS 2008 SP1, C#, Win7 Enterprise x64) Thanks, All the best, Robert

    Read the article

  • Strong Signing, and Updating A Referencing Assembly

    - by Alan
    Hi, I have two, third party assemblies: Foo.dll and ReferencesFoo.dll As noted, ReferencesFoo.dll is an assembly that has a reference to Foo.dll For my application, I need to resign these assemblies. I use ildasm/ilasm in combination along with a signing key to resign them, however, ReferencesFoo.dll still contains (in it's manifest?) the reference to the Foo.dll old public key and public key token. So, how do I sign both dll's with my key, and update the references in ReferencesFoo.dll without getting the source code and recompiling?

    Read the article

  • Framework version used by .NET Framework 3.5

    - by bmutch
    I am trying to determine the version of the .NET framework that a dll is using. I have targeted 3.5 in my app but when I open the dll with ildasm.exe (on my dev PC with 3.5 installed), it says it is using "Metadata version: v2.0.50727" which is it really using?

    Read the article

  • Resolving MSB3247 - Found conflicts between different versions of the same dependent assembly

    - by David Gardiner
    A .NET 3.5 solution ended up with this warning when compiling with msbuild. Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly. I did try using MSBUILD from VS 2010 Beta 2 (as the Connect article indicated this was fixed in the next version of the CLR) but that didn't provide any more detail either (maybe fixed post Beta 2) Is there a better (more automated) approach?

    Read the article

  • ASP.NET 32-bit machine compiled now trying to run on 64-bit machine

    - by user54064
    I have an ASP.NET app that was compiled on a 32-bit machine. There are many different assemblies that are referenced. I opened the web site's main dll with ILDASM and looked at the .corflags. It stated it was ILONLY. However, when I run the web site locally on the 64-bit machine (Windows XP Pro 64-bit), I get "is not a valid Win32 applciation". Shouldn't the app run as 64-bit since it was compiled with "AnyCPU"? How can I get this to work? I am using .NET 3.5.

    Read the article

  • why licenced code is packed and then is reviewable using Disassembler at the same time ?

    - by Asad Butt
    Is it legal / ethical to copy code for any reason, or utilize it (like code review) from the .Net framework or any other .Net based API using Reflector or similar tools ? If it is, what advantages do Microsoft and other licence based softwares have for packing there code ? If it is not, Why can we use ILDasm and Reflector ? Another way of saying this is Why to pack it up if it is fine to review it ? probably I am missing some bits in the question, any one who feels, could ask this question in a better way, is most welcome to edit. Thanks

    Read the article

  • Refferenced by projects .net 4.0 assemblies have no IL. How? and What for?

    - by er-v
    There is something I don't understand. Today I desided to find out what is inside Sistem.Web.dll version 4.0.0.0 So I decided to find the place where this assembly located. and opened this assembly with reflector - all methods were empty - and then with ilDasm from 7.0 SDK. This what I saw After some research I've found fullfeatured assemblies in gac. Actualy here C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Web\82087f17d3b3f9c493e7261d608a6af4 They are much larger in size. So why does references goes not to the gac, but to the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\ Why don't they have IL inside? How does it works? Mabe I don't understand something.

    Read the article

  • How to write in an file in MSIL code

    - by Thomas
    Hi all, I have a aspx webpage which uses an assembly mine (which mades a custom authentification). I would like to modify MSIL code (so just with ILDASM/ILASM tools) of my assembly in order to log something in a file. I have tried to add this at the end of the authentification method of my assembly : IL_0034: ldstr "C:\\path_to_my_website\\log.txt" IL_0039: newobj instance void [mscorlib]System.IO.StreamWriter::.ctor(string) IL_003e: stloc.1 IL_003f: ldloc.1 IL_0040: ldstr "test" IL_0045: callvirt instance void [mscorlib]System.IO.TextWriter::Write(string) IL_004a: nop IL_004b: ldloc.1 IL_004c: callvirt instance void [mscorlib]System.IO.TextWriter::Close() IL_0051: nop ILASM does not find any error, and the CLR does not throw any exception at runtime, but the file is not created or modified ! :( Any idea ?

    Read the article

  • Returning S_FALSE from a C# COM dll

    - by AntonyW
    I have a method defined in IDL as follows : interface IMyFunc : IDispatch { [id(1), helpstring("method GetNextFunction")] HRESULT GetNextFunction([in,out] long* lPos, [out, retval] BSTR* bstrName); } Using C++ I always implemented this as follows : STDMETHODIMP CMyFunc::GetNextFunction(long *nID, long *lPos, BSTR *bstrName) { if ( function to return ) { // setup return values; return S_OK; } else { // just exit return S_FALSE; } } Now I am implementing this in C# and have used tlbimp on the type library and ended up with : public string GetNextFunction(ref int nID, ref int lPos) I understand that this is because [out, retval] is used as the return type instead of the HRESULT as in C++. Is there a simple way to return the S_OK / S_FALSE values without changing the method definition? The only way I can see is that I have to use ildasm / ilasm to add preservesig so I end up with something like this : public int GetNextFunction(ref int nID, ref int lPos, ref string bstrName) I was wondering if there was some other way without doing the il compilation step.

    Read the article

  • Connecting Delphi to P/Invoke and .net

    - by lexdean
    The Delphi complier often uses a *.Dll when a special delivery of code info is required to the complier/editor:- example bourland.dll is the memory manager for the Delphi complier, as I remember. And their are many other *.dll's that Embarcoo keep secret that do other things. Is their anything you know that is public information on this subject .net's un managed code could be declared in a *.pas file as a decelerations but the only way to communicate it out is calling *.dll's like P/Invoke I have ilasm.exe and ildasm.exe and a decomplier into Delphi asm code now but still getting around to learn how to use them all yet. I do not have any reference material/editorials on P/invoke at all as I cannot find anything With that I will have a good concrete plan to make a good result I do not know what *.DLL's are in P/Invoke. Do you have any documentation. I do not have any reference material/editorials on ADO.net. The Dlls that are called and any referqance matrial I could use. Best regards, J Lex Dean.

    Read the article

  • With a little effort you can “SEMI”-protect your C# assemblies with obfuscation.

    - by mbcrump
    This method will not protect your assemblies from a experienced hacker. Everyday we see new keygens, cracks, serials being released that contain ways around copy protection from small companies. This is a simple process that will make a lot of hackers quit because so many others use nothing. If you were a thief would you pick the house that has security signs and an alarm or one that has nothing? To so begin: Obfuscation is the concealment of meaning in communication, making it confusing and harder to interpret. Lets begin by looking at the cartoon below:     You are probably familiar with the term and probably ignored this like most programmers ignore user security. Today, I’m going to show you reflection and a way to obfuscate it. Please understand that I am aware of ways around this, but I believe some security is better than no security.  In this sample program below, the code appears exactly as it does in Visual Studio. When the program runs, you get either a true or false in a console window. Sample Program. using System; using System.Diagnostics; using System.Linq;   namespace ObfuscateMe {     class Program     {                static void Main(string[] args)         {               Console.WriteLine(IsProcessOpen("notepad")); //Returns a True or False depending if you have notepad running.             Console.ReadLine();         }             public static bool IsProcessOpen(string name)         {             return Process.GetProcesses().Any(clsProcess => clsProcess.ProcessName.Contains(name));         }     } }   Pretend, that this is a commercial application. The hacker will only have the executable and maybe a few config files, etc. After reviewing the executable, he can determine if it was produced in .NET by examing the file in ILDASM or Redgate’s Reflector. We are going to examine the file using RedGate’s Reflector. Upon launch, we simply drag/drop the exe over to the application. We have the following for the Main method:   and for the IsProcessOpen method:     Without any other knowledge as to how this works, the hacker could export the exe and get vs project build or copy this code in and our application would run. Using Reflector output. using System; using System.Diagnostics; using System.Linq;   namespace ObfuscateMe {     class Program     {                static void Main(string[] args)         {               Console.WriteLine(IsProcessOpen("notepad"));             Console.ReadLine();         }             public static bool IsProcessOpen(string name)         {             return Process.GetProcesses().Any<Process>(delegate(Process clsProcess)             {                 return clsProcess.ProcessName.Contains(name);             });         }       } } The code is not identical, but returns the same value. At this point, with a little bit of effort you could prevent the hacker from reverse engineering your code so quickly by using Eazfuscator.NET. Eazfuscator.NET is just one of many programs built for this. Visual Studio ships with a community version of Dotfoscutor. So download and load Eazfuscator.NET and drag/drop your exectuable/project into the window. It will work for a few minutes depending if you have a quad-core or not. After it finishes, open the executable in RedGate Reflector and you will get the following: Main After Obfuscation IsProcessOpen Method after obfuscation: As you can see with the jumbled characters, it is not as easy as the first example. I am aware of methods around this, but it takes more effort and unless the hacker is up for the challenge, they will just pick another program. This is also helpful if you are a consultant and make clients pay a yearly license fee. This would prevent the average software developer from jumping into your security routine after you have left. I hope this article helped someone. If you have any feedback, please leave it in the comments below.

    Read the article

  • Help understanding .NET delegates, events, and eventhandlers

    - by Seth Spearman
    Hello, In the last couple of days I asked a couple of questions about delegates HERE and HERE. I confess...I don't really understand delegates. And I REALLY REALLY REALLY want to understand and master them. (I can define them--type safe function pointers--but since I have little experience with C type languages it is not really helpful.) Can anyone recommend some online resource(s) that will explain delegates in a way that presumes nothing? This is one of those moments where I suspect that VB actually handicaps me because it does some wiring for me behind the scenes. The ideal resource would just explain what delegates are, without reference to anything else like (events and eventhandlers), would show me how all everything is wired up, explain (as I just learned) that delegates are types and what makes them unique as a type (perhaps using a little ildasm magic)). That foundation would then expand to explain how delegates are related to events and eventhandlers which would need a pretty good explanation in there own right. Finally this resource could tie it all together using real examples and explain what wiring DOES happen automatically by the compiler, how to use them, etc. And, oh yeah, when you should and should not use delegates, in other words, downsides and alternatives to using delegates. What say ye? Can any of you point me to resource(s) that can help me begin my journey to mastery? EDIT One last thing. The ideal resource will explain how you can and cannot use delegates in an interface declaration. That is something that really tripped me up. Thanks for your help. Seth

    Read the article

  • Code Metrics: Number of IL Instructions

    - by DigiMortal
    In my previous posting about code metrics I introduced how to measure LoC (Lines of Code) in .NET applications. Now let’s take a step further and let’s take a look how to measure compiled code. This way we can somehow have a picture about what compiler produces. In this posting I will introduce you code metric called number of IL instructions. NB! Number of IL instructions is not something you can use to measure productivity of your team. If you want to get better idea about the context of this metric and LoC then please read my first posting about LoC. What are IL instructions? When code written in some .NET Framework language is compiled then compiler produces assemblies that contain byte code. These assemblies are executed later by Common Language Runtime (CLR) that is code execution engine of .NET Framework. The byte code is called Intermediate Language (IL) – this is more common language than C# and VB.NET by example. You can use ILDasm tool to convert assemblies to IL assembler so you can read them. As IL instructions are building blocks of all .NET Framework binary code these instructions are smaller and highly general – we don’t want very rich low level language because it executes slower than more general language. For every method or property call in some .NET Framework language corresponds set of IL instructions. There is no 1:1 relationship between line in high level language and line in IL assembler. There are more IL instructions than lines in C# code by example. How much instructions there are? I have no common answer because it really depends on your code. Here you can see some metrics from my current community project that is developed on SharePoint Server 2007. As average I have about 7 IL instructions per line of code. This is not metric you should use, it is just illustrative example so you can see the differences between numbers of lines and IL instructions. Why should I measure the number of IL instructions? Just take a look at chart above. Compiler does something that you cannot see – it compiles your code to IL. This is not intuitive process because you usually cannot say what is exactly the end result. You know it at greater plain but you don’t know it exactly. Therefore we can expect some surprises and that’s why we should measure the number of IL instructions. By example, you may find better solution for some method in your source code. It looks nice, it works nice and everything seems to be okay. But on server under load your fix may be way slower than previous code. Although you minimized the number of lines of code it ended up with increasing the number of IL instructions. How to measure the number of IL instructions? My choice is NDepend because Visual Studio is not able to measure this metric. Steps to make are easy. Open your NDepend project or create new and add all your application assemblies to project (you can also add Visual Studio solution to project). Run project analysis and wait until it is done. You can see over-all stats form global summary window. This is the same window I used to read the LoC and the number of IL instructions metrics for my chart. Meanwhile I made some changes to my code (enabled advanced caching for events and event registrations module) and then I ran code analysis again to get results for this section of this posting. NDepend is also able to tell you exactly what parts of code have problematically much IL instructions. The code quality section of CQL Query Explorer shows you how much problems there are with members in analyzed code. If you click on the line Methods too big (NbILInstructions) you can see all the problematic members of classes in CQL Explorer shown in image on right. In my case if have 10 methods that are too big and two of them have horrible number of IL instructions – just take a look at first two methods in this TOP10. Also note the query box. NDepend has easy and SQL-like query language to query code analysis results. You can modify these queries if you like and also you can define your own ones if default set is not enough for you. What is good result? As you can see from query window then the number of IL instructions per member should have maximally 200 IL instructions. Of course, like always, the less instructions you have, the better performing code you have. I don’t mean here little differences but big ones. By example, take a look at my first method in warnings list. The number of IL instructions it has is huge. And believe me – this method looks awful. Conclusion The number of IL instructions is useful metric when optimizing your code. For analyzing code at general level to find out too long methods you can use the number of LoC metric because it is more intuitive for you and you can therefore handle the situation more easily. Also you can use NDepend as code metrics tool because it has a lot of metrics to offer.

    Read the article

1 2  | Next Page >