none
Decompile a Dll which is not from .net module? RRS feed

  • Question

  • Hi All,

    I am developing(de bugging) a one of my old colleagues program,he  resigned now i have to look after his program,

    he developed an windows forms application which is using a dll which i cannot decompile  nor i can add that to another windows forms application.. i need to do some coed modification..

    how do i proceed further.

    the dll he used is not from .net module..

    i have tried using .net reflector which is of no help.

    Any suggestion would be of great help.

    Thanks


    Arjun

    Wednesday, May 8, 2013 7:16 AM

Answers

  • I see. You have

    • Basic.dll which is indeed a native dll
    • DL920CSharp.dll which is a very simpler wrapper around basic.dll. It only contains a bunch of PInvoke methods and no actual code.

    If you want to use basic.dll in your .NET application then

    • add a reference to DL920CSharp.dll
    • manually copy basic.dll to the output folders of your project (bin\Debug, bin\Release).

    Note that the native dll is 32 bit and so your application must also be 32 bit. Make sure that in project properties, build the platform target is set to x86.

    Friday, May 10, 2013 9:46 AM
    Moderator

All replies

  • First get the source code of that DLL. Then you can either add project reference of the DLL to main project and start debugging OR run the main application and attach the process to your DLLs code.

    See this page for adding project reference in Visual Studio
    http://msdn.microsoft.com/en-us/library/f3st0d45(v=vs.100).aspx

    See this page for attaching the debugger to a running process
    http://msdn.microsoft.com/en-us/library/vstudio/3s68z0b3.aspx

    I hope this helps.


    Please mark this post as answer if it solved your problem. Happy Programming!

    Wednesday, May 8, 2013 9:29 AM
  • Hi adavesh,

    Thanks for your reply

    I have his windows forms programming source code,not the dll source code,

    Thanks


    Arjun

    Wednesday, May 8, 2013 9:42 AM
  • If you can't decompile in a tool like Reflector then it's possible that the dll isn't a .NET assembly but a native dll. Native dll can't be compiled (well, there are some tools that can do it but the results are kind of useless)..
    Wednesday, May 8, 2013 9:50 AM
    Moderator
  • So Mike,what the solution to my problem? cant i decompile at all????

    Thanks


    Arjun

    Wednesday, May 8, 2013 10:02 AM
  • "what the solution to my problem?"

    If it's really a native dll then you need to find the source, you don't really have an option.

    Wednesday, May 8, 2013 10:11 AM
    Moderator
  • Mike,

    How do i add the that dll file to other windows forms application?if i try to add it is giving an error saying unable to add dll.but my ex- colleague used that dll in his windows forms application. ,if he can do that why cant i? am i missing any step in adding this dll.

    am referring to dll which is not built in .net platform.

    Thanks


    Arjun

    Thursday, May 9, 2013 9:28 AM
  • You can only add a reference to a native dll if it contains COM components and a type library. Otherwise you have to call whatever functions the library exports by using PInvoke (DllImport). Check the source of the Windows Forms application. Or you don't have its source either?

    Thursday, May 9, 2013 10:18 AM
    Moderator
  • Mike,

    I have the source code of winforms,what my ex collegue did is he used the dll which is not native of .net in one class library and then he used that class library as dll in winforms. now if i add his class library as dll in new winforms it is asking for basic.dll(non native dll) . is there a way i can send dll to you so that even you can have look into the dll..

    my id:shrivatsa.arjun@hotmail.com

    Thanks


    Arjun

    Thursday, May 9, 2013 12:20 PM
  • "I have the source code of winforms,what my ex collegue did is he used the dll which is not native of .net in one class library and then he used that class library as dll in winforms. now if i add his class library as dll in new winforms it is asking for basic.dll(non native dll)"

    I'm not sure what you're saying, in two places you say "non native" but I suspect in one place it should be only "native". And who is asking for basic.dll? Visual Studio or the application at runtime?

    " is there a way i can send dll to you so that even you can have look into the dll.."

    Perhaps upload it somewhere, SkyDriver or whatever you prefer.

    Thursday, May 9, 2013 1:00 PM
    Moderator
  • Sorry, that link doesn't work.
    Friday, May 10, 2013 5:19 AM
    Moderator
  • Mike

    Please go through the below link

    https://skydrive.live.com/?cid=78d0b058e8fc5557#cid=78D0B058E8FC5557&id=78D0B058E8FC5557%21109


    Arjun

    Hi Arjun,

    Would you like to correct the link?

    Thanks.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, May 10, 2013 9:09 AM
    Moderator
  • https://skydrive.live.com/redir?resid=78D0B058E8FC5557!110



    Arjun


    Friday, May 10, 2013 9:14 AM
  • The file content doesn't seem to match what you have stated previously.

    • There's no Windows Forms application, there's a web application and silverlight application.
    • All the dlls that I could find in the archive are .NET dlls, they all load fine in Reflector
    Friday, May 10, 2013 9:22 AM
    Moderator
  • Sorry about the wrong file.

    https://skydrive.live.com/redir?resid=78D0B058E8FC5557!112

    Please go through above link

    Thanks


    Arjun


    Friday, May 10, 2013 9:34 AM
  • I see. You have

    • Basic.dll which is indeed a native dll
    • DL920CSharp.dll which is a very simpler wrapper around basic.dll. It only contains a bunch of PInvoke methods and no actual code.

    If you want to use basic.dll in your .NET application then

    • add a reference to DL920CSharp.dll
    • manually copy basic.dll to the output folders of your project (bin\Debug, bin\Release).

    Note that the native dll is 32 bit and so your application must also be 32 bit. Make sure that in project properties, build the platform target is set to x86.

    Friday, May 10, 2013 9:46 AM
    Moderator