Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Identify managed or unmanaged dll.

Identify managed or unmanaged dll.

Scheduled Pinned Locked Moved C#
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shivonkar
    wrote on last edited by
    #1

    How can we know that given dll is managed or unmanaged. Thanks Shivonkar

    M L 2 Replies Last reply
    0
    • S shivonkar

      How can we know that given dll is managed or unmanaged. Thanks Shivonkar

      M Offline
      M Offline
      Matt Gerrans
      wrote on last edited by
      #2

      If LoadLibrary() fails, then it isn't unmanaged. That doesn't guarantee it is managed, though, it may just be junk -- so you could then try to follow up with System.Reflection.Assembly.LoadFile, or the like. Determining the whether it is .net 1.1 or 2.0, etc. might be interesting too. Also, if you get verion info from the file, a .NET dll will have "Assembly Verion" whereas an unmanaged dll will not (well, probably -- there's nothing to prevent some perverse developer from adding such it to an unmanaged dll, I guess). The other thing is to look up the binary format; I don't know if there is some magic number in the first few hundred bytes of a managed assembly to identify it as such... Matt Gerrans

      1 Reply Last reply
      0
      • S shivonkar

        How can we know that given dll is managed or unmanaged. Thanks Shivonkar

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        2 ways 1. Try load the assembly. -or- 2. Read the PE headers from the file. See EMCA CLR specs for fileformat. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups