serviceDetails.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "./main.h"
  2. #include "./service.h"
  3. #include <strsafe.h>
  4. HRESULT OmService::GetDescription(LPWSTR pszBuffer, UINT cchBufferMax)
  5. {
  6. return StringCchCopyExMT(pszBuffer, cchBufferMax, description, NULL, NULL, STRSAFE_IGNORE_NULLS);
  7. }
  8. HRESULT OmService::GetAuthorFirst(LPWSTR pszBuffer, UINT cchBufferMax)
  9. {
  10. return StringCchCopyExMT(pszBuffer, cchBufferMax, authorFirst, NULL, NULL, STRSAFE_IGNORE_NULLS);
  11. }
  12. HRESULT OmService::GetAuthorLast(LPWSTR pszBuffer, UINT cchBufferMax)
  13. {
  14. return StringCchCopyExMT(pszBuffer, cchBufferMax, authorLast, NULL, NULL, STRSAFE_IGNORE_NULLS);
  15. }
  16. HRESULT OmService::GetPublished(LPWSTR pszBuffer, UINT cchBufferMax)
  17. {
  18. if (NULL == pszBuffer) return E_POINTER;
  19. EnterCriticalSection(&lock);
  20. LPCWSTR source = (NULL != published && L'\0' != *published) ? published : updated;
  21. HRESULT hr = StringCchCopyEx(pszBuffer, cchBufferMax, source, NULL, NULL, STRSAFE_IGNORE_NULLS);
  22. LeaveCriticalSection(&lock);
  23. return hr;
  24. }
  25. HRESULT OmService::GetUpdated(LPWSTR pszBuffer, UINT cchBufferMax)
  26. {
  27. if (NULL == pszBuffer) return E_POINTER;
  28. EnterCriticalSection(&lock);
  29. LPCWSTR source = (NULL != updated && L'\0' != *updated) ? updated : published;
  30. HRESULT hr = StringCchCopyEx(pszBuffer, cchBufferMax, source, NULL, NULL, STRSAFE_IGNORE_NULLS);
  31. LeaveCriticalSection(&lock);
  32. return hr;
  33. }
  34. HRESULT OmService::GetThumbnail(LPWSTR pszBuffer, UINT cchBufferMax)
  35. {
  36. return StringCchCopyExMT(pszBuffer, cchBufferMax, thumbnail, NULL, NULL, STRSAFE_IGNORE_NULLS | STRSAFE_NULL_ON_FAILURE);
  37. }
  38. HRESULT OmService::GetScreenshot(LPWSTR pszBuffer, UINT cchBufferMax)
  39. {
  40. return StringCchCopyExMT(pszBuffer, cchBufferMax, screenshot, NULL, NULL, STRSAFE_IGNORE_NULLS | STRSAFE_NULL_ON_FAILURE);
  41. }