Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Seeking advice using com or other things inside threading library


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Dec 8, 2014 6:01 PM Last Post By: Remy Lebeau (Te...
William Egge

Posts: 98
Registered: 11/29/06
Seeking advice using com or other things inside threading library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2014 1:31 PM
Does anyone have any advice on a way to initialize/uninitialize com when using the threading library?

There are no hooks that I am aware of for thread creation and destruction. It seems wasteful and potentially error prone to initialize and uninitialize com within the same routine.

I want to do other things as well, such as setup account impersonation per thread.

Any advice?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Seeking advice using com or other things inside threading library  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 8, 2014 6:01 PM   in response to: William Egge in response to: William Egge
William wrote:

Does anyone have any advice on a way to initialize/uninitialize com
when using the threading library?

I assume you are referring to the new System.Threading framework, correct?
It uses TThread-derived classes, and those classes happen to be declared
in the "interface" section of the System.Threading unit, so you could manually
patch the vtable of the unit's TBaseWorkerThread and/or TQueueWorkerThread
class(es) at runtime to inject your own Execute() methods into the appropriate
slots. There are third-party code/libraries floating around for hooking
Delphi class methods in this manner.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02