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.

303 lines
7.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: stdafx.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // stdafx.h : include file for standard system include files,
  11. // or project specific include files that are used frequently,
  12. // but are changed infrequently
  13. #ifndef __STDAFX_H__
  14. #define __STDAFX_H__
  15. // often, we have local variables for the express purpose of ASSERTion.
  16. // when compiling retail, those assertions disappear, leaving our locals
  17. // as unreferenced.
  18. #ifndef DBG
  19. #pragma warning (disable: 4189 4100)
  20. #endif // DBG
  21. // common utility macros
  22. #define RETURN_IF_FAILED(hr) if (FAILED(hr)) { return hr; }
  23. // C++ RTTI
  24. #include <typeinfo.h>
  25. #define IS_CLASS(x,y) ((x) && (x)->GetNodeType() == (y))
  26. // The IS_CLASS macro above uses the node types below to determine
  27. // the object class
  28. enum NODETYPE
  29. {
  30. GENERIC_UI_NODE,
  31. ROOT_UI_NODE,
  32. DS_UI_NODE,
  33. SAVED_QUERY_UI_NODE,
  34. FAVORITES_UI_NODE
  35. };
  36. #define STRICT
  37. #include <nt.h>
  38. #include <ntdef.h>
  39. #include <ntrtl.h>
  40. #include <nturtl.h>
  41. #define NT_INCLUDED
  42. #undef ASSERT
  43. #undef ASSERTMSG
  44. #define _ATL_NO_UUIDOF
  45. #define _USE_MFC
  46. #ifdef _USE_MFC
  47. #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
  48. #include <afxwin.h> // MFC core and standard components
  49. #include <afxext.h> // MFC extensions
  50. #include <afxtempl.h> // MFC Template classes
  51. #include <afxdlgs.h>
  52. #include <afxdisp.h> // MFC OLE Control Containment component
  53. #ifndef _AFX_NO_AFXCMN_SUPPORT
  54. #include <afxcmn.h> // MFC support for Windows 95 Common Controls
  55. #endif // _AFX_NO_AFXCMN_SUPPORT
  56. #endif
  57. // Theming
  58. #include <shfusion.h>
  59. ///////////////////////////////////////////
  60. // ASSERT's and TRACE's without debug CRT's
  61. #if defined (DBG)
  62. #if !defined (_DEBUG)
  63. #define _USE_DSA_TRACE
  64. #define _USE_DSA_ASSERT
  65. #define _USE_DSA_TIMER
  66. #endif
  67. #endif
  68. #include "dbg.h"
  69. ///////////////////////////////////////////
  70. #include <atlbase.h>
  71. //You may derive a class from CComModule and use it if you want to override
  72. //something, but do not change the name of _Module
  73. interface IADsPathname; // fwd decl
  74. class CThreadContext; // fwd decl
  75. class CDsAdminModule : public CComModule
  76. {
  77. public:
  78. CDsAdminModule()
  79. {
  80. }
  81. HRESULT WINAPI UpdateRegistryCLSID(const CLSID& clsid, BOOL bRegister);
  82. };
  83. #define DECLARE_REGISTRY_CLSID() \
  84. static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
  85. { \
  86. return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
  87. }
  88. extern CDsAdminModule _Module;
  89. #include <atlcom.h>
  90. #include <atlwin.h>
  91. #include "dbgutil.h"
  92. #define SECURITY_WIN32
  93. #include "security.h"
  94. #include <activeds.h>
  95. #include <iadsp.h>
  96. #include <mmc.h>
  97. #pragma comment(lib, "mmcuuid.lib")
  98. #include <shlobj.h> // needed for dsclient.h
  99. #include <dsclient.h>
  100. #include <dsclintp.h>
  101. #include <dspropp.h>
  102. #include <propcfg.h> // private dsprop header
  103. #include <stdabout.h>
  104. #include <dsadmin.h> // COM extensibility interfaces
  105. #include <dsadminp.h> // common functionality
  106. #include <ntdsadef.h>
  107. #include <windns.h>
  108. #include <ntsam.h> // Group types
  109. #include <locale.h>
  110. #define SECURITY_WIN32
  111. #include "security.h"
  112. #include "pcrack.h" // CPathCracker
  113. // macros
  114. extern const CLSID CLSID_DSSnapin;
  115. extern const CLSID CLSID_DSSnapinEx;
  116. extern const CLSID CLSID_SiteSnapin;
  117. extern const CLSID CLSID_DSContextMenu;
  118. extern const CLSID CLSID_DSAboutSnapin;
  119. extern const CLSID CLSID_SitesAboutSnapin;
  120. extern const CLSID CLSID_DSAdminQueryUIForm;
  121. extern const GUID cDefaultNodeType;
  122. extern const wchar_t* cszDefaultNodeType;
  123. // New Clipboard format that has the Type and Cookie
  124. extern const wchar_t* SNAPIN_INTERNAL;
  125. // these are from ntsam.h, i can't include it here.
  126. //
  127. // Group Flag Definitions to determine Type of Group
  128. //
  129. #define GROUP_TYPE_BUILTIN_LOCAL_GROUP 0x00000001
  130. #define GROUP_TYPE_ACCOUNT_GROUP 0x00000002
  131. #define GROUP_TYPE_RESOURCE_GROUP 0x00000004
  132. #define GROUP_TYPE_UNIVERSAL_GROUP 0x00000008
  133. #define GROUP_TYPE_SECURITY_ENABLED 0x80000000
  134. // struct definitions
  135. typedef struct _CREATEINFO {
  136. DWORD dwSize; // in bytes
  137. DWORD cItems; // how many entries;
  138. LPWSTR paClassNames[1]; // array of LPWSTR
  139. } CREATEINFO, *PCREATEINFO;
  140. typedef enum _SnapinType
  141. {
  142. SNAPINTYPE_DS = 0,
  143. SNAPINTYPE_DSEX,
  144. SNAPINTYPE_SITE,
  145. SNAPINTYPE_NUMTYPES
  146. } SnapinType;
  147. extern int ResourceIDForSnapinType[SNAPINTYPE_NUMTYPES];
  148. class CUINode;
  149. struct INTERNAL
  150. {
  151. INTERNAL()
  152. {
  153. m_type = CCT_UNINITIALIZED;
  154. m_cookie = NULL;
  155. m_cookie_count = 0;
  156. m_p_cookies = NULL;
  157. m_snapintype = SNAPINTYPE_DS;
  158. };
  159. ~INTERNAL() {}
  160. DATA_OBJECT_TYPES m_type; // What context is the data object.
  161. CUINode* m_cookie; // What object the cookie represents
  162. CString m_string;
  163. SnapinType m_snapintype;
  164. CLSID m_clsid;
  165. DWORD m_cookie_count; // > 1 if multi-select
  166. CUINode** m_p_cookies; //rest of cookies here, as array
  167. };
  168. ///////////////////////////////////////////////////
  169. // NT 5.0 style ACL manipulation API's
  170. #include <aclapi.h>
  171. ///////////////////////////////////////////////////
  172. // Security Identity Mapping (SIM) Stuff
  173. // Must include file "\nt\public\sdk\inc\wincrypt.h"
  174. #include <wincrypt.h> // CryptDecodeObject() found in crypt32.lib
  175. // REVIEW_MARCOC:
  176. // this is to allow new MMC interfaces and code based on
  177. // the new ISnapinProperty (and related) interfaces
  178. // comment/uncomment it to change functionality
  179. //#define _MMC_ISNAPIN_PROPERTY
  180. //
  181. // REVIEW_JEFFJON : this is to enable inetOrgPerson to behave like a user class object
  182. // For more information talk to JC Cannon
  183. //
  184. #define INETORGPERSON
  185. //
  186. // This is to enable profiling through the macros defined in profile.h
  187. // Profile.h will turn on profiling if MAX_PROFILING_ENABLED is defined
  188. // NOTE : profiling as implemented by profile.h does not work well with
  189. // multiple instances of the same snapin in one MMC console
  190. //
  191. #ifdef MAX_PROFILING_ENABLED
  192. #pragma warning(push, 3)
  193. #include <list>
  194. #include <vector>
  195. #include <stack>
  196. #include <map>
  197. #include <algorithm>
  198. #pragma warning (pop)
  199. #endif
  200. #include "profile.h"
  201. #include "MyBasePathsInfo.h"
  202. #include "dscmn.h"
  203. // If dsadmin later converted to use burnslib, make sure we select
  204. // the published EncryptedString class.
  205. #ifndef ENCRYPTEDSTRING_HPP_INCLUDED
  206. #define ENCRYPTEDSTRING_HPP_INCLUDED
  207. #else
  208. // burnslib EncryptedString already included! Notify the developer...
  209. #error Burnslib EncryptedString included; will conflict with published EncryptedString.
  210. #endif
  211. //
  212. // ArtM:
  213. // This is to silence deprecation warnings from strsafe.h
  214. // (which we need for EncryptedString.hpp). In long term
  215. // this can be removed be replacing all the deprecated fctns
  216. // with strsafe calls.
  217. //
  218. #define STRSAFE_NO_DEPRECATE 1
  219. #define _DDX_ENCRYPTED 1
  220. // Since we need to install on XP we cannot use CryptProtectMemory. By defining
  221. // ENCRYPT_WITH_CRYPTPROTECTDATA, the EncryptedString class will use CryptProtectData
  222. // instead
  223. #define ENCRYPT_WITH_CRYPTPROTECTDATA
  224. #include "EncryptedString.hpp"
  225. #endif //__STDAFX_H__