Get Windows-PID for process with known Unix-PID

Martin Szydlowski msz at
Thu Jul 3 08:19:35 CDT 2008

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : 

More information about the wine-devel mailing list