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 8150929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:12:33+00:00 2026-06-06T15:12:33+00:00

I have to create a wrapper DLL that exports some symbols (functions). Within its

  • 0

I have to create a wrapper DLL that exports some symbols (functions). Within its resources it contains another encrypted DLL that actually does the job.

Upon the wrapper DLL initialization it decrypts the original one, saves it in a file, and loads into the address space by LoadLibrary. However I’d like to avoid saving this DLL in a file.

I know that this doesn’t guarantee a bullet-proof protection, actually one may dump the process virtual memory and see it there. I also know that it’s possible to create a file with FILE_FLAG_DELETE_ON_CLOSE attribute, which ensures this file will be deleted as soon as the process terminates. But still I’d like to know if there’s an option to load the DLL “not from a file”.

So far I thought about the following:

  1. Allocate a virtual memory block with adequate protection (PAGE_EXECUTE_READ or PAGE_EXECUTE_READWRITE). Preferrably at the image preferred base address.
  2. Extract/decrypt the DLL image there.
  3. If the image base address isn’t its preferred address – do the relocation “manually”. I.e. – analyze the relocation table and patch the image in-place.
  4. Handle the image imports. Load its dependency DLLs and fill symbol addresses.
  5. Invoke its initialization function (DllMain).

That is, I can do the work of the loader. But unfortunately there are some areas where the DLL loaded by the above trick will behave differently, since it’s not a properly-loaded DLL from the OS’s perspective. This includes the following:

  • The DllMain requires the DLL “module handle”, which is just its base address. It may use this handle in calls to various API functions, such as LoadResource. Those calls will probably fail.
  • There will be problems with exception handling. The OS won’t see the DLL’s SAFESEH section, hence its internal exception handling code won’t be invoked (it’s a 64-bit DLL, means SAFESEH is mandatory for exception handling).

Here’s my question: Is there an API to properly load the DLL into the process address space without the need for it to be in a file? An alternative variant of LoadLibrary that works, say, on a file mapping instead of a file-system file?

Thanks in advance.

  • 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-06T15:12:35+00:00Added an answer on June 6, 2026 at 3:12 pm

    Yes, it is possible to load a DLL which is located in the resources of another image and execute it without needing a file! Take a look at this article, this is exactly what you want. It works, I tried it.

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

Sidebar

Related Questions

I have a need to create a wrapper for a DLL, loading and unloading
I have create a vcf file that contains contacts by using this code ContentResolver
I have been provided with an unmanaged C++ DLL that contains several classes. I
I have a third-party DLL that depends on MSVCR80 and allocates resources that I
we have a C++ Win32 DLL that reads data from Excel. The application uses
so in dll we have x264_param_t structure\object and a function for its setting up
I have some old C# plugin code that was implemented strictly with Reflection. In
I have a closed source unmanaged DLL coded in C++ that I wanted to
I have a C# DLL that uses the XslCompiledTransform class for xml manipulations. I
I have a 3rd party DLL that needs to be loaded dynamically using LoadLibrary()

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.