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.

58 lines
1.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: U P S C M N . C P P
  7. //
  8. // Contents: Common fns for UPnP Folder and Tray code.
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 7 Dec 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #include <upscmn.h>
  18. #include <oleauto.h>
  19. //+---------------------------------------------------------------------------
  20. //
  21. // Function: HrSysAllocString
  22. //
  23. // Purpose: Simple HR wrapper for HrSysAllocString
  24. //
  25. // Arguments:
  26. // pszSource [in] Source string (WCHAR)
  27. // pbstrDest [out] Output param -- pointer to BSTR
  28. //
  29. // Returns: S_OK on success, E_OUTOFMEMORY if the alloc failed.
  30. //
  31. // Author: jeffspr 16 Sep 1999
  32. //
  33. // Notes:
  34. //
  35. HRESULT HrSysAllocString(LPCWSTR pszSource, BSTR *pbstrDest)
  36. {
  37. HRESULT hr = S_OK;
  38. Assert(pszSource);
  39. Assert(pbstrDest);
  40. *pbstrDest = SysAllocString(pszSource);
  41. if (!*pbstrDest)
  42. {
  43. TraceTag(ttidError, "HrSysAllocString failed on %S", pszSource);
  44. hr = E_OUTOFMEMORY;
  45. }
  46. TraceHr(ttidShellFolder, FAL, hr, FALSE, "HrSysAllocString");
  47. return hr;
  48. }