Leaked source code of windows server 2003
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.

78 lines
2.1 KiB

  1. /*
  2. This script provides accurately timed update events.
  3. */
  4. Include('types.js');
  5. Include('utils.js');
  6. Include('staticstrings.js');
  7. var g_MachineName = LocalMachine;
  8. var g_strWaitFor = 'updatestatusvalueexit,updatestatusvaluenow';
  9. var g_nMinimumPeriod = 5000; // Minimum wait before updating the same machine twice.
  10. function updatestatusvalue_js::OnScriptError(strFile, nLine, nChar, strText, sCode, strSource, strDescription)
  11. {
  12. return CommonOnScriptError("updatestatusvalue_js", strFile, nLine, nChar, strText, sCode, strSource, strDescription);
  13. }
  14. function updatestatusvalue_js::ScriptMain()
  15. {
  16. var nEvent;
  17. CommonVersionCheck(/* $DROPVERSION: */ "V(########) F(!!!!!!!!!!!!!!)" /* $ */);
  18. LogMsg('ScriptMain()');
  19. do
  20. {
  21. // If nEvent was set to 1 in the loop, this wait will return immediatly as well.
  22. nEvent = WaitForSync(g_strWaitFor, g_nMinimumPeriod);
  23. if (nEvent == 2)
  24. ResetSync('updatestatusvaluenow');
  25. try
  26. {
  27. ScanErrorStatus();
  28. }
  29. catch(ex)
  30. {
  31. // Ignore errors caused by parts of PublicData missing
  32. }
  33. }
  34. while( nEvent != 1);
  35. LogMsg('ScriptMain() EXIT');
  36. }
  37. function ScanErrorStatus()
  38. {
  39. var aDepot = PublicData.aBuild[0].aDepot;
  40. var objDepot;
  41. var nDepotIdx;
  42. var nTaskIdx;
  43. var fSuccess = true;
  44. DepotLoop:
  45. for(nDepotIdx = 0; fSuccess && nDepotIdx < aDepot.length; ++nDepotIdx)
  46. {
  47. objDepot = aDepot[nDepotIdx];
  48. if (objDepot.strStatus == ERROR || objDepot.strStatus == ABORTED)
  49. {
  50. fSuccess = false;
  51. break DepotLoop;
  52. }
  53. for(nTaskIdx = 0; fSuccess && nTaskIdx < objDepot.aTask.length; ++nTaskIdx)
  54. {
  55. if (!objDepot.aTask[nTaskIdx].fSuccess)
  56. {
  57. fSuccess = false;
  58. break DepotLoop;
  59. }
  60. }
  61. }
  62. PublicData.aBuild[0].hMachine[g_MachineName].fSuccess = fSuccess;
  63. StatusValue(0) = !fSuccess;
  64. }