How to detect that the system clock has been set backwards?
-
Check the date/time of important system files. If they are from the future, you know something is up. _____________________ "So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too." Breakfast of Champions, Kurt Vonnegut
Daniel Ferguson wrote: Check the date/time of important system files. Can you give some examples? Is it possible it could work from Win95 upto WinXP?
-
Daniel Ferguson wrote: Check the date/time of important system files. Can you give some examples? Is it possible it could work from Win95 upto WinXP?
\winnt\system32\user32.dll get the last accessed time. Signature space for rent. Apply by email to....
-
Hi, Does anyone have an idea (tips, links, code) how my app can detect that the system clock is set backwards? I want to know even when my app was not running at the time of change and/or the PC has been rebooted. Thanks.
This might be a problem on PCs that use daylight saving, or on systems that sync with an external time source, such as a server or radio clock. I'd allow a margin of at least 2 hours to be a valid change, although I'm assuming you want to do some kind of expiry-time protection. Steve S [This signature space available for rent]
-
\winnt\system32\user32.dll get the last accessed time. Signature space for rent. Apply by email to....
This wont work if updating access times is turned off. (registry hack, speeds up quite a bit) ...if you're under 8 or younger. Chris Maunder, the Lounge
-
This might be a problem on PCs that use daylight saving, or on systems that sync with an external time source, such as a server or radio clock. I'd allow a margin of at least 2 hours to be a valid change, although I'm assuming you want to do some kind of expiry-time protection. Steve S [This signature space available for rent]
That was an issue I indeed already thought of. Nevertheless, thanks for the input.
-
This wont work if updating access times is turned off. (registry hack, speeds up quite a bit) ...if you're under 8 or younger. Chris Maunder, the Lounge
This hack sounds cool. More info? Signature space for rent. Apply by email to....
-
This hack sounds cool. More info? Signature space for rent. Apply by email to....
http://is-it-true.org/nt/registry/rtips71.shtml[^] ...if you're under 8 or younger. Chris Maunder, the Lounge
-
\winnt\system32\user32.dll get the last accessed time. Signature space for rent. Apply by email to....
I don't think this will work. The last accessed timestamp of the file user32.dll is updated with a date of the past, when you set backwards the clock. But you can't check that. The computer thinks 'now' is that date in the past. Some more details about my question: Time line: A1 < A2 < X < E < Y My App is started at A1 end stopped at A2. My app informs the user that his license will expire at E. At time Y the user does the following: - he sets back the clock to X - he starts up my app How can my app know - the computer ever ran at Y (>E)? - the license is expired
-
Hi, Does anyone have an idea (tips, links, code) how my app can detect that the system clock is set backwards? I want to know even when my app was not running at the time of change and/or the PC has been rebooted. Thanks.
Think about it from another direction: Why not record the time each time your app exits (keep it in a registry key or a hidden file or something of the sort). When your app starts compare the current time with the last-exit time. If the last-exit time appears to be in the future someone may be cheating. Just remember to allow for DST as someone else suggested.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
-
Think about it from another direction: Why not record the time each time your app exits (keep it in a registry key or a hidden file or something of the sort). When your app starts compare the current time with the last-exit time. If the last-exit time appears to be in the future someone may be cheating. Just remember to allow for DST as someone else suggested.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
The scenario you suggest fails in the following case: Time line: A1 < A2 < X < E < Y My App is started at A1 end stopped at A2. My app informs the user that his license will expire at E. At time Y the user does the following: - he sets back the clock to X - he starts up my app When my app starts A2 < X, so it doesn't detect any cheating. How can my app know - the computer ever ran at Y (>E)? - the license is expired
-
The scenario you suggest fails in the following case: Time line: A1 < A2 < X < E < Y My App is started at A1 end stopped at A2. My app informs the user that his license will expire at E. At time Y the user does the following: - he sets back the clock to X - he starts up my app When my app starts A2 < X, so it doesn't detect any cheating. How can my app know - the computer ever ran at Y (>E)? - the license is expired
a) examine the eventlog - events there are in chronological order. b) write to eventlog your own entries. c) examine registry entries. booting leaves trails in registry. hint: RegQueryInfoKey() combine methods. ...if you're under 8 or younger. Chris Maunder, the Lounge