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.

116 lines
2.6 KiB

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