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.

71 lines
1.9 KiB

  1. //-----------------------------------------------------------------------------------------
  2. #include "assert.h"
  3. #include "ocmcallback.h"
  4. OCMANAGER_ROUTINES COCMCallback::m_OCMRoutines;
  5. bool COCMCallback::m_bInitialized = false;
  6. //-----------------------------------------------------------------------------------------
  7. // capture the struct of OCM callback funtion pointers
  8. void COCMCallback::SetOCMRoutines( POCMANAGER_ROUTINES pOCMRoutines )
  9. {
  10. m_OCMRoutines = *pOCMRoutines;
  11. m_bInitialized = true;
  12. }
  13. //-----------------------------------------------------------------------------------------
  14. // set the text on the OCM progress dialog
  15. void COCMCallback::SetProgressText( LPCTSTR szText )
  16. {
  17. if( m_bInitialized )
  18. m_OCMRoutines.SetProgressText( m_OCMRoutines.OcManagerContext, szText );
  19. }
  20. //-----------------------------------------------------------------------------------------
  21. // advances the OCM progress bar by 1 tick count
  22. void COCMCallback::AdvanceTickGauge()
  23. {
  24. if( m_bInitialized )
  25. m_OCMRoutines.TickGauge( m_OCMRoutines.OcManagerContext );
  26. }
  27. //-----------------------------------------------------------------------------------------
  28. // tells the OCM that a reboot is needed
  29. void COCMCallback::SetReboot()
  30. {
  31. if( m_bInitialized )
  32. m_OCMRoutines.SetReboot( m_OCMRoutines.OcManagerContext, NULL );
  33. }
  34. //-----------------------------------------------------------------------------------------
  35. // ask the OCM for the current selection state of the component
  36. DWORD COCMCallback::QuerySelectionState( LPCTSTR szSubcomponentName, bool &bSelected )
  37. {
  38. if( !m_bInitialized )
  39. {
  40. assert( false );
  41. return false;
  42. }
  43. BOOL bRet = m_OCMRoutines.QuerySelectionState(
  44. m_OCMRoutines.OcManagerContext,
  45. szSubcomponentName,
  46. OCSELSTATETYPE_CURRENT );
  47. if( bRet )
  48. {
  49. bSelected = true;
  50. return ERROR_SUCCESS;
  51. }
  52. else
  53. {
  54. bSelected = false;
  55. return GetLastError();
  56. }
  57. }