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.

129 lines
2.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: N C M I S C . H
  7. //
  8. // Contents: Miscellaneious common code.
  9. //
  10. // Notes: Pollute this under penalty of death.
  11. //
  12. // Author: shaunco 10 Oct 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _NCMISC_H_
  17. #define _NCMISC_H_
  18. #include "ncdebug.h" // for AssertH
  19. #include "ncdefine.h" // for NOTHROW
  20. const WORD wWinNT351BuildNumber = 1057;
  21. const WORD wWinNT4BuildNumber = 1381;
  22. #define WM_SELECTED_ALL WM_USER+200
  23. //+---------------------------------------------------------------------------
  24. // CExceptionSafeLock takes advantage of automatic constructor/destructor
  25. // action guaranteed by the compiler (if stack unwinding is turned on)
  26. // to always ensure that a critical section is left if it has ever been
  27. // entered. The constructor of this class enters the critical section
  28. // and destructor leaves it. The critical section must have been initialized
  29. // before this class can be used.
  30. //
  31. class CExceptionSafeLock
  32. {
  33. public:
  34. CExceptionSafeLock (CRITICAL_SECTION* pCritSec)
  35. {
  36. AssertH (pCritSec);
  37. m_pCritSec = pCritSec;
  38. EnterCriticalSection (pCritSec);
  39. //TraceTag (ttidEsLock, "Entered critical section 0x%08x", pCritSec);
  40. }
  41. ~CExceptionSafeLock ()
  42. {
  43. AssertH (m_pCritSec);
  44. //TraceTag (ttidEsLock, "Leaving critical section 0x%08x", &m_pCritSec);
  45. LeaveCriticalSection (m_pCritSec);
  46. }
  47. protected:
  48. CRITICAL_SECTION* m_pCritSec;
  49. };
  50. BOOL
  51. FInSystemSetup ();
  52. #if defined(REMOTE_BOOT)
  53. HRESULT HrIsRemoteBootMachine();
  54. #endif
  55. enum PRODUCT_FLAVOR
  56. {
  57. PF_WORKSTATION = 1,
  58. PF_SERVER = 2,
  59. };
  60. NOTHROW
  61. VOID
  62. GetProductFlavor (
  63. const VOID* pvReserved,
  64. PRODUCT_FLAVOR* ppf);
  65. HRESULT
  66. HrIsNetworkingInstalled ();
  67. enum REGISTER_FUNCTION
  68. {
  69. RF_REGISTER,
  70. RF_UNREGISTER,
  71. };
  72. HRESULT
  73. HrRegisterOrUnregisterComObject (
  74. PCWSTR pszDllPath,
  75. REGISTER_FUNCTION rf);
  76. inline
  77. HRESULT
  78. HrRegisterComObject (
  79. PCWSTR pszDllPath)
  80. {
  81. HRESULT hr = HrRegisterOrUnregisterComObject (pszDllPath, RF_REGISTER);
  82. TraceError("HrRegisterComObject", hr);
  83. return hr;
  84. }
  85. inline
  86. HRESULT
  87. HrUnregisterComObject (
  88. PCWSTR pszDllPath)
  89. {
  90. HRESULT hr = HrRegisterOrUnregisterComObject (pszDllPath, RF_UNREGISTER);
  91. TraceError("HrUnregisterComObject", hr);
  92. return hr;
  93. }
  94. DWORD
  95. ScStopNetbios();
  96. HRESULT HrEnableAndStartSpooler();
  97. HRESULT HrCreateDirectoryTree(PWSTR pszPath, LPSECURITY_ATTRIBUTES psa);
  98. HRESULT HrDeleteFileSpecification(PCWSTR pszFileSpec,
  99. PCWSTR pszDirectoryPath);
  100. HRESULT HrDeleteDirectory(IN PCWSTR pszDir,
  101. IN BOOL fContinueOnError);
  102. VOID LowerCaseComputerName(PWSTR szName);
  103. #endif // _NCMISC_H_