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.

117 lines
3.6 KiB

  1. // Copyright (c) 1999 Microsoft Corporation
  2. #ifndef __UPGRADE_H_
  3. #define __UPGRADE_H_
  4. #include <wbemidl.h>
  5. class CMultiString;
  6. class CString;
  7. #define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
  8. #define WINMGMT_DBCONVERT_NAME __TEXT("upgrade.imp")
  9. #define MAX_MSG_TITLE_LENGTH 255 //defined by Bakul for localization
  10. #define MAX_MSG_TEXT_LENGTH 1024 //defined by Bakul for localization
  11. #define INTERNAL_DATABASE_VERSION 9
  12. #define LANG_ID_STR_SIZE 5
  13. extern "C" char g_szLangId[LANG_ID_STR_SIZE];
  14. typedef struct
  15. {
  16. const char* pszMofFilename; //MOF filename
  17. int nInstallType; //Selection of InstallType items
  18. } MofDataTable;
  19. enum InstallType
  20. {
  21. Core = 1,
  22. MUI = 2
  23. };
  24. enum MsgType
  25. {
  26. MSG_INFO,
  27. MSG_WARNING,
  28. MSG_ERROR,
  29. MSG_NTSETUPERROR
  30. };
  31. enum
  32. {
  33. no_error,
  34. failed,
  35. critical_error,
  36. out_of_memory
  37. };
  38. template<class T>
  39. class CDeleteMe
  40. {
  41. protected:
  42. T* m_p;
  43. public:
  44. CDeleteMe(T* p = NULL) : m_p(p){}
  45. ~CDeleteMe() {delete m_p;}
  46. // overwrites the previous pointer, does NOT delete it
  47. void operator= (T* p) {m_p = p;}
  48. };
  49. template<class T>
  50. class CVectorDeleteMe
  51. {
  52. protected:
  53. T* m_p;
  54. T** m_pp;
  55. public:
  56. CVectorDeleteMe(T* p) : m_p(p), m_pp(NULL){}
  57. CVectorDeleteMe(T** pp) : m_p(NULL), m_pp(pp){}
  58. ~CVectorDeleteMe() {if(m_p) delete [] m_p; else if(m_pp) delete [] *m_pp;}
  59. };
  60. typedef void (WINAPI *ESCDOOR_BEFORE_MOF_COMPILATION) ();
  61. typedef void (WINAPI *ESCDOOR_AFTER_MOF_COMPILATION) ();
  62. void CallEscapeRouteAfterMofCompilation();
  63. void CallEscapeRouteBeforeMofCompilation();
  64. void ClearWMISetupRegValue();
  65. bool CopyMultiString(CMultiString &mszFrom, CMultiString &mszTo);
  66. void DeleteMMFRepository();
  67. bool DoConvertRepository();
  68. bool DoCoreUpgrade(int nInstallType=1);
  69. bool DoWDMNamespaceInit();
  70. bool DoesFSRepositoryExist();
  71. bool DoesMMFRepositoryExist();
  72. bool DoMofLoad(wchar_t* pComponentName, CMultiString& mszSystemMofs);
  73. bool EnableESS();
  74. bool ExtractPathAndFilename(const char *pszFullPath, CString &path, CString &filename);
  75. bool FileExists(const char *pszFilename);
  76. char* GetFullFilename(const char *pszFilename, InstallType eInstallType=Core);
  77. bool GetMofList(const char* rgpszMofFilename[], CMultiString &mszMofs);
  78. bool GetNewMofLists(const char *pszMofList, CMultiString &mszSystemMofs, CMultiString &mszOtherMofs, CString &szMissingMofs);
  79. HRESULT GetRepositoryDirectory(wchar_t wszRepositoryDirectory[MAX_PATH+1]);
  80. bool GetStandardMofs(CMultiString &mszSystemMofs, int nCurInstallType);
  81. bool IsStandardMof(CMultiString &mszStandardMofList, const char* pszMofFile);
  82. bool LoadMofList(IWbemContext *, IWinmgmtMofCompiler * pCompiler, const char *mszMofs, CString &szMOFsWhichFailedToLoad, long lOptionFlags = WBEM_FLAG_CONNECT_REPOSITORY_ONLY | WBEM_FLAG_DONT_ADD_TO_LIST, long lClassFlags = WBEM_FLAG_UPDATE_FORCE_MODE);
  83. void LogMessage(MsgType msgType, const char *pszMessage);
  84. void LogSetupError(const char *pszMessage);
  85. void RecordFileVersion();
  86. void SetWBEMBuildRegValue();
  87. void ShutdownWinMgmt();
  88. bool UpgradeAutoRecoveryRegistry(CMultiString &mszSystemMofs, CMultiString &mszExternalMofList, CString &szMissingMofs);
  89. bool UpgradeRepository();
  90. bool WipeOutAutoRecoveryRegistryEntries();
  91. bool WriteBackAutoRecoveryMofs(CMultiString &mszSystemMofs, CMultiString &mszExternalMofList);
  92. HRESULT MoveRepository();
  93. extern HRESULT UpdateServiceSecurity () ;
  94. extern HRESULT CheckForServiceSecurity () ;
  95. #ifdef _X86_
  96. bool RemoveOldODBC();
  97. #endif
  98. #endif // __UPGRADE_H_