Source code of Windows XP (NT5)
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.

164 lines
4.1 KiB

  1. // SvcUtils.h
  2. #include "stdutils.h" // FCompareMachineNames
  3. // Help file for filemgmt.dll
  4. const TCHAR g_szHelpFileFilemgmt[] = _T("filemgmt.hlp"); // Not subject to localization
  5. // This enumeration should not be changed unless the string resources
  6. // and all the array indices updated.
  7. enum
  8. {
  9. iServiceActionNil = -1,
  10. iServiceActionStart, // Start service
  11. iServiceActionStop, // Stop service
  12. iServiceActionPause, // Pause service
  13. iServiceActionResume, // Resume service
  14. iServiceActionRestart, // Stop and Start service
  15. iServiceActionMax // Must be last
  16. };
  17. /////////////////////////////////////////////////////////////////////
  18. // String szAbend
  19. // This string is used for the 'Service Failure Recovery' dialog
  20. // to append the 'Fail Count' to the command line. This string
  21. // is not localized, so it should not be moved into the
  22. // resources.
  23. //
  24. // NOTES
  25. // The variable should be renamed to reflect its content. Currently
  26. // 'abend' means 'fails'.
  27. const TCHAR szAbend[] = L" /fail=%1%";
  28. //
  29. // Service running state
  30. //
  31. extern CString g_strSvcStateStarted;
  32. extern CString g_strSvcStateStarting;
  33. extern CString g_strSvcStateStopped;
  34. extern CString g_strSvcStateStopping;
  35. extern CString g_strSvcStatePaused;
  36. extern CString g_strSvcStatePausing;
  37. extern CString g_strSvcStateResuming;
  38. //
  39. // Service startup type
  40. //
  41. extern CString g_strSvcStartupBoot;
  42. extern CString g_strSvcStartupSystem;
  43. extern CString g_strSvcStartupAutomatic;
  44. extern CString g_strSvcStartupManual;
  45. extern CString g_strSvcStartupDisabled;
  46. //
  47. // Service startup account
  48. // JonN 188203 11/13/00
  49. //
  50. extern CString g_strLocalSystem;
  51. extern CString g_strLocalService;
  52. extern CString g_strNetworkService;
  53. extern CString g_strUnknown;
  54. extern CString g_strLocalMachine;
  55. void Service_LoadResourceStrings();
  56. LPCTSTR Service_PszMapStateToName(DWORD dwServiceState, BOOL fLongString = FALSE);
  57. // -1L is blank string
  58. LPCTSTR Service_PszMapStartupTypeToName(DWORD dwStartupType);
  59. // JonN 11/14/00 188203 support LocalService/NetworkService
  60. LPCTSTR Service_PszMapStartupAccountToName(LPCTSTR pcszStartupAccount);
  61. BOOL Service_FGetServiceButtonStatus(
  62. SC_HANDLE hScManager,
  63. CONST TCHAR * pszServiceName,
  64. OUT BOOL rgfEnableButton[iServiceActionMax],
  65. OUT DWORD * pdwCurrentState = NULL,
  66. BOOL fSilentError = FALSE);
  67. void Service_SplitCommandLine(
  68. LPCTSTR pszFullCommand,
  69. CString * pstrBinaryPath,
  70. CString * pstrParameters,
  71. BOOL * pfAbend = NULL);
  72. void Service_UnSplitCommandLine(
  73. CString * pstrFullCommand,
  74. LPCTSTR pszBinaryPath,
  75. LPCTSTR pszParameters);
  76. void GetMsg(OUT CString& strMsg, DWORD dwErr, UINT wIdString = 0, ...);
  77. // title is "Shared Folders"
  78. INT DoErrMsgBox(HWND hwndParent, UINT uType, DWORD dwErr, UINT wIdString = 0, ...);
  79. // title is "Services"
  80. INT DoServicesErrMsgBox(HWND hwndParent, UINT uType, DWORD dwErr, UINT wIdString = 0, ...);
  81. BOOL UiGetUser(
  82. HWND hwndOwner,
  83. BOOL fIsContainer,
  84. LPCTSTR pszServerName,
  85. IN OUT CString& strrefUser);
  86. // Help Support
  87. #define HELP_DIALOG_TOPIC(DialogName) g_aHelpIDs_##DialogName
  88. BOOL DoHelp(LPARAM lParam, const DWORD rgzHelpIDs[]);
  89. BOOL DoContextHelp(WPARAM wParam, const DWORD rgzHelpIDs[]);
  90. #ifdef SNAPIN_PROTOTYPER
  91. /////////////////////////////////////////////////////////////////////
  92. /////////////////////////////////////////////////////////////////////
  93. class CStringIterator
  94. {
  95. private:
  96. CString m_strData; // Data string to parse
  97. CONST TCHAR * m_pszDataNext; // Pointer to the next data to parse
  98. public:
  99. CStringIterator()
  100. {
  101. m_pszDataNext = m_strData;
  102. }
  103. void SetString(CONST TCHAR * pszStringData)
  104. {
  105. m_strData = pszStringData;
  106. m_pszDataNext = m_strData;
  107. }
  108. BOOL FGetNextString(OUT CString& rStringOut)
  109. {
  110. Assert(m_pszDataNext != NULL);
  111. if (*m_pszDataNext == '\0')
  112. {
  113. rStringOut.Empty();
  114. return FALSE;
  115. }
  116. CONST TCHAR * pchStart = m_pszDataNext;
  117. while (*m_pszDataNext != '\0')
  118. {
  119. if (*m_pszDataNext == ';')
  120. {
  121. // HACK: Truncating the string
  122. *(TCHAR *)m_pszDataNext++ = '\0';
  123. break;
  124. }
  125. m_pszDataNext++;
  126. }
  127. rStringOut = pchStart; // Copy the string
  128. return TRUE;
  129. }
  130. }; // CStringIterator
  131. #endif // SNAPIN_PROTOTYPER