CreateIpcQueue Questions

c++ / delphi package - dll injection and api hooking
Post Reply
choochy2003
Posts: 88
Joined: Fri Mar 21, 2008 4:52 am
Location: Adelaide, South Australia
Contact:

CreateIpcQueue Questions

Post by choochy2003 »

Is the documentation for the CreateIpcQueue API outdated? Specifically for maxThreadCount, from my testing it never generated more than the default 16 threads when using the default, but the documentation says that or only support 1 or unlimited.

Also, are the threads dynamically created as need? and are they destroyed again when they are no longer needed? In other words, is the thread pool dynamic.

Thanks!

Code: Select all

// Create an ipc queue.
// Please choose a unique ipc name to avoid conflicts with other programs.
// Only one ipc queue with the same name can be open at the same time.
// So if 2 programs try to create the same ipc queue, the second call will fail.
// You can specify how many threads may be created to handle incoming messages.
// If the order of the messages is crucial for you, set "maxThreadCount" to "1".
// In its current implementation "maxThreadCount" only supports "1" or unlimited.
// The parameter "maxQueueLen" is not yet implemented at all.
// The "context" is a simple pointer value that is forwarded to your callback.
function CreateIpcQueue (ipc            : pchar;
                         callback       : TIpcCallback;
                         context        : pointer = nil;
                         maxThreadCount : dword   = 16;
                         maxQueueLen    : dword   = $1000) : bool; stdcall;
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: CreateIpcQueue Questions

Post by madshi »

Good question. Looking at my source code, there are 2 alternative IPC approaches, one based on pipes and one on LPC APIs. The newer LPC solution is used for newer OSs, the older one for older OSs. Anyway, when using the older pipe IPC approach, there's only either "maxThreadCount = 1" to limit threads to 1, or any other value gives you an unlimited number of threads. With the newer LPC based approach, the "maxThreadCount" parameter actually works properly. However, it's internally limited to max 64 threads.

Guess I need to update the documentation accordingly.
choochy2003
Posts: 88
Joined: Fri Mar 21, 2008 4:52 am
Location: Adelaide, South Australia
Contact:

Re: CreateIpcQueue Questions

Post by choochy2003 »

Thanks for that!

Also, are the threads dynamically created as need? and are they destroyed again when they are no longer needed? In other words, is the thread pool dynamic.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: CreateIpcQueue Questions

Post by madshi »

Yes, it should be fully dynamic.
Post Reply