Want to Join Us ?

you'll be able to discuss, share and send private messages.

VS 2008 express for Debugging .net applications w/o Source

Discussion in 'Tools of the Trade.' started by Rip Cord, Feb 26, 2013.

Share This Page

  1. Rip Cord

    Administrator Staff Member Admin Developer

    A simple way to debug some .net applications without having the original source code.
    Requires Visual C++
    It's available as part of VS2008 express (894.7 mb)
    http://download.microsoft.com/downl...6AA-CE894CBBB3DC/VS2008ExpressENUX1397868.iso
    Why 2008? It's free, no expiration, and no registration. :)

    This allows debugging at the level of il code.
    Put application in its own folder.
    C:\myfolder\interesting.exe
    Use visual Studio command prompt to dissemble the exe.
    1_vs_command_prompt.png
    paste this command at the prompt:
    ildasm C:\myfolder\interesting.exe /OUTPUT=C:\myfolder\interesting.il
    Now re-compile as debug:
    ilasm /debug C:\myfolder\interesting.il /OUTPUT=C:\myfolder\interesting_dbg.exe
    Close command prompt window.

    Open Visual C++ (original source language doesn't matter)
    Choose Open Project/Solution
    2_vs_open_solutions.png
    Choose your debug exe
    3_vs_solution_explorer24.PNG
    After it opens, select file-> open-> file->
    choose interesting.il
    4_vs_open_file.PNG
    Now you can set breakpoints and start debugging.

    After staring at lines of code a useful option is under Tools -> Options choose Debugging ->General

    5_vs_debugging_options.PNG

    click the box next to Highlight entire source line for breakpoints and current statement.
     
    storm shadow likes this.
  2. Rip Cord

    Administrator Staff Member Admin Developer

    There's a blank space before /OUTPUT
    Don't know why that one also show up as attachment at the bottom.
     
  3. storm shadow

    Techbliss Owner Admin Ida Pro Expert Developer

    nice post Rip

    wierd about the images, nothing looks wrong in your post, exept the attachment, and the second picture is the same.
    I always use http://imgur.com/ since they can upload multible images.
     
  4. storm shadow

    Techbliss Owner Admin Ida Pro Expert Developer

    got it it was uploaded twize, the image so forum spam shows it as an attachemnt apparently .
     
  5. Rip Cord

    Administrator Staff Member Admin Developer

    I did upload it twice, duh, thought it didn't "take" the first time.
     
  6. Rip Cord

    Administrator Staff Member Admin Developer

    Thanks for fixing it.
    Also here is Visual Studio 2010 Express All-in-One ISO - English (693.7 MB)
    requires free registration after 30 days
    http://www.microsoft.com/visualstudio/eng/downloads

    Version Info:
    2002 (.Net 1.0)
    2003 (.Net 1.1)
    2005 (.Net 2 and previous)
    2008 (.Net 3 and previous)
    2010 (.Net 4 and previous)
    2012 (.Net 4.5 and previous)

    Ilasm is part of the net framework. paths to ilasm:
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
    Ildasm is part of the sdk. path to ildasm:
    C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin
    Both can be used from the Visual C++ command prompt without typing the full path (environment variables are defined).

    Also, it's possible to use Visual Basic Express to debug the il code instead of Visual C++. Use Reflector or other program to decompile the exe to Visual Basic. It will produce a project and associated files. Load the project in Visual Basic.

    If you're lucky, it will load okay, and you can debug. Else there could be lots of errors and when trying to debug you get message that compile failed, would you like to use the last successful compile? Of course there isn't one, so follow the steps above for using ildasm and ilasm.

    In the vb project file folder there will be a bin folder with subfolder debug. Put the output from ilasm (example above: interesting_dbg.exe and interesting_dbg.pdb) in the debug subfolder. Now when it ask "use the last successful compile?", click yes (it will still only debug the il code).
     
    storm shadow likes this.
Top