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. Loading Dlls through C#

Loading Dlls through C#

Scheduled Pinned Locked Moved C#
csharptutorialquestion
3 Posts 2 Posters 2 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.
  • G Offline
    G Offline
    ganeshvijay
    wrote on last edited by
    #1

    Hi Does anyone know how to load and read the methods and properties of a dll through c# ?. Please assist me with sample codes!!!

    H 2 Replies Last reply
    0
    • G ganeshvijay

      Hi Does anyone know how to load and read the methods and properties of a dll through c# ?. Please assist me with sample codes!!!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You need to understand the structure of a PE/COFF executable, and only then can you get the exported functions, structs, and classes. This is done by enumerating virtual directories in the PE/COFF executable headers and using the Relative Virtual Addresses (RVAs) to get the functions from the Export Address Table (EAT). See the following two articles, both my Matt Pietrek for MSDN Magazine:

      1. Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format -- MSDN Magazine, February 2002 [^]
      2. Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format, Part 2 -- MSDN Magazine, March 2002[^]

      In order to implement the code correctly, you may need an unsafe context (it's possible without, but tedious) and you also need a good grasp on unmanaged interoperability. For more information on that, read Interoperating with Unmanaged Code[^] in the .NET Framework SDK. If there is already sample code, I'm not aware of it (hey, I'm not google :)). You could try searching for a sample using keywords from the articles above, or even searching for "C#", "RVA", etc.

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      • G ganeshvijay

        Hi Does anyone know how to load and read the methods and properties of a dll through c# ?. Please assist me with sample codes!!!

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        BTW, if you're talking about reading the metadata of an assembly DLL (as opposed to a native DLL), then you should use .NET Reflection. See the documentation for the classes in the System.Reflection namespace in the .NET Framework SDK. For an overview and samples, read Discovering Type Information at Run Time[^] in the .NET Framework SDK.

        Microsoft MVP, Visual C# My Articles

        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