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.

41 lines
804 B

  1. #include "str.h"
  2. #include "sfstr.h"
  3. #include "dbg.h"
  4. ///////////////////////////////////////////////////////////////////////////////
  5. //
  6. HRESULT _StringFromGUID(const GUID* pguid, LPWSTR psz, DWORD cch)
  7. {
  8. LPOLESTR pstr;
  9. HRESULT hres = StringFromCLSID(*pguid, &pstr);
  10. if (SUCCEEDED(hres))
  11. {
  12. // check size of string
  13. hres = SafeStrCpyN(psz, pstr, cch);
  14. CoTaskMemFree(pstr);
  15. }
  16. return hres;
  17. }
  18. HRESULT _GUIDFromString(LPCWSTR psz, GUID* pguid)
  19. {
  20. return CLSIDFromString((LPOLESTR)psz, pguid);
  21. }
  22. HRESULT _CreateGUID(LPWSTR pszGUID, DWORD cchGUID)
  23. {
  24. GUID guid;
  25. HRESULT hr = CoCreateGuid(&guid);
  26. if (SUCCEEDED(hr))
  27. {
  28. hr = _StringFromGUID(&guid, pszGUID, cchGUID);
  29. }
  30. return hr;
  31. }