Fatmumuhomer
04-27-2009, 09:14 PM
Hello, everyone. I come with another question that I hope you guys can offer some insight into! :)
We have an exe that is part of our app. It self-registers the first time is runs. It also registers itself in the RunningObjectTable.
Here is the code for that:
CComPtr<IRunningObjectTable> pRot;
CComPtr<IMoniker> pMk;
sKey = L"VSGMain";
hResult = GetRunningObjectTable(0, &pRot);
hResult = CreateItemMoniker(L"", sKey, &pMk);
hResult = pRot->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT, GetUnknown(), pMk, &m_dwROT);
//
// Main loop
//
// Currently does nothing (but waits for UI to close)
// (could perform periodic watchdog duties)
//
do
{
#ifdef SEND_DEBUG_OUTPUT
OutputDebugStringA_NL_TS("VSGMAIN: g_hEventUIClosed Check");
#endif
dwMainLoopRetVal = WaitForMultipleObjects(1, &g_hEventUIClosed, FALSE, 30000);
} while (dwMainLoopRetVal == WAIT_TIMEOUT);
//Unregister this object with the Running Object Table so other apps can not reference this instance
hResult = pRot->Revoke(m_dwROT);
Within a C# exe, we then create a hash table of all items in the ROT. We iterate over them until we find the one with the matching Moniker of "VSGMain" and use it.
Under Windows XP, this works fine. The ROT tends to have several items in it, we find the correct one, hold onto a reference to it, and use it to perform tasks within this 2nd exe.
Under Windows Vista, we only see a single item in the ROT. The item is:
clsid:6B7AD2F5-32BF-4B5C-ABEA-FB123102E9AE:!session:2
Obviously something is different between XP and Vista in regards to how objects are made available in the ROT. Any ideas or suggestions?
We've tried viewing the integrity levels using ICACLS.exe. Both of the exe's have a default level of medium. Setting both to high doesn't affect anything. Setting the 1st to low causes it to fail to start up.
Edit/Update:
Ok...with a bit more research, I know that at least one of the problems is that the Register (in the code snippet) is failing. It gives me back this:
-2147467243 - "The class is configured to run as a security id different from the caller"
Not sure what that means, so I am looking into that.
We have an exe that is part of our app. It self-registers the first time is runs. It also registers itself in the RunningObjectTable.
Here is the code for that:
CComPtr<IRunningObjectTable> pRot;
CComPtr<IMoniker> pMk;
sKey = L"VSGMain";
hResult = GetRunningObjectTable(0, &pRot);
hResult = CreateItemMoniker(L"", sKey, &pMk);
hResult = pRot->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT, GetUnknown(), pMk, &m_dwROT);
//
// Main loop
//
// Currently does nothing (but waits for UI to close)
// (could perform periodic watchdog duties)
//
do
{
#ifdef SEND_DEBUG_OUTPUT
OutputDebugStringA_NL_TS("VSGMAIN: g_hEventUIClosed Check");
#endif
dwMainLoopRetVal = WaitForMultipleObjects(1, &g_hEventUIClosed, FALSE, 30000);
} while (dwMainLoopRetVal == WAIT_TIMEOUT);
//Unregister this object with the Running Object Table so other apps can not reference this instance
hResult = pRot->Revoke(m_dwROT);
Within a C# exe, we then create a hash table of all items in the ROT. We iterate over them until we find the one with the matching Moniker of "VSGMain" and use it.
Under Windows XP, this works fine. The ROT tends to have several items in it, we find the correct one, hold onto a reference to it, and use it to perform tasks within this 2nd exe.
Under Windows Vista, we only see a single item in the ROT. The item is:
clsid:6B7AD2F5-32BF-4B5C-ABEA-FB123102E9AE:!session:2
Obviously something is different between XP and Vista in regards to how objects are made available in the ROT. Any ideas or suggestions?
We've tried viewing the integrity levels using ICACLS.exe. Both of the exe's have a default level of medium. Setting both to high doesn't affect anything. Setting the 1st to low causes it to fail to start up.
Edit/Update:
Ok...with a bit more research, I know that at least one of the problems is that the Register (in the code snippet) is failing. It gives me back this:
-2147467243 - "The class is configured to run as a security id different from the caller"
Not sure what that means, so I am looking into that.