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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:44:33+00:00 2026-06-09T07:44:33+00:00

I have a DLL that injects itself using the CreateRemoteThread/LoadLibrary method. It is cumbersome

  • 0

I have a DLL that injects itself using the CreateRemoteThread/LoadLibrary method.

It is cumbersome to quit the target application and restart it (it has a loading time of 10-20 seconds) when debugging and developing the DLL, so I want to unload the DLL when I have checked that what my code does works, to recompile / re-inject it.

I want to avoid creating a new DLL with a framework for loading and unloading said DLL.

How is this possible?

  • 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-09T07:44:34+00:00Added an answer on June 9, 2026 at 7:44 am

    In the case where DllMain spawns a thread, and when that thread is complete with whatever it is doing, you can use FreeLibraryAndExitThread:

    The FreeLibraryAndExitThread function allows threads that are executing within a DLL to safely free the DLL in which they are executing and terminate themselves. If they were to call FreeLibrary and ExitThread separately, a race condition would exist. The library could be unloaded before ExitThread is called.

    From that quote, I state in plain english that you should not call this function from within DllMain.

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

Sidebar

Related Questions

I have COM dll that I am using in C++/Cli, one of the method
I have a simple dll that is being injected into a target process using
I have DLL and application that will call some function in this dll. For
I have a C++ DLL that I wrote that has a single exposed function,
We have a dll that has been running fine on Vista and Win7 for
I have a dll that has a class called Series. This class has a
I have a dll mytest.dll that when loaded via LoadLibrary() , returns NULL (and
I have a DLL that gets loaded in my application, like so: procedure LoadTessDLL;
I have a Qt Dll wich I inject into a third-party Application using windows
I have dll method that should be QoSed - this method should be called

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.