I have a function:
HANDLE snapshot=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
...
result=Process32First(snapshot,&pe);
while(result) {
if(!_stricmp(process_name,pe.szExeFile)) {
processes.push_back(pe.th32ProcessID);
}
result=Process32Next(snapshot,&pe);
}
for(dword_vector::iterator i=processes.begin(); i!=processes.end(); ++i){
HANDLE hProcess=OpenProcess(PROCESS_TERMINATE, FALSE, *i);
if(hProcess) {
TerminateProcess(hProcess, 0);
CloseHandle(hProcess);
}
}
It works fine on 32bit platform but on 64 bit platform OpenProcess returns Access_denied for some processes(the same processes on 32 bit can be computed fine). All processes I trying to open are 32bit.
What can be a problem?