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.

106 lines
3.3 KiB

  1. #ifndef __TDCTINSTALL_H__
  2. #define __TDCTINSTALL_H__
  3. /*---------------------------------------------------------------------------
  4. File: TDCTInstall.h
  5. Comments: Utility class to install a service.
  6. Current implementation is specific to the DCT service.
  7. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  8. Proprietary and confidential to Mission Critical Software, Inc.
  9. REVISION LOG ENTRY
  10. Revision By: Christy Boles
  11. Revised on 02/18/99 11:32:21
  12. ---------------------------------------------------------------------------
  13. */
  14. #include "EaLen.hpp"
  15. #include "Common.hpp"
  16. #include "UString.hpp"
  17. class TDCTInstall
  18. {
  19. BOOL m_bDebugLogging;
  20. WCHAR m_sComputer[LEN_Computer];
  21. WCHAR m_sComputerSource[LEN_Computer];
  22. // Service-specific information
  23. WCHAR m_sDisplayName[200];
  24. WCHAR m_sServiceName[200];
  25. WCHAR m_sServiceAccount[LEN_Account];
  26. WCHAR m_sServiceAccountPassword[LEN_Password];
  27. WCHAR m_sDependencies[500];
  28. SC_HANDLE m_hScm; // SCM handle
  29. WCHAR m_sDirThis[32];
  30. WCHAR m_sExeName[200];
  31. DWORD m_StartType;
  32. public:
  33. TDCTInstall(
  34. WCHAR const * asComputer, // in -target computer name
  35. WCHAR const * srcComputer // in -source computer name
  36. )
  37. {
  38. m_bDebugLogging = FALSE;
  39. safecopy( m_sComputer, asComputer );
  40. safecopy( m_sComputerSource, srcComputer );
  41. m_sDisplayName[0] = L'\0';
  42. m_sServiceName[0] = L'\0';
  43. m_sServiceAccount[0] = L'\0';
  44. m_sServiceAccountPassword[0] = L'\0';
  45. m_sDependencies[0] = L'\0';
  46. m_hScm = NULL;
  47. m_sDirThis[0] = L'\0';
  48. m_sExeName[0] = L'\0';
  49. m_StartType = SERVICE_DEMAND_START;
  50. }
  51. ~TDCTInstall()
  52. {
  53. ScmClose();
  54. }
  55. BOOL DebugLogging() { return m_bDebugLogging; }
  56. void DebugLogging(BOOL val) { m_bDebugLogging = val; }
  57. void SetServiceInformation(WCHAR const * displayName,
  58. WCHAR const * serviceName,
  59. WCHAR const * exeName,
  60. WCHAR const * dependencies,
  61. DWORD startType = SERVICE_DEMAND_START )
  62. {
  63. MCSASSERT(displayName && *displayName);
  64. MCSASSERT(serviceName && *serviceName);
  65. MCSASSERT(exeName && *exeName);
  66. safecopy(m_sDisplayName, displayName);
  67. safecopy(m_sServiceName, serviceName);
  68. safecopy(m_sExeName,exeName);
  69. safecopy(m_sDependencies, dependencies ? dependencies : L"");
  70. m_StartType = startType;
  71. }
  72. void SetServiceAccount(WCHAR const * account, WCHAR const * password)
  73. {
  74. safecopy(m_sServiceAccount, account ? account : L"" );
  75. safecopy(m_sServiceAccountPassword, password ? password : L"" );
  76. }
  77. void SourceDir(WCHAR const * dir) { safecopy(m_sDirThis,dir); }
  78. DWORD ScmOpen(BOOL bSilent = FALSE);
  79. void ScmClose();
  80. DWORD ServiceStart();
  81. void ServiceStop();
  82. };
  83. #endif //__TDCTINSTALL_H__