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.

89 lines
2.6 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #ifdef DBG
  4. //=======================================================================
  5. //
  6. // Copyright (c) 2001 Microsoft Corporation. All Rights Reserved.
  7. //
  8. // File: cltdebug.cpp
  9. //
  10. // Creator: PeterWi
  11. //
  12. // Purpose: wuauclt debug functions.
  13. //
  14. //=======================================================================
  15. const UINT_PTR AU_AUTOPILOT_TIMER_ID = 555;
  16. const DWORD AU_AUTOPILOT_TIMEOUT = 2000;
  17. //=======================================================================
  18. //
  19. // DebugAutoPilotTimerProc
  20. //
  21. // Called after timeout to dismiss dialog.
  22. //
  23. //=======================================================================
  24. VOID CALLBACK DebugAutoPilotTimerProc( HWND hWnd, // handle to window
  25. UINT /*uMsg*/, // WM_TIMER message
  26. UINT_PTR /*idEvent*/, // timer identifier
  27. DWORD /*dwTime*/) // current system time
  28. {
  29. if ( hWnd == ghMainWindow )
  30. {
  31. PostMessage(hWnd, AUMSG_TRAYCALLBACK, 0, WM_LBUTTONDOWN);
  32. }
  33. else
  34. {
  35. PostMessage(hWnd, WM_COMMAND, IDC_OK, 0);
  36. }
  37. KillTimer(hWnd, AU_AUTOPILOT_TIMER_ID);
  38. }
  39. //=======================================================================
  40. //
  41. // DebugCheckForAutoPilot
  42. //
  43. // Check to see if we want AU to run by itself.
  44. //
  45. //=======================================================================
  46. void DebugCheckForAutoPilot(HWND hWnd)
  47. {
  48. DWORD dwAutoPilot;
  49. if ( SUCCEEDED(GetRegDWordValue(TEXT("AutoPilot"), &dwAutoPilot)) &&
  50. (0 != dwAutoPilot) )
  51. {
  52. SetTimer(hWnd, AU_AUTOPILOT_TIMER_ID, AU_AUTOPILOT_TIMEOUT, DebugAutoPilotTimerProc);
  53. }
  54. }
  55. //=======================================================================
  56. //
  57. // DebugUninstallDemoPackages
  58. //
  59. // Uninstall demo packages and increase iteration count.
  60. //
  61. //=======================================================================
  62. void DebugUninstallDemoPackages(void)
  63. {
  64. DWORD dwAutoPilot;
  65. if ( SUCCEEDED(GetRegDWordValue(TEXT("AutoPilot"), &dwAutoPilot)) &&
  66. (0 != dwAutoPilot) )
  67. {
  68. if ( FAILED(GetRegDWordValue(TEXT("AutoPilotIteration"), &dwAutoPilot)) )
  69. {
  70. dwAutoPilot = 0;
  71. }
  72. DEBUGMSG("AUTOPILOT: Finished iteration %d", ++dwAutoPilot);
  73. SetRegDWordValue(TEXT("AutoPilotIteration"), dwAutoPilot);
  74. fRegKeyDelete(TEXT("SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{0A1F2CEC-8688-4d1b-A266-051415FBEE91}"));
  75. fRegKeyDelete(TEXT("SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{09AC50A5-0354-479b-8961-EDA2CE7AC002}"));
  76. fRegKeyDelete(TEXT("SOFTWARE\\Microsoft\\Active Setup\\Installed Components\\{0101E65E-8C15-4551-8455-D2CC10FBEA01}"));
  77. }
  78. }
  79. #endif // DBG