Selam, doğru aow_exe.exe'nin PID numarasını bulabilmek için küçük bir kod yazdım umarım işinize yarar.
C++:
std::string exec(const char* cmd) {
char buffer[128];
std::string result = "";
FILE* pipe = _popen(cmd, "r");
if (!pipe) throw std::runtime_error("popen() failed!");
try {
while (fgets(buffer, sizeof buffer, pipe) != NULL) {
result += buffer;
}
}
catch (...) {
_pclose(pipe);
throw;
}
_pclose(pipe);
return result;
}
bool sayimi(char c) {
if (c == ' ') return false;
return true;
}
int getPid(string source)
{
size_t son = source.find('C', 0) - 1;
int bas = 0;
for (int i = son - 5; ; i++) {
if (sayimi(source[i])) {
bas = i;
break;
}
}
source = source.substr(bas, son);
source = source.substr(0, source.find("Console") - 1);
return atoi(source.c_str());
}
auto main() -> int
{
const string quote = "\"";
const string x = "tasklist /fi " + quote + "IMAGENAME eq aow_exe.exe" + quote + " " + "/fi " + quote + "MEMUSAGE gt 200000" + quote + " " + "/nh";
DWORD TARGET_PROCESS_ID = getPid(exec(x.c_str()));
cout << TARGET_PROCESS_ID;
system("pause");
return 1;
}