I have written now the communication between the PM editor and the helper program via unnamed semaphores and shared memory. When the PM editor runs the helper, the command parameters hold the pointer values of the shared memory and the semaphores. This all works fine already.
I tried to run the program in the grandfather - parent - child variant and it did fail - Wim was absolutely right with his forecast, when he said, I need a separate session for the helper and the cmd.exe program. The parent cannot send exeptions to the child if it has been executed as a process from another program (grandfather) - I indeed get an error when calling DosSendException to cmd.exe in the helper program.
Because the editor has to start the helper program in a separate session (DosStartSession), the inheritance of stdin, stdout und stderr via DosExecPgm is not available. So I do not use DosDupHandle in the PM editor. Instead, I use DosCreatePipe and inform the helper program about the file handle values of the three pipes via commandline parameters.
But now the helper program has to set stdin, stdout and stderror to the values which are received from the PM editor via commandline parameters. In Windows, there's a function SetStdHandle, and I cannot use DosDupFile, because DosDupFile (parampipehandle, &STDIN_HANDLE) does not work of course (because STDIN_HANDLE has the fix value 0). How can I set stdin, stdout and stderr to my specific handle values before executing cmd.exe and inheriting stdin, stdout and stderr? I am sure that the solution is simple, but I have no idea anyway.