Problem of session moniker with Remote Desktop

X

Xiao, Li

Our application has two executables:

The first is a service which runs under local system account;
The second is an EXE COM server which is configured to run as "Interactive
User" and will display UI.

When service needs to display UI, it will use session moniker to launch the
COM exe in current user's desktop:

Sample code:

CComPtr<IBindCtx> spBindCtx;
hr = CreateBindCtx(0, &spBindCtx);
if(SUCCEEDED(hr))
{
WCHAR wszCLSID[64];
StringFromGUID2(CLSID_MYOBJECT, wszCLSID, RAYSIZE(wszCLSID));

CString strCLSID = wszCLSID;
strCLSID.Replace(_T("{"), _T(""));
strCLSID.Replace(_T("}"), _T(""));

CString strMoniker;
strMoniker.Format(_T("Session:Console!clsid:%s"), strCLSID);

ULONG ulEaten = 0;
CComPtr<IMoniker> spMoniker;
hr = MkParseDisplayNameEx(spBindCtx, strMoniker, &ulEaten,
&spMoniker);
if(SUCCEEDED(hr))
{
CComPtr<IClassFactory> spCF;
hr = spMoniker->BindToObject(spBindCtx, NULL, IID_IClassFactory,
(void**)&spCF);
if (SUCCEEDED(hr))
hr = spMcCF->CreateObject(CLSID_MYOBJECT, ppObj);
}
}

The code works perfectly under Fast User Switch. The problem happened with
Remote Desktop. If the code gets executed when the remote session is logging
on, it hangs on the line of spMoniker->BindToObject. It never returns.

Does anybody have some idea?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top