1

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.

2

Re: To define the moment when COM wants to preempt inproc the server

Hello, Aniskin, you wrote: What means ignores DllCanUnloadNow? The call is? If yes that it is possible to build in it the code that did not ignore.

3

Re: To define the moment when COM wants to preempt inproc the server

Hello, turbocode, you wrote: T> That means ignores DllCanUnloadNow? The call is? If yes that it is possible to build in it the code that did not ignore. Whether generally call DllCanUnloadNow is only a question "can COM preempt dll?", instead of the statement that COM now preempts dll. I cannot in DllCanUnloadNow complete all operation as I do not know, whether dll will be really preempted. But it is not dependent on result DllCanUnloadNow at closing of application COM preempts dll.

4

Re: To define the moment when COM wants to preempt inproc the server

Whether A> Generally call DllCanUnloadNow is only a question "can COM preempt dll?", instead of the statement that COM now preempts dll. I cannot in DllCanUnloadNow complete all operation as I do not know, whether dll will be really preempted. But it is not dependent on result DllCanUnloadNow at closing of application COM preempts dll. At the moment of outswapping at you the counter of links should be a zero if you see that links are not present that extinguish the server more. If links are, and application calls CoUnitialize that application is guilty.

5

Re: To define the moment when COM wants to preempt inproc the server

Hello, Aniskin, you wrote: A> 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. As it seems to me, if application before end of operation does not release all links to a COM object and does not cause CoUninitialize () to make already, by and large, anything it is impossible. Well unless  on ExitProcess to deliver, but it already exotic...

6

Re: To define the moment when COM wants to preempt inproc the server

Hello, okman, you wrote: O> As it seems to me, if application before end of operation does not release all links to a COM object and does not cause CoUninitialize () to make already, by and large, anything it is impossible. A situation a bit different. Mine COM the server is an extension of jacket ContextMenu. Application - the arbitrary file manager. The user causes my command of the shortcut menu, application causes InvokeCommand then releases the link to the server. I.e. conscience of application is pure. Thus in InvokeCommand flags CMIC_MASK_ASYNCOK or CMIC_MASK_NOASYNC are not told that I treat as "to me all the same, want - work in a calling thread, you want - create the". As launched operation long enough I select operation from a new flow by means of SHCreateThread (CTF_PROCESS_REF | CTF_FREELIBANDEXIT). And as the total if the user closes application, and my flow thus did not finish operation there is a heap of errors, and I do not know as with them to struggle. Therefore, in an ideal, I would like dll to wait before outswapping of end of all flows but as it to make - mind I will not put.

7

Re: To define the moment when COM wants to preempt inproc the server

A> And as the total if the user closes application, and my flow thus did not finish operation there is a heap of errors, and I do not know as with them to struggle. The flow should be able to interrupt the operation at any moment if it it is impossible to do better that c it that can lead the life irrespective of application of the user.