ThreadInfoProvider Constructor |
Namespace: Xcalibur.WMI.Processes
1// Main 2private static void Main() 3{ 4 // Make a connection to the local machine 5 const string computer = "."; 6 var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions 7 { 8 Impersonation = ImpersonationLevel.Impersonate, 9 Authentication = AuthenticationLevel.Connect 10 }); 11 managementScope.Connect(); 12 13 // Process thread information 14 var provider = new ThreadInfoProvider(managementScope, -1, 2644); 15 16 // Fetch data 17 provider.Refresh(); 18 19 // Print first 5 threads for chrome.exe instance 20 foreach (var info in provider.Results.Take(5)) 21 { 22 Console.WriteLine($"{info.IdThread}, \t{info.StartAddress}, {info.Name}"); 23 } 24 25 // Read 26 Console.Read(); 27} 28 29/* Results: 30 * 31 * 552, 2622418848, chrome/0#18 32 * 16120, 2622418848, chrome/1#18 33 * 10932, 2622418848, chrome/2#17 34 * 2876, 2622418848, chrome/3#17 35 * 14876, 2622418848, chrome/4#17 36 * 37 */