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.

260 lines
9.0 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. process.h
  5. Abstract:
  6. Definition of the process class
  7. Author:
  8. Vishnu Patankar (VishnuP) - Oct 2001
  9. Environment:
  10. User mode only.
  11. Exported Functions:
  12. Revision History:
  13. Created - Oct 2001
  14. --*/
  15. #if !defined(AFX_PROCESS_H__139D0BA5_19A7_4AA2_AE2C_E18A5FFAAA0F__INCLUDED_)
  16. #define AFX_PROCESS_H__139D0BA5_19A7_4AA2_AE2C_E18A5FFAAA0F__INCLUDED_
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif // _MSC_VER > 1000
  20. #include "resource.h" // main symbols
  21. #include "..\te\obj\i386\ssrte.h"
  22. #include <windows.h>
  23. #include <comdef.h>
  24. #include <atlbase.h>
  25. /////////////////////////////////////////////////////////////////////////////
  26. // process
  27. class process :
  28. public IDispatchImpl<Iprocess, &IID_Iprocess, &LIBID_KBPROCLib>,
  29. public ISupportErrorInfo,
  30. public CComObjectRoot,
  31. public CComCoClass<process,&CLSID_process>
  32. {
  33. public:
  34. process() {
  35. m_bDbg = FALSE;
  36. m_pSsrLogger = NULL;
  37. m_pXMLError = NULL;
  38. m_hScm = NULL;
  39. m_dwNumServices = 0;
  40. m_bArrServiceInKB = NULL;
  41. m_pInstalledServicesInfo = NULL;
  42. }
  43. ~process() {
  44. SsrpCleanup();
  45. }
  46. BEGIN_COM_MAP(process)
  47. COM_INTERFACE_ENTRY(IDispatch)
  48. COM_INTERFACE_ENTRY(Iprocess)
  49. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  50. END_COM_MAP()
  51. //DECLARE_NOT_AGGREGATABLE(process)
  52. // Remove the comment from the line above if you don't want your object to
  53. // support aggregation.
  54. DECLARE_REGISTRY_RESOURCEID(IDR_process)
  55. // ISupportsErrorInfo
  56. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  57. // Iprocess
  58. public:
  59. //
  60. // data values used across most processor methods
  61. //
  62. BOOL m_bDbg;
  63. CComPtr <ISsrLog> m_pSsrLogger;
  64. CComPtr <IXMLDOMParseError> m_pXMLError;
  65. SC_HANDLE m_hScm;
  66. DWORD m_dwNumServices;
  67. DWORD *m_bArrServiceInKB;
  68. LPENUM_SERVICE_STATUS_PROCESS m_pInstalledServicesInfo;
  69. //
  70. // processor methods
  71. //
  72. STDMETHOD(preprocess) (BSTR pszKbFile,
  73. BSTR pszUIFile,
  74. BSTR pszKbMode,
  75. BSTR pszLogFile,
  76. BSTR pszMachineName,
  77. VARIANT vtFeedback);
  78. HRESULT SsrpCprocess(IN BSTR pszKbDir,
  79. IN BSTR pszUIFile,
  80. IN BSTR pszKbMode,
  81. IN BSTR pszLogFile,
  82. IN BSTR pszMachineName,
  83. IN VARIANT vtFeedback);
  84. //
  85. // utility methods
  86. //
  87. VOID SsrpCleanup();
  88. VOID SsrpLogParseError(IN HRESULT hr);
  89. VOID SsrpLogWin32Error(IN DWORD rc);
  90. VOID SsrpLogError(IN PWSTR pszError);
  91. BOOL SsrpIsServiceInstalled(IN BSTR bstrService);
  92. VOID SsrpConvertBstrToPwstr(IN OUT BSTR bstrString);
  93. HRESULT SsrpDeleteChildren( IN CComPtr <IXMLDOMNode> pParent);
  94. HRESULT SsrpDeleteComments(IN CComPtr <IXMLDOMElement> pParent);
  95. DWORD SsrpQueryInstalledServicesInfo(IN PWSTR pszMachineName);
  96. DWORD SsrpQueryServiceDescription(IN PWSTR pszServiceName,
  97. OUT LPSERVICE_DESCRIPTION *ppServiceDescription);
  98. PWSTR SsrpQueryServiceDisplayName(IN BSTR bstrService);
  99. int SsrpICompareBstrPwstr(IN BSTR bstrString, IN PWSTR pszString);
  100. HRESULT SsrpCloneAllChildren(IN CComPtr <IXMLDOMDocument> pXMLDocSource,
  101. IN CComPtr <IXMLDOMDocument> pXMLDocDestination);
  102. HRESULT SsrpAddWhiteSpace(IN CComPtr <IXMLDOMDocument> pXMLDoc,
  103. IN CComPtr <IXMLDOMNode> pXMLParent,
  104. IN BSTR bstrWhiteSpace);
  105. HRESULT SsrpGetRemoteOSVersionInfo(IN PWSTR pszMachineName,
  106. OUT OSVERSIONINFOEX *posVersionInfo);
  107. //
  108. // methods to process roles, tasks and services
  109. //
  110. HRESULT SsrpCreatePreprocessorSection(IN CComPtr<IXMLDOMElement> pXMLDocElemRoot,
  111. IN CComPtr<IXMLDOMDocument> pXMLDocIn,
  112. IN PWSTR pszKbMode,
  113. IN PWSTR pszKbFile);
  114. HRESULT SsrpProcessRolesOrTasks(IN PWSTR pszMachineName,
  115. IN CComPtr<IXMLDOMElement> pXMLDocElemRoot,
  116. IN CComPtr<IXMLDOMDocument> pXMLDoc,
  117. IN PWSTR pszKbMode,
  118. IN BOOL bRole);
  119. HRESULT SsrpProcessTasks(IN CComPtr<IXMLDOMElement> pXMLDocElemRoot,
  120. IN CComPtr<IXMLDOMDocument> pXMLDoc,
  121. IN PWSTR pszKbMode
  122. );
  123. HRESULT SsrpProcessService( IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  124. IN CComPtr <IXMLDOMNode> pXMLServiceNode,
  125. IN PWSTR pszMode,
  126. OUT BOOL *pbRoleIsSatisfiable,
  127. OUT BOOL *pbSomeRequiredServiceDisabled);
  128. HRESULT SsrpAddExtraServices( IN CComPtr <IXMLDOMDocument> pXMLDoc,
  129. IN CComPtr <IXMLDOMNode> pRolesNode);
  130. HRESULT SsrpAddOtherRole( IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  131. IN CComPtr <IXMLDOMDocument> pXMLDoc);
  132. HRESULT SsrpAddUnknownSection( IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  133. IN CComPtr <IXMLDOMDocument> pXMLDoc);
  134. HRESULT SsrpAddServiceStartup(IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  135. IN CComPtr <IXMLDOMDocument> pXMLDoc
  136. );
  137. HRESULT SsrpAddUnknownServicesInfoToServiceLoc(IN CComPtr <IXMLDOMElement> pElementRoot,
  138. IN CComPtr <IXMLDOMDocument> pXMLDoc
  139. );
  140. HRESULT SsrpAddUnknownServicestoServices(IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  141. IN CComPtr <IXMLDOMDocument> pXMLDoc
  142. );
  143. //
  144. // extension KBs merge methods
  145. //
  146. HRESULT SsrpProcessKBsMerge(IN PWSTR pszKBDir,
  147. IN PWSTR pszMachineName,
  148. OUT IXMLDOMElement **ppElementRoot,
  149. OUT IXMLDOMDocument **ppXMLDoc
  150. );
  151. HRESULT SsrpMergeDOMTrees(OUT IXMLDOMElement **ppMergedKBElementRoot,
  152. OUT IXMLDOMDocument **ppMergedKBXMLDoc,
  153. IN WCHAR *szXMLFileName
  154. );
  155. HRESULT SsrpMergeAccordingToPrecedence(IN PWSTR pszKBType,
  156. IN PWSTR pszKBDir,
  157. OUT IXMLDOMElement **ppElementRoot,
  158. OUT IXMLDOMDocument **ppXMLDoc,
  159. IN IXMLDOMNode *pKB
  160. );
  161. HRESULT SsrpAppendOrReplaceMergeableEntities(IN PWSTR pszFullyQualifiedEntityName,
  162. IN IXMLDOMElement *pMergedKBElementRoot,
  163. IN IXMLDOMDocument *pMergedKBXMLDoc,
  164. IN IXMLDOMDocument *pCurrentKBDoc,
  165. IN IXMLDOMElement *pCurrentKBElemRoot,
  166. IN PWSTR pszKBName
  167. );
  168. HRESULT SsrpOverwriteServiceLocalizationFromSystem(IN IXMLDOMElement *pMergedKBElementRoot,
  169. IN IXMLDOMDocument *pMergedKBXMLDoc
  170. );
  171. //
  172. // methods to evaluate role/service conditionals
  173. //
  174. DWORD SsrpEvaluateCustomFunction(IN PWSTR pszMachineName,
  175. IN BSTR bstrDLLName,
  176. IN BSTR bstrFunctionName,
  177. OUT BOOL *pbSelect);
  178. HRESULT SsrpCheckIfOptionalService(IN CComPtr <IXMLDOMElement> pXMLDocElemRoot,
  179. IN BSTR bstrServiceName,
  180. IN BOOL *pbOptional);
  181. DWORD SsrpQueryServiceStartupType(IN PWSTR pszServiceName,
  182. OUT BYTE *pbyStartupType);
  183. };
  184. #endif // !defined(AFX_PROCESS_H__139D0BA5_19A7_4AA2_AE2C_E18A5FFAAA0F__INCLUDED_)