|freelibrary in dllmain||1.86||0.2||5698||59|
After the entry-point function returns, the library module is removed from the address space of the current process. It is not safe to call FreeLibrary from DllMain. For more information, see the Remarks section in DllMain. Calling FreeLibrary does not affect other processes that are using the same module.What does dllmain stand for in Microsoft Docs?
DllMain is a placeholder for the library-defined function name. You must specify the actual name you use when you build your DLL. For more information, see the documentation included with your development tools. During initial process startup or after a call to LoadLibrary, the system scans the list of loaded DLLs for the process.Is the DLL entry point the same as the hmodule?
The HINSTANCE of a DLL is the same as the HMODULE of the DLL, so hinstDLL can be used in calls to functions that require a module handle. The reason code that indicates why the DLL entry-point function is being called.Why does dllmain call the entry point function?
The thread was the initial thread in the process, so the system called the entry-point function with the DLL_PROCESS_ATTACH value. The thread was already running when a call to the LoadLibrary function was made, so the system never called the entry-point function for it.