Home > Software engineering >  Turn their program loadlibary DLL, unload collapse
Turn their program loadlibary DLL, unload collapse

Time:10-28

Loadlibary others to program their own DLL, freelibary collapse,
With a look of ano tools pchunter can safe unloading the DLL
Ask, is there any way I can safe unloading?

CodePudding user response:

Debugging and running, before FreeLibrary set breakpoints, see if there is not the end of the threads in a DLL?


CodePudding user response:

After the test, the calling loadlibrary DLL, release freelibrary directly, and whether it will collapse; If not, see if it calls its methods, and then release before they can call the release method;

CodePudding user response:

Use tools pchunter traversal threads, didn't see the thread of DLL,

CodePudding user response:

After calling loadlibrary DLL, release freelibrary directly, will collapse, also didn't call methods,
Its method can be used, just now I need to use after uninstall it, but the uninstall collapse

CodePudding user response:

Your program is a Debug or Release to

I also met others write DLL,
Low Delphi call freelibrary when they crash,
Debugging and running, low VC F5 freelibrary time will interrupt, Release, the situation better
Low the.net, freelibrary is no problem,

I think, should be in the process of the exception shielding some code, but this kind of problem, shielding is hidden trouble,

CodePudding user response:

In the same thread loadlibrary, freelibrary? If it is a new thread in the loadlibrary, try do the COM initialization before loadlibrary (CoInitilize),

CodePudding user response:

With the release of
Loadlibrary do before you COM initialization is why ah, it can be normal call

With a comparison of the underlying function NtUnmapViewOfSection is forcibly unload module, then freelibary uninstall,
But NtUnmapViewOfSection according to the specification can be directly to uninstall, don't know why you don't succeed, to call again freelibary can, although goal arrived, the feeling is not very perfect huh

CodePudding user response:

Collapse should debug the cause of the crash, speculation is not a good solution

CodePudding user response:

To implicit linking, 99% is a DLL didn't write well

CodePudding user response:

refer to 7th floor weixin_42143456 response:
is to use the release,
Loadlibrary do before you COM initialization is why ah, it can be normal call

With a comparison of the underlying function NtUnmapViewOfSection is forcibly unload module, then freelibary uninstall,
But NtUnmapViewOfSection according to the specification can be directly to uninstall, don't know why you don't succeed, will call again freelibary can, although goal arrived, the feeling is not very perfect,


Some DLL function need to COM environment, that is each thread need to initialize it again, this is a single model, if it is a multithreaded model, such as the main thread initialization time, other threads need not initialized, but model is different is not compatible, general COM controls should be single,



Suggest you consult the DLL's responsibility:
Why does it have to be uninstall will collapse, program bug, or made specially for the, each other can change?
.

CodePudding user response:

1, I once wrote a DLL, and then test yourself, also freelibrary error, change good later told the DLL code change (mainly couldn't remember what the )
2, also calls the other manufacturers to provide a DLL, appear freelibrary error, a; Later, contact vendor, is their DLL problem; The company directly to give up that manufacturers docking

Big probability (personal very believe), was no handle inside the DLL
  • Related