Beispiel #1
0
        // Token: 0x060002FA RID: 762 RVA: 0x00012E4C File Offset: 0x0001104C
        public static bool RemoveGraphFromRot(ref int cookie)
        {
            UCOMIRunningObjectTable ucomirunningObjectTable = null;
            bool result;

            try
            {
                int runningObjectTable = DsROT.GetRunningObjectTable(0, ref ucomirunningObjectTable);
                ucomirunningObjectTable.Revoke(cookie);
                cookie = 0;
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
            }
            finally
            {
                if (ucomirunningObjectTable != null)
                {
                    Marshal.ReleaseComObject(ucomirunningObjectTable);
                }
                ucomirunningObjectTable = null;
            }
            return(result);
        }
Beispiel #2
0
        public static bool RemoveGraphFromRot(ref int cookie)
        {
            UCOMIRunningObjectTable rot = null;

            try {
                int hr = GetRunningObjectTable(0, out rot);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                rot.Revoke(cookie);
                cookie = 0;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                if (rot != null)
                {
                    Marshal.ReleaseComObject(rot);
                }
                rot = null;
            }
        }
Beispiel #3
0
        public static bool RemoveGraphFromRot(ref int cookie)
        {
            UCOMIRunningObjectTable pprot = null;
            bool flag;

            try
            {
                int runningObjectTable = GetRunningObjectTable(0, out pprot);
                if (runningObjectTable < 0)
                {
                    Marshal.ThrowExceptionForHR(runningObjectTable);
                }
                pprot.Revoke(cookie);
                cookie = 0;
                flag   = true;
            }
            catch (Exception)
            {
                flag = false;
            }
            finally
            {
                if (pprot != null)
                {
                    Marshal.ReleaseComObject(pprot);
                }
                pprot = null;
            }
            return(flag);
        }
Beispiel #4
0
        protected void CalcRunningObjName(UCOMIRunningObjectTable rot,
                                          UCOMIBindCtx bc,
                                          UCOMIMoniker moniker,
                                          String monikerName)
        {
            _moniker     = moniker;
            _monikerName = monikerName;
            // FIXME - Does not work because IsRunning is defined
            // incorrectly in the IRunningObjectTable mapping
            //IsRunning = rot.IsRunning(Moniker);

            // Get the object from the table
            _isRunningObjectTable = true;
            // Persist Guid is probably not used for anything, but
            // let's get it anyway
            Guid persistGuid = new Guid();

            _moniker.GetClassID(out persistGuid);
            _persistGuid = persistGuid;
            // GUID is the *real* CLSID for the object
            String rotProgId = null;

            if (_monikerName.StartsWith("!{"))
            {
                int guidStart = _monikerName.IndexOf('{');
                int guidEnd   = _monikerName.IndexOf('}');
                if (guidStart != -1 && guidEnd != -1)
                {
                    _CLSID =
                        _monikerName.Substring(guidStart, guidEnd);
                    _classIdKey = Windows.KeyCLSID.OpenSubKey(_CLSID);
                    if (_classIdKey != null)
                    {
                        String progId = (String)
                                        _classIdKey.OpenSubKey("ProgID").
                                        GetValue(null);
                        _classNameKey =
                            Windows.KeyClassRoot.OpenSubKey(progId);
                        rotProgId = progId
                                    + _monikerName.Substring(guidEnd + 1);
                    }
                }
                // Use the translated progId if available
                if (rotProgId != null)
                {
                    _monikerDisplayName = rotProgId;
                }
                else
                {
                    _monikerDisplayName = _monikerName;
                }
            }
            else
            {
                // The moniker is something else, just use that
                _monikerDisplayName = _monikerName;
            }
        }
Beispiel #5
0
        public static bool AddGraphToRot(object graph, out int cookie)
        {
            bool flag;

            cookie = 0;
            int errorCode = 0;
            UCOMIRunningObjectTable pprot = null;
            UCOMIMoniker            ppmk  = null;

            try
            {
                errorCode = GetRunningObjectTable(0, out pprot);
                if (errorCode < 0)
                {
                    Marshal.ThrowExceptionForHR(errorCode);
                }
                int    currentProcessId  = GetCurrentProcessId();
                IntPtr iUnknownForObject = Marshal.GetIUnknownForObject(graph);
                int    num3 = (int)iUnknownForObject;
                Marshal.Release(iUnknownForObject);
                string item = string.Format("FilterGraph {0} pid {1}", num3.ToString("x8"), currentProcessId.ToString("x8"));
                errorCode = CreateItemMoniker("!", item, out ppmk);
                if (errorCode < 0)
                {
                    Marshal.ThrowExceptionForHR(errorCode);
                }
                pprot.Register(1, graph, ppmk, out cookie);
                flag = true;
            }
            catch (Exception)
            {
                flag = false;
            }
            finally
            {
                if (ppmk != null)
                {
                    Marshal.ReleaseComObject(ppmk);
                }
                ppmk = null;
                if (pprot != null)
                {
                    Marshal.ReleaseComObject(pprot);
                }
                pprot = null;
            }
            return(flag);
        }
Beispiel #6
0
        public static bool AddGraphToRot(object graph, out int cookie)
        {
            cookie = 0;
            int hr = 0;
            UCOMIRunningObjectTable rot = null;
            UCOMIMoniker            mk  = null;

            try {
                hr = GetRunningObjectTable(0, out rot);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                int    id    = GetCurrentProcessId();
                IntPtr iuPtr = Marshal.GetIUnknownForObject(graph);
                int    iuInt = (int)iuPtr;
                Marshal.Release(iuPtr);
                string item = string.Format("FilterGraph {0} pid {1}", iuInt.ToString("x8"), id.ToString("x8"));
                hr = CreateItemMoniker("!", item, out mk);
                if (hr < 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }

                rot.Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, graph, mk, out cookie);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                if (mk != null)
                {
                    Marshal.ReleaseComObject(mk);
                }
                mk = null;
                if (rot != null)
                {
                    Marshal.ReleaseComObject(rot);
                }
                rot = null;
            }
        }
Beispiel #7
0
        // Token: 0x060002F9 RID: 761 RVA: 0x00012D6C File Offset: 0x00010F6C
        public static bool AddGraphToRot(object graph, ref int cookie)
        {
            cookie = 0;
            UCOMIRunningObjectTable ucomirunningObjectTable = null;
            UCOMIMoniker            ucomimoniker            = null;
            bool result;

            try
            {
                int    num = DsROT.GetRunningObjectTable(0, ref ucomirunningObjectTable);
                int    currentProcessId  = DsROT.GetCurrentProcessId();
                IntPtr iunknownForObject = Marshal.GetIUnknownForObject(RuntimeHelpers.GetObjectValue(graph));
                int    num2 = (int)iunknownForObject;
                Marshal.Release(iunknownForObject);
                string item = string.Format("FilterGraph {0} pid {1}", num2.ToString("x8"), currentProcessId.ToString("x8"));
                num = DsROT.CreateItemMoniker("!", item, ref ucomimoniker);
                ucomirunningObjectTable.Register(1, RuntimeHelpers.GetObjectValue(graph), ucomimoniker, out cookie);
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
            }
            finally
            {
                if (ucomimoniker != null)
                {
                    Marshal.ReleaseComObject(ucomimoniker);
                }
                ucomimoniker = null;
                if (ucomirunningObjectTable != null)
                {
                    Marshal.ReleaseComObject(ucomirunningObjectTable);
                }
                ucomirunningObjectTable = null;
            }
            return(result);
        }
Beispiel #8
0
 private static extern int GetRunningObjectTable(int r, ref UCOMIRunningObjectTable pprot);
Beispiel #9
0
        private static extern int GetRunningObjectTable( int r,
			out UCOMIRunningObjectTable pprot );
 public static extern int GetRunningObjectTable(int reserved,
                           out UCOMIRunningObjectTable prot);
 public static extern int GetRunningObjectTable(int reserved, out UCOMIRunningObjectTable prot); 
        public static extern uint GetRunningObjectTable(uint res, out
				UCOMIRunningObjectTable ROT);
Beispiel #13
0
 public static extern uint GetRunningObjectTable(uint res, out
                                                 UCOMIRunningObjectTable ROT);
Beispiel #14
0
		private static extern int GetRunningObjectTable(int res, out UCOMIRunningObjectTable ROT);
		protected void CalcRunningObjName(UCOMIRunningObjectTable rot,
										  UCOMIBindCtx bc, 
										  UCOMIMoniker moniker,
										  String monikerName)
		{
			_moniker = moniker;
			_monikerName = monikerName;
			// FIXME - Does not work because IsRunning is defined
			// incorrectly in the IRunningObjectTable mapping
			//IsRunning = rot.IsRunning(Moniker);
				
			// Get the object from the table
			_isRunningObjectTable = true;
			// Persist Guid is probably not used for anything, but
			// let's get it anyway
			Guid persistGuid = new Guid();
			_moniker.GetClassID(out persistGuid);
			_persistGuid = persistGuid;
			// GUID is the *real* CLSID for the object
			String rotProgId = null;
			if (_monikerName.StartsWith("!{"))
			{
				int guidStart = _monikerName.IndexOf('{');
				int guidEnd = _monikerName.IndexOf('}');
				if (guidStart != -1 && guidEnd != -1)
				{
					_CLSID = 
						_monikerName.Substring(guidStart, guidEnd);
					_classIdKey = Windows.KeyCLSID.OpenSubKey(_CLSID);
					if (_classIdKey != null)
					{
						String progId = (String)
							_classIdKey.OpenSubKey("ProgID").
							GetValue(null);
						_classNameKey = 
							Windows.KeyClassRoot.OpenSubKey(progId);
						rotProgId = progId
							+ _monikerName.Substring(guidEnd + 1);
					}
				}
				// Use the translated progId if available
				if (rotProgId != null)
					_monikerDisplayName = rotProgId;
				else
					_monikerDisplayName = _monikerName;
			}
			else
			{
				// The moniker is something else, just use that
				_monikerDisplayName = _monikerName;
			}
		}