コード例 #1
0
ファイル: Injector.cs プロジェクト: ucswift/Sleuth
        static string Suffix(IntPtr windowHandle)
        {
            var window = new WindowInfo(windowHandle, null);
            string bitness = IntPtr.Size == 8 ? "64" : "32";
            string clr = "3.5";

            foreach (var module in window.Modules)
            {
                // a process is valid to snoop if it contains a dependency on PresentationFramework, PresentationCore, or milcore (wpfgfx).
                // this includes the files:
                // PresentationFramework.dll, PresentationFramework.ni.dll
                // PresentationCore.dll, PresentationCore.ni.dll
                // wpfgfx_v0300.dll (WPF 3.0/3.5)
                // wpfgrx_v0400.dll (WPF 4.0)

                // note: sometimes PresentationFramework.dll doesn't show up in the list of modules.
                // so, it makes sense to also check for the unmanaged milcore component (wpfgfx_vxxxx.dll).
                // see for more info: http://snoopwpf.codeplex.com/Thread/View.aspx?ThreadId=236335

                // sometimes the module names aren't always the same case. compare case insensitive.
                // see for more info: http://snoopwpf.codeplex.com/workitem/6090

                if
                (
                    module.szModule.StartsWith("PresentationFramework", StringComparison.OrdinalIgnoreCase) ||
                    module.szModule.StartsWith("PresentationCore", StringComparison.OrdinalIgnoreCase) ||
                    module.szModule.StartsWith("wpfgfx", StringComparison.OrdinalIgnoreCase)
                )
                {
                    if (FileVersionInfo.GetVersionInfo(module.szExePath).FileMajorPart > 3)
                    {
                        clr = "4.0";
                    }
                }
                if (module.szModule.Contains("wow64.dll"))
                {
                    if (FileVersionInfo.GetVersionInfo(module.szExePath).FileMajorPart > 3)
                    {
                        bitness = "32";
                    }
                }
            }
            return bitness + "-" + clr;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: ucswift/Sleuth
        public void Refresh()
        {
            this.windows.Clear();

            Dispatcher.BeginInvoke
            (
                System.Windows.Threading.DispatcherPriority.Loaded,
                (DispatcherOperationCallback)delegate
                {
                    try
                    {
                        Mouse.OverrideCursor = Cursors.Wait;

                        foreach (IntPtr windowHandle in NativeMethods.ToplevelWindows)
                        {
                            WindowInfo window = new WindowInfo(windowHandle, this);
                            if (window.IsValidProcess && !this.HasProcess(window.OwningProcess))	// Access Viotation Here
                            {
                                try
                                {
                                    this.windows.Add(window);
                                }
                                catch (Exception) { }
                            }
                        }

                        if (this.windows.Count > 0)
                        {
                            try
                            {
                                this.windowsView.MoveCurrentTo(this.windows[0]);
                            }
                            catch (Exception) { }
                        }
                    }
                    finally
                    {
                        Mouse.OverrideCursor = null;
                    }
                    return null;
                },
                null
            );
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: ohio813/Sleuth
 private void HandleRefreshCommand(object sender, ExecutedRoutedEventArgs e)
 {
     // clear out cached process info to make the force refresh do the process check over again.
     WindowInfo.ClearCachedProcessInfo();
     this.Refresh();
 }