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.

55 lines
1.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: ole.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include <windows.h>
  11. #include <rpc.h>
  12. #include <rpcdce.h>
  13. #include "unicode.h"
  14. #ifdef _M_IX86
  15. // note: unlike UUidToString, always must LocalFree() returned memory
  16. RPC_STATUS RPC_ENTRY UuidToStringU(
  17. UUID * Uuid,
  18. WCHAR * * StringUuid
  19. ) {
  20. char * pszUuid = NULL;
  21. LONG err;
  22. err = FALSE;
  23. if(RPC_S_OK ==
  24. (err = UuidToStringA(
  25. Uuid,
  26. (unsigned char * *)&pszUuid
  27. )) )
  28. {
  29. // convert A output to W
  30. LPWSTR sz = MkWStr(pszUuid);
  31. RpcStringFree((unsigned char * *)&pszUuid);
  32. if( sz == NULL )
  33. return(ERROR_OUTOFMEMORY);
  34. // copy into output pointer
  35. *StringUuid = (WCHAR*) LocalAlloc(LMEM_FIXED, sizeof(WCHAR)*(wcslen(sz)+1));
  36. if(*StringUuid != NULL)
  37. wcscpy(*StringUuid, sz);
  38. else
  39. err = ERROR_OUTOFMEMORY;
  40. // Do nice free of other buffer
  41. FreeWStr(sz);
  42. }
  43. return(err);
  44. }
  45. #endif // _M_IX86