private void QueryInterface(IntPtr punk, Guid iid, Dictionary <IntPtr, string> module_names, HashSet <COMInterfaceInstance> list)
        {
            if (punk != IntPtr.Zero)
            {
                IntPtr ppout;
                if (Marshal.QueryInterface(punk, ref iid, out ppout) == 0)
                {
                    IntPtr vtable = Marshal.ReadIntPtr(ppout, 0);
                    COMInterfaceInstance intf;

                    using (SafeLibraryHandle module = COMUtilities.SafeGetModuleHandle(vtable))
                    {
                        if (_clsctx == CLSCTX.INPROC_SERVER && module != null)
                        {
                            if (!module_names.ContainsKey(module.DangerousGetHandle()))
                            {
                                module_names[module.DangerousGetHandle()] = module.GetModuleFileName();
                            }
                            intf = new COMInterfaceInstance(iid,
                                                            module_names[module.DangerousGetHandle()],
                                                            vtable.ToInt64() - module.DangerousGetHandle().ToInt64());
                        }
                        else
                        {
                            intf = new COMInterfaceInstance(iid);
                        }
                    }


                    list.Add(intf);
                    Marshal.Release(ppout);
                }
            }
        }