Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:25:43+00:00 2026-06-07T14:25:43+00:00

I would like to know if it is at all possible, and if so

  • 0

I would like to know if it is at all possible, and if so – how, to save a dynamically loaded .net assembly (it was loaded from a byte array, not a file) to a file on disk (exe/dll depending on assembly) and be able to use it directly (i.e. if it is exe, it will contain all exe headers and be runnable or at least “reflectable”).

Also do the loaded assemblies actually get stored in memory exactly as they appear in files, i.e. all the PE EXE headers, resources, etc, i.e. essentially exe/dll file in memory, or do they get stored in memory differently and so it will not be possible to save some region of memory as dll/exe .net assembly? That is, if I can use analogy from images: you may load jpeg file into memory as a bitmap, where the actual bytes representing the image in memory will be quite different from the actual bytes representing the jpeg file. So is it the same with loading assemblies?

And finally how do I get the memory addresses (pointers) to where the assembly is actually located in process’s memory?

Just to clarify: I do not have any access to the initial byte array from which assembly was loaded via Assembly.Load().

Here’s a related question, but it’s not clear from the answer if there may be a way to dump assembly loaded via byte array from memory to a file on disk.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:25:44+00:00Added an answer on June 7, 2026 at 2:25 pm

    First of all in .NET, an assembly can consist of multiple modules that physical located in different locations. So it is only possible to save a module in the assembly. Most of time you will only need the main module so you can use Assembly.ManifestModule to get it.

    Marshal.GetHINSTANCE will return the HINSTANCE of the module, which is the base address of the module according to this article. Although the remarks in MSDN states in-memory modules do not have an HINSTANCE, it seems the method does returns the base address for in-memory modules.

    So now we have the base address of the module. The next thing to do is to determining the size of the module. The simplest way to do this is to parse the Section Headers of the PE file. For example:

    Name   | Raw Size | Raw Address
    .text  | 0x2000   | 0x400
    .rsrc  | 0x400    | 0x2400
    .reloc | 0x200    | 0x2800
    

    In this case, the size of the module is the maximum Raw Address plus the corresponding Raw Size, that is 0x2A00.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how to copy all content of a file (server.log)
I would like to know all possible attributes of an element in JS. I
I would like to know how to find in a table field all possible
I converted my whole site to XML/XSL and I would like to know all
I would like to know how do I populate a TableView with data... All
first of all i would like to say i know its probably an easy
I would like to know what code to use to convert a double[] array
all! I am learning NHibernate now and I would like to know is it
I would like to know if it is possible to apply a function to
As you all know creating a web service with generic methods is not possible.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.