Hi all,
I am starting and stopping some Windows (and also Unix) programs from a shell script. To start, I use fork/exec which gives me the Unix PID. To stop the program I use kill. I have experimented with different signals (TERM, HUP, INT, KILL) and all of them achieve the goal of stopping the program, but it does not shut down cleanly (as opposed to using File->Exit or the red X).
I have written a small program (winelib) that enumerates all windows and can send as WM_CLOSE message to a program with a certain Windows PID. Since I have several instances of the same executable running, I cannot distinguish them by name or path, hence I save the PID when starting them, but it's the Unix PID I have. I believe there must be a way to get a mapping of Windows-PIDs <-> Unix-PIDs, but extensive googling only revealed (repeatedly) to me that those two must not be confused.
I know I can get the Windows-PIDs using winedbg->info process but there is no trace of Unix PIDs there. Also, I need a scriptable way to do this, best being a small app that gets a Unix PID and prints the matching Windows PID to console.
greetz Martin
Martin Szydlowski wrote:
I know I can get the Windows-PIDs using winedbg->info process but there is no trace of Unix PIDs there. Also, I need a scriptable way to do this, best being a small app that gets a Unix PID and prints the matching Windows PID to console.
I don't think there's currently a way to do this. You may have to write a Winelib wrapper program that starts your main program and prints its Windows PID on stdout or something, so that your script can capture it.