求NtQuerySystemInformation的c#版详细分析

tcxx2008 2010-01-28 12:00:31
c++中:
NTSTATUS NtQuerySystemInformation(
SYSTEM_INFORMATION_CLASS SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);

转化到c#中
[DllImport("ntdll.dll", EntryPoint = "NtQuerySystemInformation")]
private static extern int NtQuerySystemInformation(int InfoType, structName lpStructure, int structSize, IntPtr returnLength);
不知道对不对?

主要是这些参数该输入什么:InfoType 输入1代表什么呢??我要得到进程,句柄这些输入几?structName lpStructure 有些地方用byte[] 我用了后 返回一堆数组数字,这些数字怎么组合成我要的东西呢??

网上搜索了下资料很少,那位懂的给些实例吧。最好是获取进程,句柄这些信息。
...全文
195 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tcxx2008 2010-01-29
  • 打赏
  • 举报
回复
最新情况是:
byte[] A = new byte[602400];
ulong returnL = 0;

int iReturn = NtQuerySystemInformation(16, A, (ulong)A.Length, returnL);

调用完, iReturn 为0 的,说明调用成功的哦。

16 代表取的是句柄信息,这样能取到数据,但不知道这些数据是什么数据,
而且 A 用 int[], long[] , double[] 类型取到得数据都不一样,那我应该是用那个类型,怎么组织这些数据。
lvxianda 2010-01-28
  • 打赏
  • 举报
回复
up

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧