I observed two issues with respect to the new OLPresenceProvider sample solution.
The code is attempting to register type libraries per-machine (HKLM). Per-machine registration requires that the code is running with elevated privileges. I would expect the sample code to return a COM error (hr < 0) but it does not. I don't know why but I have made a change in the type library registration function that properly indicates failure when an un-elevated process attempts per-machine registration.
After implementing this change and running the COM Server with elevated privileges type library registration succeeded for interopExtension.tlb and lyncEndorser.tlb. However, registration failed for lync.tlb and this is the reason why the IUCOfficeIntegration interface is not in the registry.
It is my belief that something is wrong with the lync.tlb type library created from the IDL shown by OleView when browsing the real type library. See if you can extract the lync type library as a binary file from the Office executable.
Register a type library -
public static void Register(string tlbPath)
{
Trace.WriteLine($"Registering type library:");
Trace.Indent();
Trace.WriteLine(tlbPath);
Trace.Unindent();
ComTypes.ITypeLib typeLib;
int hr = OleAut32.LoadTypeLibEx(tlbPath, OleAut32.REGKIND.REGKIND_NONE, out typeLib);
if (hr < 0)
{
Trace.WriteLine($"Registering type library failed: 0x{hr:x}");
return;
}
hr = OleAut32.RegisterTypeLib(typeLib, tlbPath, string.Empty);
if(hr < 0)
{
Trace.WriteLine($"Registering type library failed: 0x{hr:x}");
}
}
Add to Ole32 class -
[DllImport(nameof(OleAut32), CharSet = CharSet.Unicode, ExactSpelling = true)]
public static extern int RegisterTypeLib(
[In] ComTypes.ITypeLib typeLib,
[In, MarshalAs(UnmanagedType.LPWStr)] string fileName,
[In, MarshalAs(UnmanagedType.LPWStr)] string helpDir);