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.

74 lines
2.5 KiB

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright(C) 1998-1999 Microsoft Corporation all rights reserved.
  4. //
  5. // Module: propbagfactory.cpp
  6. //
  7. // Project: Chameleon
  8. //
  9. // Description: Property bag factory implementation
  10. //
  11. // Author: TLP
  12. //
  13. // When Who What
  14. // ---- --- ----
  15. // 12/3/98 TLP Original version
  16. //
  17. ///////////////////////////////////////////////////////////////////////////
  18. #include "stdafx.h"
  19. #include "propertybagfactory.h"
  20. #include "regpropertybag.h"
  21. DWORD MPPROPERTYBAG::m_dwInstances = 0;
  22. DWORD MPREGPROPERTYBAG::m_dwInstances = 0;
  23. //////////////////////////////////////////////////////////////////////////////
  24. PPROPERTYBAG
  25. MakePropertyBag(
  26. /*[in]*/ PROPERTY_BAG_TYPE eType,
  27. /*[in]*/ CLocationInfo& locationInfo
  28. )
  29. {
  30. if ( eType == PROPERTY_BAG_REGISTRY )
  31. {
  32. // Create a new property bag and give it to the
  33. // master pointer (which will then take ownership of it).
  34. CRegPropertyBag* pBag = new CRegPropertyBag(locationInfo);
  35. if ( pBag != NULL )
  36. {
  37. MPPROPERTYBAG* mp = (MPPROPERTYBAG*) new MPREGPROPERTYBAG(pBag);
  38. return PPROPERTYBAG(mp);
  39. }
  40. }
  41. // Caller should always invoke CHandle<T>.IsValid() to determine
  42. // if the "pointer" is valid. Analgous to checking return from new for NULL
  43. return PPROPERTYBAG();
  44. }
  45. DWORD MPPROPERTYBAGCONTAINER::m_dwInstances = 0;
  46. DWORD MPREGPROPERTYBAGCONTAINER::m_dwInstances = 0;
  47. //////////////////////////////////////////////////////////////////////////////
  48. PPROPERTYBAGCONTAINER
  49. MakePropertyBagContainer(
  50. /*[in]*/ PROPERTY_BAG_TYPE eType,
  51. /*[in]*/ CLocationInfo& locationInfo
  52. )
  53. {
  54. if ( eType == PROPERTY_BAG_REGISTRY )
  55. {
  56. // Create a new property bag container and give it to the
  57. // master pointer (which will then take ownership of it)
  58. CRegPropertyBagContainer* pBagContainer = new CRegPropertyBagContainer(locationInfo);
  59. if ( pBagContainer != NULL )
  60. {
  61. MPPROPERTYBAGCONTAINER* mp = (MPPROPERTYBAGCONTAINER*) new MPREGPROPERTYBAGCONTAINER(pBagContainer);
  62. return PPROPERTYBAGCONTAINER(mp);
  63. }
  64. }
  65. // Caller should always invoke CHandle<T>.IsValid() to determine
  66. // if the "pointer" is valid. Analogous to checking return from new for NULL
  67. return PPROPERTYBAGCONTAINER();
  68. }