标签:roc try close out 进程 string c++ UNC include
#include <vector>
BOOL TraversalProcess3(OUT std::vector<DWORD> &vec)
{
vec.clear();
try
{
HANDLE hProcess = 0;
for (DWORD i = 0; i < WORD_MAX; i += 4)
{
hProcess = ::OpenProcess(PROCESS_ALL_ACCESS, 0, i);
if (hProcess)
{
vec.push_back(i);
CloseHandle(hProcess);
hProcess = 0;
}
}
}
catch (...)
{
OutputDebugStringA(__FUNCTION__);
return 0;
}
return vec.size() > 0;
}
int main()
{
std::vector<DWORD> vec;
std::cout << TraversalProcess3(vec) << endl;
for each (DWORD var in vec)
{
printf("%d\t", var);
printf("\r\n");
}
return 0;
}
标签:roc try close out 进程 string c++ UNC include
原文地址:https://www.cnblogs.com/dailycode/p/12459598.html