Why Windows binaries behave differently on a 64-bit machine

I have a little Qt5-mingw code on my 64 bit machine (Windows 10). In this code, I run the notepad.exe file using the Qt platform and wait for it to complete its execution. This works great on both a 32-bit and a 64-bit machine.

Now the same code is used to run another EXE calculator. In this case, the calculator starts, as expected, on a 32-bit platform, but we do not wait for 64 bits while the calculator is working.

I tested this behavior with a process monitoring tool on a 64-bit machine, and exe seems to resume working with others pid.

How can I wait calc.exewhile working?

QProcess notepad;
notepad.start("notepad");
notepad.waitForFinished();
qDebug()<<"notepad will wait for finish";

QProcess calc;
calc.start("calc");  //("C:\\Windows\\System32\\calc.exe");  ("C:\\Windows\\SysWOW64\\calc.exe");    
// -- wait while finish() --
// 32-bit: Works fine
// 64-bit: This is where we should wait while calc.exe is running    
calc.waitForFinished(); 
qDebug()<<"calculator will NOT wait for finish";
+4

Source: https://habr.com/ru/post/1653885/


All Articles