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.

66 lines
2.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // Microsoft WMIOLE DB Provider
  3. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. //
  6. // This module contains the base object for CDatasource, CDBSession, CCommand,
  7. // and CRowset. It contains routines such as globally registering the object
  8. // for the cleanup routine and typing the object so persist an other internal
  9. // implementation can know what object they are talking to.
  10. //
  11. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  12. #include "headers.h"
  13. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. //
  15. // Constructor for this class
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  18. CBaseObj::CBaseObj( EBaseObjectType botVal, // IN Base Object Type
  19. LPUNKNOWN pUnkOuter // IN Outer Unknown Pointer
  20. ) : m_cs(TRUE)
  21. {
  22. m_BaseObjectType = botVal;
  23. m_cRef = 0;
  24. m_pUnkOuter = pUnkOuter? pUnkOuter : LPUNKNOWN(this);
  25. InterlockedIncrement(&g_cObj);
  26. }
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. //
  29. // Destructor for this class
  30. //
  31. //
  32. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. CBaseObj::~CBaseObj()
  34. {
  35. InterlockedDecrement(&g_cObj);
  36. }
  37. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  38. //
  39. // Return Base Object type name.
  40. //
  41. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  42. WCHAR * CBaseObj::GetBaseObjectTypeName()
  43. {
  44. #ifdef DEBUG
  45. static WCHAR * s_wszName[] = {
  46. L"Unknown",
  47. L"DataSource",
  48. L"Session",
  49. L"Command",
  50. L"Rowset",
  51. L"Error",
  52. L"ClassFactory",
  53. L"Enumerator",
  54. L"TransactionOptions",
  55. };
  56. assert(m_BaseObjectType >= BOT_DATASOURCE && m_BaseObjectType <= BOT_MULTIPLERESULTS);
  57. return s_wszName[m_BaseObjectType];
  58. #else
  59. return L"";
  60. #endif
  61. }