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.

180 lines
4.9 KiB

  1. // stdafx.h : include file for standard system include files,
  2. // or project specific include files that are used frequently,
  3. // but are changed infrequently
  4. #ifndef __STDAFX_H__
  5. #define __STDAFX_H__
  6. #include <afxwin.h>
  7. #include <afxdisp.h>
  8. #include <afxtempl.h>
  9. #include <afxdlgs.h>
  10. #include <afxcmn.h>
  11. #include <afxmt.h> // CCriticalSection
  12. #include <winsvc.h>
  13. #include <atlbase.h>
  14. //You may derive a class from CComModule and use it if you want to override
  15. //something, but do not change the name of _Module
  16. extern CComModule _Module;
  17. #include <atlcom.h>
  18. extern "C"
  19. {
  20. #include <lmcons.h>
  21. #include <lmshare.h>
  22. #include <lmerr.h>
  23. #include <lmapibuf.h>
  24. #include <macfile.h>
  25. #include <fpnwapi.h>
  26. // User browser stuff
  27. // We have to define _NTSEAPI_ since ntseapi.h conflicts with winnt.h
  28. #define _NTSEAPI_
  29. #include <getuser.h> // OpenUserBrowser()
  30. // Hardware profile stuff
  31. #include <regstr.h> // CSCONFIGFLAG_*
  32. #include <cfgmgr32.h> // CM_* APIs
  33. }
  34. #ifndef APIERR
  35. typedef DWORD APIERR; // Error code typically returned by ::GetLastError()
  36. #endif
  37. /////////////////////////////////////////////////////////////////////
  38. //
  39. // Handy macros
  40. //
  41. #define INOUT // Dummy macro
  42. #define IGNORED // Output parameter is ignored
  43. #define LENGTH(x) (sizeof(x)/sizeof(x[0]))
  44. #ifdef _DEBUG
  45. #define DebugCode(x) x
  46. #define GarbageInit(pv, cb) memset(pv, 'a', cb)
  47. #else
  48. #define DebugCode(x)
  49. #define GarbageInit(pv, cb)
  50. #endif
  51. /////////////////////////////////////////////////////////////////////
  52. // Macro Endorse()
  53. //
  54. // This macro is mostly used when validating parameters.
  55. // Some parameters are allowed to be NULL because they are optional
  56. // or simply because the interface uses the NULL case as a valid
  57. // input parameter. In this case the Endorse() macro is used to
  58. // acknowledge the validity of such a parameter.
  59. //
  60. // REMARKS
  61. // This macro is the opposite of Assert().
  62. //
  63. // EXAMPLE
  64. // Endorse(p == NULL); // Code acknowledge p == NULL to not be (or not cause) an error
  65. //
  66. #define Endorse(x)
  67. /////////////////////////////////////////////////////////////////////
  68. #define Assert(x) ASSERT(x)
  69. /////////////////////////////////////////////////////////////////////
  70. // Report is an unsual situation. This is somewhat similar
  71. // to an assert but does not always represent a code bug.
  72. // eg: Unable to load an icon.
  73. #define Report(x) ASSERT(x) // Currently defined as an assert because I don't have time to rewrite another macro
  74. /////////////////////////////////////////////////////////////////////
  75. #include "dbg.h"
  76. #include "mmc.h"
  77. #include <comptr.h>
  78. //#define SNAPIN_PROTOTYPER // Build a snapin prototyper dll instead of FILEMGMT dll
  79. EXTERN_C const CLSID CLSID_FileServiceManagement;
  80. EXTERN_C const CLSID CLSID_SystemServiceManagement;
  81. EXTERN_C const CLSID CLSID_FileServiceManagementExt;
  82. EXTERN_C const CLSID CLSID_SystemServiceManagementExt;
  83. EXTERN_C const CLSID CLSID_FileServiceManagementAbout;
  84. EXTERN_C const CLSID CLSID_SystemServiceManagementAbout;
  85. EXTERN_C const CLSID CLSID_SvcMgmt;
  86. EXTERN_C const IID IID_ISvcMgmtStartStopHelper;
  87. #ifdef SNAPIN_PROTOTYPER
  88. EXTERN_C const CLSID CLSID_SnapinPrototyper;
  89. #endif
  90. #include "regkey.h" // class AMC::CRegKey
  91. /*
  92. // The following defines are required by the framework
  93. #define STD_COOKIE_TYPE CFileMgmtCookie
  94. #define STD_NODETYPE_ENUM FileMgmtObjectType
  95. #define STD_NODETYPE_DEFAULT FILEMGMT_ROOT
  96. #define STD_NODETYPE_NUMTYPES FILEMGMT_NUMTYPES
  97. #define STD_MAX_COLUMNS 7
  98. // CODEWORK are the following ones necessary?
  99. #define STD_COMPONENT_CLASS CFileMgmtComponent
  100. #define STD_COMPONENTDATA_TYPE CFileMgmtComponentData
  101. */
  102. // Property sheet include files
  103. #include "resource.h"
  104. #include "filemgmt.h" // CLSID_SvcMgmt, ISvcMgmtStartStopHelper
  105. #include "SvcProp.h"
  106. #include "SvcProp1.h"
  107. #include "SvcProp2.h"
  108. #include "SvcProp3.h"
  109. #include "SvcUtils.h"
  110. #include "Utils.h"
  111. #include "svchelp.h" // Help IDs
  112. #include "guidhelp.h" // ExtractObjectTypeGUID(), ExtractString()
  113. #include "nodetype.h" // FileMgmtObjectType
  114. #include <shfusion.h>
  115. class CThemeContextActivator
  116. {
  117. public:
  118. CThemeContextActivator() : m_ulActivationCookie(0)
  119. { SHActivateContext (&m_ulActivationCookie); }
  120. ~CThemeContextActivator()
  121. { SHDeactivateContext (m_ulActivationCookie); }
  122. private:
  123. ULONG_PTR m_ulActivationCookie;
  124. };
  125. #ifdef UNICODE
  126. #define PROPSHEETPAGE_V3 PROPSHEETPAGEW_V3
  127. #else
  128. #define PROPSHEETPAGE_V3 PROPSHEETPAGEA_V3
  129. #endif
  130. HPROPSHEETPAGE MyCreatePropertySheetPage(AFX_OLDPROPSHEETPAGE* psp);
  131. #if _WIN32_IE < 0x0400
  132. // We #define ILCreateFromPath to our wrapper so that we can run on
  133. // both NT4 and NT5, since it was a TCHAR export in NT4 and an xxxA/xxxW
  134. // export in NT5
  135. #undef ILCreateFromPath
  136. #define ILCreateFromPath Wrap_ILCreateFromPath
  137. #endif
  138. #define RETURN_HR_IF_FAIL if (FAILED(hr)) { ASSERT(FALSE); return hr; }
  139. #define RETURN_FALSE_IF_FAIL if (FAILED(hr)) { ASSERT(FALSE); return FALSE; }
  140. #define RETURN_E_FAIL_IF_NULL(p) if (NULL == p) { ASSERT(FALSE); return E_FAIL; }
  141. #endif // ~__STDAFX_H__