ExtendedFileInfo.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "main.h"
  2. #include "resource.h"
  3. #include <shlwapi.h>
  4. #include <strsafe.h>
  5. #include "api.h"
  6. #define TESTKEYWORD(__keyword, __string)\
  7. (CSTR_EQUAL == CompareStringA(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT),\
  8. NORM_IGNORECASE, (__keyword), -1, (__string), -1))
  9. extern "C" __declspec( dllexport ) int winampGetExtendedFileInfoW(const wchar_t *fn, const char *data, wchar_t *dest, int destlen)
  10. {
  11. if (TESTKEYWORD("type", data))
  12. {
  13. if (NULL != dest)
  14. {
  15. int index = 0;
  16. if (destlen > 1)
  17. dest[index++] = L'1';
  18. dest[index] = L'\0';
  19. }
  20. return 1;
  21. }
  22. else if (TESTKEYWORD("family", data))
  23. {
  24. LPCWSTR e, p(NULL);
  25. e = PathFindExtensionW(fn);
  26. if (L'.' != *e) return 0;
  27. e++;
  28. if (CSTR_EQUAL == CompareStringW(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT),
  29. NORM_IGNORECASE, e, -1, L"SWF", -1))
  30. {
  31. if (S_OK == StringCchCopyW(dest, destlen, WASABI_API_LNGSTRINGW(IDS_FAMILY_STRING))) return 1;
  32. //p = L"Shockwave Flash";
  33. }
  34. //if (p && S_OK == StringCchCopyW(dest, destlen, p)) return 1;
  35. return 0;
  36. }
  37. return 0;
  38. }