I think I would like to try and find my program with the parameters it starts!
One question on your code, how does it identify the different processes that could be running of my program and the mstsc ?
You have a description field. You can rename it to whatever your like:
var
I: Integer;
Params: String;
begin
// ...
for I := 1 to ParamCount do
Params := Params + ' ' + ParamStr(I);
ProcessData.PID := CurPID; //your processid
ProcessData.Description := Params; //params
ProcessData.mstscPID := Proc.ProcessID; //mstsc processid started by your process
ProcessData.hFileMap := hFileMap; //handle to memory mapped file
ProcessData.LastActive := GetTickCount; //last active
//...
end.
So basically it looks like this(don't forget LastActive1, LastActive2 ,..is updated every second or so):
YourProcess1--->MemoryMappedFile1-->ProcessData1(PID1, Params1, mstscPID1, hFileMap1, LastActive1)
YourProcess2--->MemoryMappedFile2-->ProcessData2(PID2, Params2, mstscPID2, hFileMap2, LastActive2)
...
When your bat file starts process i( i = [1...n] ), then process i will loop through MemoryMappedFile1, MemoryMappedFile2, ....
Now MemoryFile1 contains all info about YourProcess1(even your beloved parameters)
Hope this helps!