Source code of Windows XP (NT5)
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.

38 lines
974 B

  1. #include "..\pch\headers.hxx"
  2. #pragma hdrstop
  3. //
  4. // We need this wrapper for ILCreateFromPath since it was a TCHAR exported by ordinal
  5. // on NT4 and now has A/W versions on NT5. Since we want to be able to run on both of
  6. // these platforms we wrap the API here.
  7. //
  8. // This api just loads shell32, and calls ordinal 157 which is the old TCHAR export
  9. //
  10. typedef LPITEMIDLIST (__stdcall *PFNILCREATEFROMPATH)(LPCTSTR pszPath);
  11. STDAPI_(LPITEMIDLIST) Wrap_ILCreateFromPath(LPCTSTR pszPath)
  12. {
  13. static PFNILCREATEFROMPATH pfn = (PFNILCREATEFROMPATH)-1;
  14. if (pfn == (PFNILCREATEFROMPATH)-1)
  15. {
  16. HINSTANCE hinst = GetModuleHandle(TEXT("shell32.dll"));
  17. if (hinst)
  18. {
  19. pfn = (PFNILCREATEFROMPATH) GetProcAddress(hinst, (LPCSTR)157);
  20. }
  21. else
  22. {
  23. pfn = NULL;
  24. }
  25. }
  26. if (pfn)
  27. {
  28. return pfn(pszPath);
  29. }
  30. // If we failed for some reason, just return NULL
  31. return NULL;
  32. }