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.

138 lines
5.3 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. OptCom.cpp
  5. Abstract:
  6. Base Class for optional component work.
  7. Author:
  8. Rohde Wakefield [rohde] 09-Oct-1997
  9. Revision History:
  10. --*/
  11. #ifndef _OPTCOM_H
  12. #define _OPTCOM_H
  13. #pragma once
  14. class CRsOptCom
  15. {
  16. public:
  17. CRsOptCom();
  18. virtual ~CRsOptCom();
  19. DWORD
  20. SetupProc(
  21. IN LPCVOID ComponentId,
  22. IN LPCVOID SubcomponentId,
  23. IN UINT Function,
  24. IN UINT_PTR Param1,
  25. IN OUT PVOID Param2
  26. );
  27. virtual DWORD PreInitialize( IN DWORD Flags );
  28. virtual DWORD InitComponent( IN PSETUP_INIT_COMPONENT SetupInitComponent );
  29. virtual SubComponentState DetectInitialState( IN SHORT SubcomponentId );
  30. virtual SubComponentState QueryState( IN SHORT SubcomponentId );
  31. virtual BOOL SetLanguage( WORD LangId );
  32. virtual HBITMAP QueryImage( IN SHORT SubcomponentId, IN SubComponentInfo WhichImage, IN WORD Width, IN WORD Height );
  33. virtual BOOL QueryImageEx( IN SHORT SubcomponentId, IN OC_QUERY_IMAGE_INFO *pQueryImageInfo, OUT HBITMAP *phBitmap );
  34. virtual LONG RequestPages( IN WizardPagesType Type, IN OUT PSETUP_REQUEST_PAGES RequestPages );
  35. virtual BOOL QuerySkipPage( IN OcManagerPage Page );
  36. virtual BOOL QueryChangeSelState( IN SHORT SubcomponentId, IN BOOL NewState, IN DWORD Flags );
  37. virtual DWORD CalcDiskSpace( IN SHORT SubcomponentId, IN BOOL AddSpace, IN HDSKSPC hDiskSpace );
  38. virtual DWORD QueueFileOps( IN SHORT SubcomponentId, IN HSPFILEQ hFileQueue );
  39. virtual LONG QueryStepCount( IN SHORT SubcomponentId );
  40. virtual DWORD AboutToCommitQueue( IN SHORT SubcomponentId );
  41. virtual DWORD CompleteInstallation( IN SHORT SubcomponentId );
  42. virtual void CleanUp( void );
  43. //
  44. // Maps from string to constant ID and back
  45. //
  46. virtual SHORT IdFromString( LPCTSTR SubcomponentId ) = 0;
  47. virtual LPCTSTR StringFromId( SHORT SubcomponentId ) = 0;
  48. //
  49. // Helper functions to wrap functionality
  50. //
  51. DWORD DoCalcDiskSpace( IN BOOL AddSpace, IN HDSKSPC hDiskSpace, IN LPCTSTR SectionName );
  52. DWORD DoQueueFileOps( IN SHORT SubcomponentId, IN HSPFILEQ hFileQueue, IN LPCTSTR InstallSectionName, IN LPCTSTR UninstallSectionName );
  53. DWORD DoRegistryOps( IN SHORT SubcomponentId, IN RSOPTCOM_ACTION actionForReg, IN LPCTSTR SectionName );
  54. LPCWSTR StringFromFunction( UINT Function );
  55. LPCWSTR StringFromPageType( WizardPagesType PageType );
  56. LPCWSTR StringFromAction( RSOPTCOM_ACTION );
  57. RSOPTCOM_ACTION GetSubAction( SHORT SubcomponentId );
  58. HRESULT CreateLink( LPCTSTR lpszProgram, LPCTSTR lpszArgs, LPTSTR lpszLink, LPCTSTR lpszDir, LPCTSTR lpszDesc,
  59. int nItemDescId, int nDescId, LPCTSTR lpszIconPath, int iIconIndex );
  60. BOOL DeleteLink( LPTSTR lpszShortcut );
  61. HRESULT GetGroupPath( int nFolder, LPTSTR szPath );
  62. void AddItem( int nFolder, LPCTSTR szItemDesc, LPCTSTR szProgram, LPCTSTR szArgs, LPCTSTR szDir, LPCTSTR szDesc,
  63. int nItemDescId, int nDescId, LPCTSTR szIconPath = 0, int iIconIndex = 0 );
  64. void DeleteItem( int nFolder, LPCTSTR szAppName );
  65. typedef HRESULT (WINAPI *PFN_DLLENTRYPOINT)( void );
  66. HRESULT CallDllEntryPoint( LPCTSTR pszDLLName, LPCSTR pszEntryPoint );
  67. //
  68. // Information for SETUP_INIT_COMPONENT
  69. //
  70. UINT m_OCManagerVersion;
  71. UINT m_ComponentVersion;
  72. HINF m_OCInfHandle;
  73. HINF m_ComponentInfHandle;
  74. SETUP_DATA m_SetupData;
  75. OCMANAGER_ROUTINES m_HelperRoutines;
  76. //
  77. // Quick access to manager routines
  78. //
  79. void TickGauge( void )
  80. { m_HelperRoutines.TickGauge( m_HelperRoutines.OcManagerContext ); };
  81. void SetProgressText( IN LPCTSTR Text )
  82. { m_HelperRoutines.SetProgressText( m_HelperRoutines.OcManagerContext, Text ); };
  83. void SetPrivateData( IN LPTSTR Name, PVOID Data, IN UINT Size, IN UINT Type )
  84. { m_HelperRoutines.SetPrivateData( m_HelperRoutines.OcManagerContext, Name, Data, Size, Type ); };
  85. UINT GetPrivateData( IN SHORT SubcomponentId OPTIONAL, IN LPTSTR Name, PVOID Data OPTIONAL, IN OUT PUINT pSize, OUT PUINT pType )
  86. { return m_HelperRoutines.GetPrivateData( m_HelperRoutines.OcManagerContext, StringFromId( SubcomponentId ), Name, Data, pSize, pType ); };
  87. UINT SetSetupMode( IN DWORD SetupMode )
  88. { return m_HelperRoutines.SetSetupMode( m_HelperRoutines.OcManagerContext, SetupMode ); };
  89. UINT GetSetupMode( void )
  90. { return m_HelperRoutines.GetSetupMode( m_HelperRoutines.OcManagerContext ); };
  91. BOOL QuerySelectionState( IN SHORT SubcomponentId, IN UINT StateType )
  92. { return m_HelperRoutines.QuerySelectionState( m_HelperRoutines.OcManagerContext, StringFromId( SubcomponentId ), StateType ); };
  93. BOOL ConfirmCancel( IN HWND ParentWindow )
  94. { return m_HelperRoutines.ConfirmCancelRoutine( ParentWindow ); };
  95. HWND QueryWizardDialogHandle( void )
  96. { return m_HelperRoutines.QueryWizardDialogHandle( m_HelperRoutines.OcManagerContext ); };
  97. BOOL SetReboot( void )
  98. { return m_HelperRoutines.SetReboot( m_HelperRoutines.OcManagerContext, FALSE ); };
  99. };
  100. #endif