Don’t cache process ID.
As you can see from stepping into it in debugger, GetCurrentProcessID
is a very lightweight function that directly reads OS thread/process structures from fs/gs:offset
(just like GetLastError
etc.), no need to cache it at the cost of making all applications link to it.