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.

72 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. vststutil.hxx
  5. Abstract:
  6. Definition of CVsTstRandom class
  7. Brian Berkowitz [brianb] 06/08/2000
  8. TBD:
  9. Revision History:
  10. Name Date Comments
  11. brianb 06/08/2000 Created
  12. --*/
  13. class CVsTstRandom
  14. {
  15. public:
  16. static void SetRandomSeed(UINT seed);
  17. static UINT RandomChoice(UINT low, UINT high);
  18. };
  19. void LogUnexpectedFailure(LPCWSTR, ...);
  20. /////////////////////////////////////////////////////////////////////////////
  21. // Class for encapshulating GUIDs (GUID)
  22. class CVssID
  23. {
  24. // Constructors/destructors
  25. public:
  26. CVssID( GUID Id = GUID_NULL ): m_Id(Id) {};
  27. // Operations
  28. public:
  29. void Initialize(
  30. IN LPCWSTR wszId,
  31. IN HRESULT hrOnError = E_UNEXPECTED
  32. ) throw(HRESULT)
  33. {
  34. HRESULT hr;
  35. hr = ::CLSIDFromString(W2OLE(const_cast<WCHAR*>(wszId)), &m_Id);
  36. if (FAILED(hr))
  37. {
  38. LogUnexpectedFailure(L"CLSIDFromString failed, hr=0x%08lx", hr);
  39. throw(hrOnError);
  40. }
  41. };
  42. operator GUID&() { return m_Id; };
  43. GUID operator=( GUID Id ) { return (m_Id = Id); };
  44. // Internal data members
  45. private:
  46. GUID m_Id;
  47. };