当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: 主要设计代码如下:#include <tlhelp32.h
 

 

    摘要:实现的主要部分代码:#include <setupapi.h>#include <devguid.h>#include <regstr.h>#pragma comment(lib,"setupapi.lib")clistbox m_strlist;........枚举所有硬件设备的主要实现代码: m_strlist.resetcontent(......
    摘要:在文章《获取进程模块的信息》中,由于当时不知道如何提升权限,所以无法获取更多的系统进程的信息,今天看到了一段代码,让我眼前一亮,不说废话了,代码如下:bool enabledebugprivilege(){ handle htoken; bool fok=false; if(openprocesstoken(getcurrentprocess(),token_adjust_privileges,&......


获得当前进程所有者的信息
主要设计代码如下:

【程序编程相关:软件需求分析的要点

【推荐阅读:text1

#include <tlhelp32.h> 【扩展信息:MFC对话框程序中添加工具栏及工具栏上的

.......

clistctrl m_strlist;

cstring m_strvalue;

.......

//获取当前进程的所有者的信息

void ongetuser()

{

// todo: add your control notification handler code here

updatedata();

if(m_strvalue.isempty())

{

  afxmessagebox(_t("process id is empty!"));

  return ;

}

int nid = atol(m_strvalue);

cstring str;

getprocessauth(str, nid);

if(strpathvalid.isempty())

{

  afxmessagebox(_t("get the path failed!"));

}

else

{

  afxmessagebox(strpathvalid);

}

}

//读取当前进程的所有者的信息

void getprocessauth(cstring strpath,long pid)

{

//获得运行进程的用户身份,此处对于8以上的进程没问题,对于8,0进程无法列出(8是win2000下的,winxp下为4)

sid_name_use peuse;

handle hp;

handle htoken;

int isok;

char buf[0x400];


...   下一页
    摘要:// linktest.cpp : defines the entry point for the console application.// #include "stdafx.h"#include <iostream.h> typedef struct _node{ int val; struct _node * link;}node,*pnode; vo......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE