https://bugs.winehq.org/show_bug.cgi?id=46272
--- Comment #11 from Zebediah Figura z.figura12@gmail.com --- (In reply to Hans Leidekker from comment #9)
(In reply to Zebediah Figura from comment #7)
(In reply to Hans Leidekker from comment #3)
Obviously we can't do server calls in programs. Maybe it would be acceptable to use an unused field from SYSTEM_PROCESS_INFORMATION for this purpose, e.g. dwUnknown4. Then we could retrieve the Unix pid with a call to NtQuerySystemInformation(SystemProcessInformation).
I think it would make more sense to use an unused value instead, something like NtQueryInformationProcess(ProcessUnixPID); what do you think?
For the taskkill case I think it would be better to have it in SYSTEM_PROCESS_INFORMATION. We're already walking the list of processes so it requires no extra calls to retrieve the Unix pid. This way we are also guaranteed to get consistent data because it's all in the same snapshot. A separate call would open up a race, albeit very unlikely to hit.
Eh, I guess. I'm just concerned about abusing reserved fields that might be meaningful, and I'm not sure how worthwhile avoiding that kind of a race would actually be. Not to mention that our current implementation of SystemProcessInformation is already racy (though I guess this could be fixed by moving it all to the server).
Besides which trying to avoid races may be a moot point, as it seems that tasklist.exe is supposed to return/filter by some things (username, "service information") that aren't available in SYSTEM_PROCESS_INFORMATION anyway.