zoukankan      html  css  js  c++  java
  • 列举进程

    xp:

    #include <windows.h>
    #include <tlhelp32.h>

    int SearchProess(const char* name)
    {
    int ret=0;
    HANDLE handle=NULL;
    PROCESSENTRY32 pe32={0};
    do
    {
    handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    if(handle==(HANDLE)-1)break;
    pe32.dwSize=sizeof(PROCESSENTRY32);
    if(!Process32First(handle,&pe32))break;
    do
    {
    if(strcmp(pe32.szExeFile,name)==0)
    {
    ret=1;
    break;
    }
    }
    while(Process32Next(handle,&pe32));
    } while (0);
    if(handle)
    {
    CloseHandle(handle);
    handle=NULL;
    }
    return ret;
    }

    WINCE:

    #include <tlhelp32.h>
    #pragma comment(lib, "Toolhelp.lib ")


    int SearchProess(const TCHAR* name)
    {
    int ret=0;
    HANDLE handle=NULL;
    PROCESSENTRY32 pe32={0};
    do
    {
    handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    if(handle==(HANDLE)-1)break;
    pe32.dwSize=sizeof(PROCESSENTRY32);
    if(!Process32First(handle,&pe32))break;
    do
    {
    if(_tcscmp(pe32.szExeFile,name)==0)
    {
    ret=1;
    break;
    }
    }
    while(Process32Next(handle,&pe32));
    } while (0);
    if(handle)
    {
    CloseToolhelp32Snapshot(handle);
    handle=NULL;
    }
    return ret;
    }

  • 相关阅读:
    取随机数
    端口号
    cut命令
    渗透
    ssh免密登陆
    漏洞扫描
    信息收集1:DNSEUM命令
    Centos6与Centos7的区别
    HAPROXY+KEEPALIVED实现负载均衡
    this的用法
  • 原文地址:https://www.cnblogs.com/ccmfc/p/2624635.html
Copyright © 2011-2022 走看看