See the question and my original answer on StackOverflow

GetObjectContext is a Windows function. You can declare it using P/Invoke like this:

<DllImport("ComSvcs.dll", CallingConvention:=CallingConvention.Cdecl)> _
Public Shared Function GetObjectContext(<Out> ByRef pCtx As IObjectContext) As Integer
End Function

<ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("51372AE0-CAE7-11CF-BE81-00AA00A2FA25")> _
Public Interface IObjectContext
    Function CreateInstance(ByVal rclsid As Guid, ByVal riid As Guid) As Object
    Sub SetComplete()
    Sub SetAbort()
    Sub EnableCommit()
    Sub DisableCommit()
    <PreserveSig> _
    Function IsInTransaction() As Boolean
    <PreserveSig> _
    Function IsSecurityEnabled() As Boolean
    Function IsCallerInRole(<MarshalAs(UnmanagedType.BStr)> ByVal role As String) As Boolean
End Interface