How can I call COM+ object from another process on C#?

82 views Asked by At

Durning the start of explorer.exe, it loads twinui.dll, which has a COM+ class Immersive Settings Cache(A919EA73-490E-4D5C-9BA7-97CBC73119FE). It implements:

  • IImmersiveSettingsCache
  • IImmersiveShellComponent
  • IMarshal
  • IObjectWithSite
  • IServiceProvider
  • IUnknown
  • Factory interfaces:
    • IClassFactory
    • IUnknown
[Guid("7665c60a-c9a7-4306-ae31-bf520214fa71")]
interface IImmersiveSettings : IUnknown {
    HRESULT Proc3();
    HRESULT Proc4(/* Stack Offset: 8 */ [Out] /* C:(FC_TOP_LEVEL_CONFORMANCE)(16)(FC_DEREFERENCE)(FC_ULONG)(0) */ struct Struct_685[]* p0, /* Stack Offset: 16 */ [Out] int* p1, /* Stack Offset: 24 */ [Out] int* p2);
    HRESULT Proc5(/* Stack Offset: 8 */ [In] int p0);
}

[Guid("4214f6fa-eb36-4e2f-9ca2-23fdc1832df7")]
interface IImmersiveSettingsCache : IUnknown {
    HRESULT Proc3(/* Stack Offset: 8 */ [In] /* ENUM32 */ int p0);
    HRESULT Proc4(/* Stack Offset: 8 */ [In] /* ENUM32 */ int p0, /* Stack Offset: 16 */ [Out] int* p1);
    HRESULT Proc5(/* Stack Offset: 8 */ [In] /* ENUM32 */ int p0, /* Stack Offset: 16 */ [Out] int* p1);
    HRESULT Proc6(/* Stack Offset: 8 */ [In] IImmersiveSettingsCacheNotification* p0, /* Stack Offset: 16 */ [Out] int* p1);
    HRESULT Proc7(/* Stack Offset: 8 */ [In] int p0);
}

[Guid("0b40e4e6-2749-461f-9a84-29491c297f86")]
interface IImmersiveSettingsCacheNotification : IUnknown {
    HRESULT Proc3(/* Stack Offset: 8 */ [In] /* ENUM32 */ int p0);
}

I found, that SystemSettings.exe uses this API, to notify explorer about changes of some settings, for example System-Multitasking-Virtual desktops. The highlighted line executes COM+ method: Executing COM+

This is CoCreateInstance call(line number 9 on top pic):

CoCreateInstance call

After the highlighted of SystemSettings.exe, in Process Monitor I see RegQueryValue event by explorer.exe with call stack:

call stack of explorer.exe

Question:

I want to send the same event from my C# application to explorer.exe. How I can connect my app to COM+ API of explorer.exe ?

0

There are 0 answers