I am trying to do something like this in C#. I found out how to call Win32 methods from C# using P/Invoke from this link. However I met some difficulties in implementing P/I
[DllImport("Pdh.dll")] static extern Int32 PdhOpenQuery(string szDataSource, IntPtr dwUserData, ref IntPtr phQuery);