Home > Back-end >  Snapshot CreateToolhelp32Snapshot acquisition process how to get the process of Chinese
Snapshot CreateToolhelp32Snapshot acquisition process how to get the process of Chinese

Time:11-07

 

PROCESSENTRY32 Pe32;
Pe32. DwSize=sizeof (PROCESSENTRY32);
HANDLE hShapshot=CreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
If (hShapshot==INVALID_HANDLE_VALUE)
{
Printf (" snapshot creation process failure ");
return FALSE;
}
//char name [MAX_PATH]={0};
//LPTSTR sBuf=new TCHAR [MAX_PATH];
//memset (sBuf, 0, sizeof (TCHAR) * (MAX_PATH));

Process32First (hShapshot, & amp; Pe32);
While (Process32Next (hShapshot, & amp; Pe32))
{
Printf (" % ls \ n ", Pe32 szExeFile);
//memcpy (name, Pe32 szExeFile, strlen (Pe32. SzExeFile));
//WideCharToMultiByte (CP_ACP, 0, name, 1,
//sBuf, MAX_PATH, NULL, NULL);
//sprintf_s (name, "% s \ n", sBuf);
Process32Next (hShapshot, & amp; Pe32);
}

CodePudding user response:

Use W suffix API and Struct
  • Related