i'm trying make command close processes, not work me.
#include "stdafx.h" int _tmain(int argc, _tchar* argv[]) { // list of process identifiers. dword exitcode; dword aprocesses[1024], cbneeded, cprocesses; unsigned int i; if (!enumprocesses( aprocesses, sizeof(aprocesses), &cbneeded ) ) { return 1; } // calculate how many process identifiers returned. cprocesses = cbneeded / sizeof(dword); // exit each process. ( = 0; < cprocesses; i++ ) { std::cout<<"end"; if( aprocesses[i] != 0 ) { getexitcodeprocess(openprocess(process_all_access,false,aprocesses[i]),&exitcode); exitprocess(exitcode); } } }
in addition, errors:
> 'check2.exe': loaded 'c:\users\barak shriky\documents\visual studio 2010\projects\check2\debug\check2.exe', symbols loaded. 'check2.exe': loaded 'c:\windows\syswow64\ntdll.dll', symbols loaded (source information stripped). 'check2.exe': loaded 'c:\windows\syswow64\kernel32.dll', symbols loaded (source information stripped). 'check2.exe': loaded 'c:\windows\syswow64\kernelbase.dll', symbols loaded (source information stripped). 'check2.exe': loaded 'c:\windows\syswow64\msvcp100d.dll', symbols loaded (source information stripped). 'check2.exe': loaded 'c:\windows\syswow64\msvcr100d.dll', symbols loaded (source information stripped). 'check2.exe': loaded 'c:\windows\syswow64\psapi.dll', symbols loaded (source information stripped). program '[3292] check2.exe: native' has exited code -858993460 (0xcccccccc).
can please me issue?
looks me it's working fine - haven't got symbols installed system dll's, normal.
of course, more meaningful message of why process exited if set exitcode
- exitcode = 0xdeadbeef;
- , see process killed itself.
doing seems bad thing (assuming "successful" in closing process in first place), since there plenty of processes in windows when stopped causes rest of system not work well. such page-in/out process, example, used load/unload executables. being more selective in processes kill useful.
Comments
Post a Comment