1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Fix on windows actor to check if lastInputInfo is valid or not...

This commit is contained in:
Adolfo Gómez García 2018-11-13 10:52:11 +01:00
parent 68a58b7c73
commit ff2f508240

View File

@ -210,7 +210,10 @@ def initIdleDuration(atLeastSeconds):
def getIdleDuration():
lastInputInfo = LASTINPUTINFO()
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
ctypes.windll.user32.GetLastInputInfo(ctypes.byref(lastInputInfo))
if ctypes.windll.user32.GetLastInputInfo(ctypes.byref(lastInputInfo)) == 0:
return 0
if lastInputInfo.dwTime > 1000000000: # Value toooo high, nonsense...
return 0
millis = ctypes.windll.kernel32.GetTickCount() - lastInputInfo.dwTime # @UndefinedVariable
return millis / 1000.0