InW.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description: Unicode<->ANSI conversion layer for input plugins
  5. ** Author: Ben Allison [email protected]
  6. ** Created:
  7. **/
  8. #include "main.h"
  9. #include "../nu/AutoCharFn.h"
  10. #include "../nu/ns_wc.h"
  11. int InW_IsOurFile(In_Module *mod, const wchar_t *filename)
  12. {
  13. if(mod)
  14. {
  15. if (mod->version & IN_UNICODE)
  16. return mod->IsOurFile((in_char *)filename);
  17. else
  18. return mod->IsOurFile((in_char *)(char *)AutoCharFn(filename));
  19. }
  20. return 0;
  21. }
  22. int InW_Play(In_Module *mod, const wchar_t *filename)
  23. {
  24. if (mod->version & IN_UNICODE)
  25. return mod->Play((in_char *)filename);
  26. else
  27. return mod->Play((in_char *)(char *)AutoCharFn(filename));
  28. }
  29. int InW_InfoBox(In_Module *mod, const wchar_t *filename, HWND parent)
  30. {
  31. if (mod->version & IN_UNICODE)
  32. return mod->InfoBox((in_char *)filename, parent);
  33. else
  34. return mod->InfoBox((in_char *)(char *)AutoCharFn(filename), parent);
  35. }
  36. void InW_GetFileInfo(In_Module *mod, const wchar_t *filename, wchar_t *title, int *length)
  37. {
  38. if (mod->version & IN_UNICODE)
  39. mod->GetFileInfo((in_char *)filename, (in_char *)title, length);
  40. else
  41. {
  42. char tempTitle[GETFILEINFO_TITLE_LENGTH]="";
  43. mod->GetFileInfo((in_char *)(char *)AutoCharFn(filename), tempTitle, length);
  44. MultiByteToWideCharSZ(CP_ACP, 0, tempTitle, -1, title, GETFILEINFO_TITLE_LENGTH);
  45. }
  46. }