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.

112 lines
2.6 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CUuid.cpp
  7. //
  8. // Description:
  9. // Contains the definition of the CUuid class.
  10. //
  11. // Documentation:
  12. // TODO: Add pointer to external documentation later.
  13. //
  14. // Maintained By:
  15. // Vij Vasu (Vvasu) 24-MAR-2000
  16. //
  17. //////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19. // Include Files
  20. //////////////////////////////////////////////////////////////////////////////
  21. // The precompiled header.
  22. #include "pch.h"
  23. // The header file for this class.
  24. #include "CUuid.h"
  25. //////////////////////////////////////////////////////////////////////////////
  26. //++
  27. //
  28. // CUuid::CUuid( void )
  29. //
  30. // Description:
  31. // Default constructor of the CUuid class.
  32. //
  33. // Arguments:
  34. // None.
  35. //
  36. // Return Value:
  37. // None.
  38. //
  39. // Exceptions Thrown:
  40. // CRuntimeError
  41. // If any of the APIs fail.
  42. //
  43. //--
  44. //////////////////////////////////////////////////////////////////////////////
  45. CUuid::CUuid( void )
  46. {
  47. RPC_STATUS rsStatus = RPC_S_OK;
  48. m_pszStringUuid = NULL;
  49. do
  50. {
  51. // Create a UUID.
  52. rsStatus = UuidCreate( &m_uuid );
  53. if ( rsStatus != RPC_S_OK )
  54. {
  55. BCATraceMsg( "UuidCreate() failed." );
  56. break;
  57. } // if: UuidCreate() failed
  58. // Convert it to a string.
  59. rsStatus = UuidToString( &m_uuid, &m_pszStringUuid );
  60. if ( rsStatus != RPC_S_OK )
  61. {
  62. BCATraceMsg( "UuidToString() failed." );
  63. break;
  64. } // if: UuidToStrin() failed
  65. }
  66. while( false ); // dummy do-while loop to avoid gotos.
  67. if ( rsStatus != RPC_S_OK )
  68. {
  69. BCATraceMsg1( "Error %#08x occurred trying to initialize the UUID. Throwing exception.", rsStatus );
  70. THROW_RUNTIME_ERROR( rsStatus, IDS_ERROR_UUID_INIT );
  71. } // if: something has gone wrong
  72. } //*** CUuid::CUuid()
  73. //////////////////////////////////////////////////////////////////////////////
  74. //++
  75. //
  76. // CUuid::~CUuid( void )
  77. //
  78. // Description:
  79. // Destructor of the CUuid class.
  80. //
  81. // Arguments:
  82. // None.
  83. //
  84. // Return Value:
  85. // None.
  86. //
  87. // Exceptions Thrown:
  88. // None.
  89. //
  90. //--
  91. //////////////////////////////////////////////////////////////////////////////
  92. CUuid::~CUuid( void )
  93. {
  94. if ( m_pszStringUuid != NULL )
  95. {
  96. RpcStringFree( &m_pszStringUuid );
  97. } // if: the string is not NULL
  98. } //*** CUuid::~CUuid()