Hi,
How do I differentiate in my C++ code between a service coming up as a part of system reboot and service coming up since the user stopped and started the service manually in service manager or using sc tool????
Hi,
How do I differentiate in my C++ code between a service coming up as a part of system reboot and service coming up since the user stopped and started the service manually in service manager or using sc tool????
Using GetTickCount()
maybe, to know the time elapsed since system start …
If GetTickCount() is unsuitable for your purposes, you could try scanning the System Event Log for the most recent Windows startup event, which has a datetime associated with it...
Well , there is windows uptime.exe available in Windows NT SP4... or you can download it from MSDN site.. which gives the uptime of the system similar to unix.... Get the output of uptime .... if the call to your Service comes within first 10 mins of the OS boot up , then it starting as result of OS reboot or else its service restart... this is uncomplicated neat heuristic solution.... You also use the cmd systeminfo | Find "Up Time" to get uptime ....