Click or drag to resize

ModuleInfoProvider Constructor

Initializes a new instance of the ModuleInfoProvider class.

Namespace:  Xcalibur.WMI.Processes
Assembly:  Xcalibur.WMI (in Xcalibur.WMI.dll) Version: 3.0.0.0 (3.0.1.0)
Syntax
public ModuleInfoProvider(
	ManagementScope ms
)

Parameters

ms
Type: System.ManagementManagementScope
The management scope.
Examples
C#
 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 module information
14    var provider = new ModuleInfoProvider(managementScope);
15
16    // Fetch data
17    provider.Refresh();
18
19    // Print first 5 modules for chrome.exe instance
20    foreach (var info in provider.Results.Where(x => x.ProcessId == 10472).Take(5))
21    {
22        Console.WriteLine($"{info.BaseAddress}, {info.FilePath}");
23    }
24
25    // Read
26    Console.Read();
27}
28
29/* Results: 
30 * 
31 * 140694869245952, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
32 * 140715467014144, C:\WINDOWS\SYSTEM32\ntdll.dll
33 * 140714911268864, C:\Program Files\AVAST Software\Avast\x64\aswhooka.dll
34 * 140714574282752, C:\Program Files\AVAST Software\Avast\snxhk64.dll
35 * 140715465375744, C:\WINDOWS\System32\KERNEL32.dll
36 * 
37 */
See Also