Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
809 B

  1. #include "pch.h"
  2. #pragma hdrstop
  3. const TCHAR szAUTestValidationFile[] = _T("autest.cab");
  4. DWORD dwTimeToWait(DWORD dwTimeInSecs, DWORD dwMinSecs)
  5. {
  6. static DWORD dwSecsInADay = -1;
  7. if ( -1 == dwSecsInADay)
  8. {
  9. dwSecsInADay = AU_ONE_DAY;
  10. #ifndef DBG
  11. if (WUAllowTestKeys(szAUTestValidationFile) )
  12. #endif
  13. {
  14. if (FAILED(GetRegDWordValue(_T("SecsInADay"), &dwSecsInADay)) ||
  15. (dwSecsInADay > AU_ONE_DAY) )
  16. {
  17. dwSecsInADay = AU_ONE_DAY;
  18. }
  19. }
  20. }
  21. DWORD dwMS = DWORD((((double(1000) * double(dwTimeInSecs)) / double(AU_ONE_DAY)) * double(dwSecsInADay)));
  22. DWORD dwMinMS = dwMinSecs * 1000;
  23. if ( dwMS < dwMinMS )
  24. {
  25. dwMS = dwMinMS;
  26. }
  27. if ( dwMS < AU_MIN_MS )
  28. {
  29. // we dont' wait less that 1 second
  30. dwMS = AU_MIN_MS;
  31. }
  32. return dwMS;
  33. }