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.

166 lines
4.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: stdafx.h
  8. //
  9. //--------------------------------------------------------------------------
  10. extern "C"
  11. {
  12. #include <nt.h>
  13. #include <ntrtl.h>
  14. #include <nturtl.h>
  15. }
  16. #if defined (ASSERT) // NT's ASSERTs conflict with MFC's ASSERTS
  17. # undef ASSERT
  18. #endif
  19. #include <afxwin.h>
  20. #include <afxdisp.h>
  21. ///////////////////////////////////////////
  22. // ASSERT's and TRACE's without debug CRT's
  23. #if defined (DBG)
  24. #if !defined (_DEBUG)
  25. #define _USE_DSA_TRACE
  26. #define _USE_DSA_ASSERT
  27. #define _USE_DSA_TIMER
  28. #endif
  29. #endif
  30. #include "dbg.h"
  31. ///////////////////////////////////////////
  32. #include <atlbase.h>
  33. //You may derive a class from CComModule and use it if you want to override
  34. //something, but do not change the name of _Module
  35. class CDomainAdminModule : public CComModule
  36. {
  37. public:
  38. HRESULT WINAPI UpdateRegistryCLSID(const CLSID& clsid, BOOL bRegister);
  39. };
  40. #define DECLARE_REGISTRY_CLSID() \
  41. static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
  42. { \
  43. return _Module.UpdateRegistryCLSID(GetObjectCLSID(), bRegister); \
  44. }
  45. extern CDomainAdminModule _Module;
  46. #include <atlcom.h>
  47. #include <atlwin.h>
  48. #include <mmc.h>
  49. #include <afxcmn.h>
  50. #include <afxtempl.h>
  51. #include <dsgetdc.h>
  52. #include <shlobj.h> // needed for dsclient.h
  53. #include <dsclient.h>
  54. #include <dspropp.h>
  55. #include "propcfg.h"
  56. #include <dscmn.h>
  57. #include <dsadminp.h> // DS Admin utilities
  58. #include <ntverp.h>
  59. #include <common.ver>
  60. #define STR_SNAPIN_COMPANY TEXT(VER_COMPANYNAME_STR)
  61. #define STR_SNAPIN_VERSION VER_PRODUCTVERSION_STR // this is a concatenation of ANSI strings
  62. const long UNINITIALIZED = -1;
  63. // For theming
  64. #include <shfusion.h>
  65. /////////////////////////////////////////////////////////////////////////////
  66. // Helper functions
  67. template<class TYPE>
  68. inline void SAFE_RELEASE(TYPE*& pObj)
  69. {
  70. if (pObj != NULL)
  71. {
  72. pObj->Release();
  73. pObj = NULL;
  74. }
  75. else
  76. {
  77. TRACE(_T("Release called on NULL interface ptr\n"));
  78. }
  79. }
  80. struct INTERNAL
  81. {
  82. INTERNAL() { m_type = CCT_UNINITIALIZED; m_cookie = -1;};
  83. ~INTERNAL() {}
  84. DATA_OBJECT_TYPES m_type; // What context is the data object.
  85. MMC_COOKIE m_cookie; // What object the cookie represents
  86. CString m_string;
  87. CString m_class;
  88. INTERNAL & operator=(const INTERNAL& rhs)
  89. {
  90. if (&rhs == this)
  91. return *this;
  92. m_type = rhs.m_type;
  93. m_cookie = rhs.m_cookie;
  94. m_string = rhs.m_string;
  95. return *this;
  96. }
  97. BOOL operator==(const INTERNAL& rhs)
  98. {
  99. return rhs.m_string == m_string;
  100. }
  101. };
  102. class CThemeContextActivator
  103. {
  104. public:
  105. CThemeContextActivator() : m_ulActivationCookie(0)
  106. { SHActivateContext (&m_ulActivationCookie); }
  107. ~CThemeContextActivator()
  108. { SHDeactivateContext (m_ulActivationCookie); }
  109. private:
  110. ULONG_PTR m_ulActivationCookie;
  111. };
  112. // Debug instance counter
  113. #ifdef _DEBUG
  114. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  115. {
  116. char buf[100];
  117. wsprintfA(buf, "%s has %d instances left over.", pszClassName, cInstRem);
  118. ::MessageBoxA(NULL, buf, "Memory Leak!!!", MB_OK);
  119. }
  120. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  121. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  122. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  123. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  124. extern int s_cInst_##cls; \
  125. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  126. #else
  127. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  128. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  129. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  130. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  131. #endif
  132. /////////////////////////////////////////////////////////////////////
  133. #include "stdabout.h"
  134. #include "MyBasePathsInfo.h"
  135. #include <secondaryProppages.h>