GetLastInputInfo() が偽装しているユーザーの情報を返さないのはなぜか?
GetLastInputInfo() は偽装 (impersonation) を考慮しません。その動作は「そのままの内容」で、偽装されたユーザーではなく、呼び出し元スレッドの実際のユーザーに関する最終入力情報を返します。
GetLastInputInfo() は偽装 (impersonation) を考慮しません。その動作は「そのままの内容」で、偽装されたユーザーではなく、呼び出し元スレッドの実際のユーザーに関する最終入力情報を返します。
GetLastInputInfo() does not return info for an impersonated user because it queries the desktop's input state, not the thread's token. Impersonation changes the security context but not the desktop, so the function still reports the state of the thread's attached desktop, not the impersonated user's session.
The article explains that GetLastInputInfo() returns the last input time for the current desktop's input queue, not for a specific user or thread. Even if impersonating another user, the function still reports the last input on the same interactive desktop session. To track input per user, separate desktop sessions or custom monitoring is needed.