This commit is contained in:
Simon Rozman 2016-03-30 13:01:33 +02:00
parent bb77b86f13
commit c1e18dddc6

View File

@ -407,14 +407,15 @@ HRESULT COpTaskCreate::Execute(CSession *pSession)
// Windows XP doesn't support random startup delay. However, we can add fixed "random" delay when creating the trigger. // Windows XP doesn't support random startup delay. However, we can add fixed "random" delay when creating the trigger.
WORD wStartTime = ttData.wStartHour * 60 + ttData.wStartMinute + (WORD)::MulDiv(rand(), ttData.wRandomMinutesInterval, RAND_MAX); WORD wStartTime = ttData.wStartHour * 60 + ttData.wStartMinute + (WORD)::MulDiv(rand(), ttData.wRandomMinutesInterval, RAND_MAX);
FILETIME ftValue; FILETIME ftValue;
SYSTEMTIME stValue; SYSTEMTIME stValue = {
ttData.wBeginYear,
ttData.wBeginMonth,
0,
ttData.wBeginDay,
};
ULONGLONG ullValue; ULONGLONG ullValue;
// Convert MDY date to numerical date (SYSTEMTIME -> FILETIME -> ULONGLONG). // Convert MDY date to numerical date (SYSTEMTIME -> FILETIME -> ULONGLONG).
ZeroMemory(&stValue, sizeof(stValue));
stValue.wYear = ttData.wBeginYear;
stValue.wMonth = ttData.wBeginMonth;
stValue.wDay = ttData.wBeginDay;
::SystemTimeToFileTime(&stValue, &ftValue); ::SystemTimeToFileTime(&stValue, &ftValue);
ullValue = ((ULONGLONG)(ftValue.dwHighDateTime) << 32) | ftValue.dwLowDateTime; ullValue = ((ULONGLONG)(ftValue.dwHighDateTime) << 32) | ftValue.dwLowDateTime;