Solved

Problem with OLE local server

Posted on 1997-11-19
2
442 Views
Last Modified: 2013-11-20
I have the following problem. I have to exe and they both are client and server. When one of them creates another that immideatly resiters itself in ROT. When first exe wants to connect to second it retrieves its interface pointer from ROT using GetActiveObject. It works fine, but now in one exe I have another tread which also needs to connect to server. It is impossible to connect directly from
this thread so I use custom message which is sent to main thread and from main thread's message handler I try to retreive server pointer from ROT. It must work but I get RPC error RPC_E_CANTCALLOUT_ININPUTSYNCCALL( error occured in RPCRT4.DLL) and server moniker in ROT is removed.  
0
Comment
Question by:galkin
2 Comments
 
LVL 1

Accepted Solution

by:
dkremer earned 100 total points
ID: 1310292
Hi
I'm qouting a MS KB article, it'll answer you're question :)

PRB: Synch OLE Call Fails in Inter-Process/Thread SendMessage

Last reviewed: August 8, 1996
Article ID: Q131056 The information in this article applies to:

Microsoft OLE Libraries for Windows and Win32s, version 2.03 •Microsoft OLE libraries included with:

    - Microsoft Windows NT version 3.5
    - Microsoft Windows 95

SYMPTOMS

A synchronous OLE call made by the recipient of an inter-process/inter- thread SendMessage fails with RPC_E_CANTCALLOUT_ININPUTSYNCCALL.

CAUSE

The cause is discussed in detail in the "More Information" section of this article.

RESOLUTION

Use PostMessage instead of an inter-process/inter-thread SendMessage.

STATUS

This behavior is by design.

MORE INFORMATION

See the beginning of chapter 13 in the OLE 2 Programmer's Reference Volume 1 for the categories of OLE calls. An understanding of these categories is required for this article.

The majority of OLE calls are synchronous calls. A synchronous call to a different process yields to that process and waits for a reply from that process. In addition, OLE has input-synchronized calls that relate to the inplace-activation interfaces. Input-synchronized calls are implemented using an inter-process/inter-thread SendMessage.

16-bit Windows doesn't allow a task to yield while in an inter- process/inter-thread SendMessage because a system deadlock could occur. The deadlock occurs because a message for the sender could be present at the top of the shared system queue, and this prevents other tasks, including the recipient of the SendMessage, from retrieving their messages from the system queue until the sender does. The sender cannot retrieve its message because it is waiting for the inter-process/inter-thread SendMessage to return.

In 32-bit Windows, each process has its own system queue and this architecture normally prevents deadlock problem from occurring. However, when one process is inplace active in another process's window, the system queues of the two processes are synchronized as in 16-bit windows, so the deadlock could occur. To prevent this, OLE stops synchronous OLE calls from being made while the caller is the recipient of an input-synchronized call.

OLE determines if the caller of the synchronous call is a recipient of an input-synchronized call by using the InSendMessage() API. This broad check prevents a synchronous call from being made if the caller is currently a recipient of any inter-process/inter-thread SendMessage.

Hope it helps,
    - Dror

0
 
LVL 7

Author Comment

by:galkin
ID: 1310293
Thank you. I have already found this MS kb technical article.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now