Exemplo n.º 1
0
            public void Run(RemoteHooking.IContext inContext, string inChannelName)
            {
                //Create the DefaultDevice Hook
                var cci = new ComClassQuery.ComClassInfo(typeof(MMDeviceEnumeratorComObject),
                                                         typeof(IMMDeviceEnumerator), "GetDefaultAudioEndpoint");

                ComClassQuery.Query(cci);

                var hook = LocalHook.Create(cci.FunctionPointer, new DGetDefaultAudioEndpoint(GetDefaultAudioEndpoint),
                                            this);

                hook.ThreadACL.SetExclusiveACL(new int[] {});

                try
                {
                    while (!Interface.CanUnload())
                    {
                        Thread.Sleep(1000);
                    }

                    hook.Dispose();
                }
                catch (Exception e)
                {
                    try
                    {
                        Interface.ReportError(RemoteHooking.GetCurrentProcessId(), e);
                    }
                    catch
                    {
                        //.NET Remoting timeout etc...
                    }
                }
                finally
                {
                    hook.Dispose();
                }
            }
Exemplo n.º 2
0
            public void Run(RemoteHooking.IContext inContext, string inChannelName)
            {
                //Create the DefaultDevice Hook
                var cci = new ComClassQuery.ComClassInfo(typeof (MMDeviceEnumeratorComObject),
                    typeof (IMMDeviceEnumerator), "GetDefaultAudioEndpoint");
                ComClassQuery.Query(cci);

                var hook = LocalHook.Create(cci.FunctionPointer, new DGetDefaultAudioEndpoint(GetDefaultAudioEndpoint),
                    this);
                hook.ThreadACL.SetExclusiveACL(new int[] {});

                try
                {
                    while (!Interface.CanUnload())
                    {
                        Thread.Sleep(1000);
                    }

                    hook.Dispose();
                }
                catch (Exception e)
                {
                    try
                    {
                        Interface.ReportError(RemoteHooking.GetCurrentProcessId(), e);
                    }
                    catch
                    {
                        //.NET Remoting timeout etc...
                    }
                }
                finally
                {
                    hook.Dispose();
                }
            }