Topic: To define the moment when COM wants to preempt inproc the server
Is available inproc the server which launches an additional flow through SHCreateThread (CTF_PROCESS_REF | CTF_FREELIBANDEXIT). At closing of the application using this server, COM ignores result DllCanUnloadNow and at any result preempts the server. As the total - I cannot correctly complete operation. In DllMain to me it is necessary to preempt dynamic library, and to do it in DllMain extremely it is not recommended. And in an ideal situation to wait completions of operation of an additional flow, but in DllMain it especially is not possible, as automatically arises deadlock. The ideal decision would be, if COM before outswapping caused what function of type DllBeforeUnload, but I did not find a mention of such functions.