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.

96 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. IgnoreOemToChar.cpp
  5. Abstract:
  6. Written originally to fix an Install Shield bug.
  7. It may be specific to _ins5576._mp versions.
  8. The executable _ins5576._mp calls OemToChar on the string
  9. "%userprofile%\local settings\temp\_istmp11.dir\_ins5576._mp".
  10. The call is unessasary and causes problems with path names that
  11. contain non-ansi characters.
  12. Notes:
  13. This is a general purpose shim.
  14. History:
  15. 04/03/2001 a-larrsh Created
  16. --*/
  17. #include "precomp.h"
  18. #include <shlwapi.h> // For PathFindFileName
  19. IMPLEMENT_SHIM_BEGIN(IgnoreOemToChar)
  20. #include "ShimHookMacro.h"
  21. typedef BOOL (WINAPI *_pfn_OemToCharA)(LPCSTR lpszSrc, LPTSTR lpszDst);
  22. APIHOOK_ENUM_BEGIN
  23. APIHOOK_ENUM_ENTRY(OemToCharA)
  24. APIHOOK_ENUM_END
  25. /*++
  26. Hook the call to OemToCharA. Determine if the string should be ignored.
  27. --*/
  28. BOOL APIHOOK(OemToCharA)(
  29. LPCSTR lpszSrc, // string to translate
  30. LPTSTR lpszDst // translated string
  31. )
  32. {
  33. BOOL bReturn;
  34. CString sTemp(lpszSrc);
  35. sTemp.MakeUpper();
  36. if( sTemp.Find(L"TEMP") )
  37. {
  38. DPFN( eDbgLevelInfo, "Ignoring attempt to convert string %s\n", lpszSrc);
  39. if (lpszDst)
  40. {
  41. _tcscpy((char *)lpszDst, lpszSrc);
  42. }
  43. bReturn = TRUE;
  44. }
  45. else
  46. {
  47. bReturn = ORIGINAL_API(OemToCharA)(lpszSrc, lpszDst);
  48. }
  49. return bReturn;
  50. }
  51. /*++
  52. Register hooked functions
  53. --*/
  54. HOOK_BEGIN
  55. APIHOOK_ENTRY(USER32.DLL, OemToCharA)
  56. HOOK_END
  57. IMPLEMENT_SHIM_END