Does Windows XP (and up) store how long it has been...
- ...since the system booted?
- ...running since install?
- ...in hours/minutes since current used logged on?
- ...in total hours the user has been logged on?
Thanks.
Does Windows XP (and up) store how long it has been...
Thanks.
GetTickCount() does what you want, though it wraps-around every 49 days or so. So, yeah, use GetTickCount64().
You can use the LsaGetLogonSessionData
to get the data about a particular logon session, including the time the session was started. To call that method you need a LUID - a logon session ID. You can get the list of current logon sessions LUIDs using LsaEnumerateLogonSessions
.
If you are looking for the data for a particular user, you can look at the UserName member of the SECURITY_LOGON_SESSION_DATA
structure returned by
LsaGetLogonSessionData
.
Edit: To get the time since the system was started, use GetTickCount64(), as @jeffamaphone mentioned.
The others you can calculated from the difference between the SECURITY_LOGON_SESSION_DATA.LogonTime
and the current time.
On the terminal run systeminfo
Example:
C:\WINDOWS>systeminfo
Host Name: ...
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 2 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Registered Owner: ...
Registered Organization: ...
Product ID: ...
Original Install Date: 17/04/2009, 10:23:23 AM
System Up Time: 0 Days, 0 Hours, 51 Minutes, 11 Seconds
System Manufacturer: Dell Inc.
(etc...)
I believe there may be other ways also to find such info. For example, PCWizard shows some more detailed info about install date, boots since install, uptime, time since logon, etc.