Leaked source code of windows server 2003
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.

104 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2000-2002 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. 03/13/2002 mnikkel Modified to use strsafe.h
  17. --*/
  18. #include "precomp.h"
  19. IMPLEMENT_SHIM_BEGIN(IgnoreOemToChar)
  20. #include "ShimHookMacro.h"
  21. typedef BOOL (WINAPI *_pfn_OemToCharA)(LPCSTR lpszSrc, LPSTR 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. LPSTR lpszDst // translated string
  31. )
  32. {
  33. BOOL bReturn = FALSE;
  34. CSTRING_TRY
  35. {
  36. CString sTemp(lpszSrc);
  37. sTemp.MakeUpper();
  38. if( sTemp.Find(L"TEMP") )
  39. {
  40. DPFN( eDbgLevelInfo, "Ignoring attempt to convert string %s\n", lpszSrc);
  41. if (lpszDst)
  42. {
  43. StringCchCopyA(lpszDst, strlen(lpszSrc)+1, lpszSrc);
  44. bReturn = TRUE;
  45. }
  46. }
  47. }
  48. CSTRING_CATCH
  49. {
  50. // do nothing
  51. }
  52. if (!bReturn)
  53. {
  54. bReturn = ORIGINAL_API(OemToCharA)(lpszSrc, lpszDst);
  55. }
  56. return bReturn;
  57. }
  58. /*++
  59. Register hooked functions
  60. --*/
  61. HOOK_BEGIN
  62. APIHOOK_ENTRY(USER32.DLL, OemToCharA)
  63. HOOK_END
  64. IMPLEMENT_SHIM_END