public override void SetCOMIUnknown(IntPtr pUnk)
 {
     if (this._server == null)
     {
         this._pUnk   = pUnk;
         this._server = EnterpriseServicesHelper.WrapIUnknownWithComObject(pUnk);
     }
 }
        public static MarshalByRefObject CreateMonikerInstance()
        {
            IProxyCreator      proxyCreator = new MonikerBuilder();
            IProxyManager      proxyManager = new ProxyManager(proxyCreator);
            Guid               gUID         = typeof(IMoniker).GUID;
            IntPtr             punk         = OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref gUID);
            MarshalByRefObject obj2         = EnterpriseServicesHelper.WrapIUnknownWithComObject(punk) as MarshalByRefObject;

            Marshal.Release(punk);
            return(obj2);
        }
Exemple #3
0
 public override void SetCOMIUnknown(IntPtr pUnk)
 {
     if (_server == null)
     {
         DBG.Info(DBG.SC, "RSCP: SetCOMIUnknown: storing pUnk.");
         _pUnk   = pUnk;
         _server = EnterpriseServicesHelper.WrapIUnknownWithComObject(pUnk);
         // add this to our table of weak references
         //IdentityTable.AddObject(_pUnk, GetTransparentProxy());
     }
 }
Exemple #4
0
        public static MarshalByRefObject CreateMonikerInstance()
        {
            IProxyCreator      serviceChannelBuilder = new MonikerBuilder();
            IProxyManager      proxyManager          = new ProxyManager(serviceChannelBuilder);
            Guid               iid = typeof(IMoniker).GUID;
            IntPtr             ppv = OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref iid);
            MarshalByRefObject ret = EnterpriseServicesHelper.WrapIUnknownWithComObject(ppv) as MarshalByRefObject;

            Marshal.Release(ppv);

            return(ret);
        }
Exemple #5
0
        // Token: 0x060001AD RID: 429 RVA: 0x000126A8 File Offset: 0x000108A8
        public static object CreateDsInstance(ref Guid clsid, ref Guid riid)
        {
            IntPtr intPtr;
            int    num  = DsBugWO.CoCreateInstance(ref clsid, IntPtr.Zero, CLSCTX.Inproc, ref riid, ref intPtr);
            Guid   guid = new Guid("00000000-0000-0000-C000-000000000046");
            IntPtr intPtr2;

            num = Marshal.QueryInterface(intPtr, ref guid, out intPtr2);
            object objectValue = RuntimeHelpers.GetObjectValue(EnterpriseServicesHelper.WrapIUnknownWithComObject(intPtr));
            int    num2        = Marshal.Release(intPtr);

            return(objectValue);
        }
 internal RemoteServicedComponentProxy(Type serverType, IntPtr pUnk, bool fAttachServer) : base(serverType)
 {
     this._fUseIntfDispatch = ServicedComponentInfo.IsTypeEventSource(serverType) || ServicedComponentInfo.AreMethodsSecure(serverType);
     if (pUnk != IntPtr.Zero)
     {
         this._pUnk   = pUnk;
         this._server = EnterpriseServicesHelper.WrapIUnknownWithComObject(pUnk);
         if (fAttachServer)
         {
             base.AttachServer((MarshalByRefObject)this._server);
             this._fAttachedServer = true;
         }
     }
 }
        public object Smuggle()
        {
            object comObject;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
            }
            finally
            {
                comObject = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.handle);
                GC.KeepAlive(this);
            }
            return(comObject);
        }
 public void SetObject <T>(T obj)
 {
     if (Marshal.IsComObject(obj))
     {
         IntPtr iUnknownForObject = Marshal.GetIUnknownForObject(obj);
         if (IntPtr.Zero == iUnknownForObject)
         {
             throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("UnableToRetrievepUnk")));
         }
         try
         {
             IntPtr zero = IntPtr.Zero;
             Guid   gUID = typeof(IPersistStream).GUID;
             int    num  = Marshal.QueryInterface(iUnknownForObject, ref gUID, out zero);
             if (HR.S_OK == num)
             {
                 try
                 {
                     if (IntPtr.Zero == zero)
                     {
                         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("PersistWrapperIsNull")));
                     }
                     IPersistStream persistableObject = (IPersistStream)EnterpriseServicesHelper.WrapIUnknownWithComObject(zero);
                     try
                     {
                         this.dataStream = PersistHelper.PersistIPersistStreamToByteArray(persistableObject);
                         this.clsid      = typeof(T).GUID;
                     }
                     finally
                     {
                         Marshal.ReleaseComObject(persistableObject);
                     }
                     return;
                 }
                 finally
                 {
                     Marshal.Release(zero);
                 }
             }
             throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("CLSIDDoesNotSupportIPersistStream", new object[] { typeof(T).GUID.ToString("B") })));
         }
         finally
         {
             Marshal.Release(iUnknownForObject);
         }
     }
     throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("NotAComObject")));
 }
        public static object CreateDsInstance(ref Guid clsid, ref Guid riid)
        {
            IntPtr ptr;
            IntPtr ptr2;
            int    errorCode = CoCreateInstance(ref clsid, IntPtr.Zero, CLSCTX.Inproc, ref riid, out ptr);

            if ((errorCode != 0) || (ptr == IntPtr.Zero))
            {
                Marshal.ThrowExceptionForHR(errorCode);
            }
            Guid iid = new Guid("00000000-0000-0000-C000-000000000046");

            errorCode = Marshal.QueryInterface(ptr, ref iid, out ptr2);
            object obj2 = EnterpriseServicesHelper.WrapIUnknownWithComObject(ptr);

            Marshal.Release(ptr);
            return(obj2);
        }
Exemple #10
0
        internal RemoteServicedComponentProxy(Type serverType, IntPtr pUnk, bool fAttachServer)
            : base(serverType)
        {
            DBG.Info(DBG.SC, "RSCP: type = " + serverType);
            DBG.Assert(serverType != null, "server type is null");

            _fUseIntfDispatch = (ServicedComponentInfo.IsTypeEventSource(serverType) ||
                                 ServicedComponentInfo.AreMethodsSecure(serverType));
            DBG.Info(DBG.SC, "RSCP: using interface dispatch = " + _fUseIntfDispatch);
            if (pUnk != IntPtr.Zero)
            {
                _pUnk   = pUnk;
                _server = EnterpriseServicesHelper.WrapIUnknownWithComObject(pUnk);
                if (fAttachServer)
                {
                    AttachServer((MarshalByRefObject)_server);
                    _fAttachedServer = true;
                }
            }
        }
        internal object ComWrapper()
        {
            object obj2    = null;
            bool   success = false;

            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                base.DangerousAddRef(ref success);
                obj2 = EnterpriseServicesHelper.WrapIUnknownWithComObject(base.DangerousGetHandle());
            }
            finally
            {
                if (success)
                {
                    base.DangerousRelease();
                }
            }
            return(obj2);
        }
Exemple #12
0
 public static Object WrapIUnknownWithComObject(IntPtr i)
 {
     return(EnterpriseServicesHelper.WrapIUnknownWithComObject(i));
 }