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.

107 lines
2.9 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) 1995-1996 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. // stdafx.h : include file for standard system include files,
  9. // or project specific include files that are used frequently,
  10. // but are changed infrequently
  11. #include <afxwin.h>
  12. #include <afxdisp.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. #pragma comment(lib, "mmc")
  19. #include <mmc.h>
  20. #include "afxtempl.h"
  21. const long UNINITIALIZED = -1;
  22. // Sample folder types
  23. enum FOLDER_TYPES
  24. {
  25. STATIC = 0x8000,
  26. };
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Helper functions
  29. template<class TYPE>
  30. inline void SAFE_RELEASE(TYPE*& pObj)
  31. {
  32. if (pObj != NULL)
  33. {
  34. pObj->Release();
  35. pObj = NULL;
  36. }
  37. else
  38. {
  39. TRACE(_T("Release called on NULL interface ptr\n"));
  40. }
  41. }
  42. extern const CLSID CLSID_Snapin; // In-Proc server GUID
  43. extern const GUID cNodeType; // Main NodeType GUID on numeric format
  44. extern const wchar_t* cszNodeType; // Main NodeType GUID on string format
  45. // New Clipboard format that has the Type and Cookie
  46. extern const wchar_t* SNAPIN_INTERNAL;
  47. struct INTERNAL
  48. {
  49. INTERNAL() { m_type = CCT_UNINITIALIZED; m_cookie = -1;};
  50. ~INTERNAL() {}
  51. DATA_OBJECT_TYPES m_type; // What context is the data object.
  52. long m_cookie; // What object the cookie represents
  53. CString m_string;
  54. INTERNAL & operator=(const INTERNAL& rhs)
  55. {
  56. if (&rhs == this)
  57. return *this;
  58. m_type = rhs.m_type;
  59. m_cookie = rhs.m_cookie;
  60. m_string = rhs.m_string;
  61. return *this;
  62. }
  63. BOOL operator==(const INTERNAL& rhs)
  64. {
  65. return rhs.m_string == m_string;
  66. }
  67. };
  68. // Debug instance counter
  69. #ifdef _DEBUG
  70. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  71. {
  72. char buf[100];
  73. wsprintfA(buf, "%s has %d instances left over.", pszClassName, cInstRem);
  74. ::MessageBoxA(NULL, buf, "Memory Leak!!!", MB_OK);
  75. }
  76. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  77. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  78. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  79. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  80. extern int s_cInst_##cls; \
  81. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  82. #else
  83. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  84. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  85. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  86. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  87. #endif