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.

56 lines
1.2 KiB

  1. #include "shellprv.h"
  2. #pragma hdrstop
  3. STDAPI_(BOOL) StrRetToStrN(LPTSTR pszOut, UINT cchOut, STRRET *pStrRet, LPCITEMIDLIST pidl)
  4. {
  5. return SUCCEEDED(StrRetToBuf(pStrRet, pidl, pszOut, cchOut));
  6. }
  7. STDAPI_(int) OleStrToStrN(LPTSTR pszOut, int cchOut, LPCWSTR pwsz, int cchWideChar)
  8. {
  9. int cchOutput;
  10. if (cchOut > cchWideChar && -1 != cchWideChar)
  11. cchOut = cchWideChar;
  12. cchOutput = cchOut;
  13. while (cchOut)
  14. {
  15. if ((*pszOut++ = *pwsz++) == 0)
  16. return cchOutput - cchOut + 1;
  17. cchOut--;
  18. }
  19. if (-1 == cchWideChar)
  20. pszOut--; // Make room for the null
  21. *pszOut = 0;
  22. return cchOutput;
  23. }
  24. STDAPI_(int) StrToOleStrN(LPWSTR pwszOut, int cchOut, LPCTSTR psz, int cchIn)
  25. {
  26. int cchOutput;
  27. if (cchOut > cchIn)
  28. cchOut = cchIn;
  29. cchOutput = cchOut;
  30. while (--cchOut)
  31. {
  32. if ((*pwszOut++ = *psz++) == 0)
  33. return cchOutput - cchOut + 1;
  34. }
  35. *pwszOut = 0;
  36. return cchOutput;
  37. }
  38. // bogus export, too scared to remove it
  39. STDAPI_(int) StrToOleStr(LPWSTR pwszOut, LPCTSTR psz)
  40. {
  41. return SHTCharToUnicode(psz, pwszOut, MAX_PATH);
  42. }