Is there a way for a third process to discover the correspondence between bash.exe and the terminal emulator in which it is running. In my case the terminal emulator is mintty.
I know I can type echo $PPID - but this seems undisoverable outside of bash itself. I have tried getting the parent process using NtQueryInformationProcess but the parent PID obtained by this method for bash.exe appears to be a non-existing process (Process Explorer confirms this).
Any other ideas?