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.

79 lines
1.4 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. CorelDraw9JPN.cpp
  5. Abstract:
  6. The App has some RTF files, seems the font and charset specified not correct
  7. in it. When later on riched20 do ANSI-Unicode Code conversion, it used
  8. English code-page. Fix this by checking the 1st parameter passed to
  9. MultiByteToWideChar by richedit, if it's English, try to use CP_ACP, which
  10. is always safe.
  11. Notes:
  12. This is an app specific shim.
  13. History:
  14. 05/10/2001 xiaoz Created
  15. --*/
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(CorelDraw9JPN)
  18. #include "ShimHookMacro.h"
  19. APIHOOK_ENUM_BEGIN
  20. APIHOOK_ENUM_ENTRY(MultiByteToWideChar)
  21. APIHOOK_ENUM_END
  22. /*++
  23. Correct the code page if required.
  24. --*/
  25. int
  26. APIHOOK(MultiByteToWideChar)(
  27. UINT CodePage,
  28. DWORD dwFlags,
  29. LPCSTR lpMultiByteStr,
  30. int cbMultiByte,
  31. LPWSTR lpWideCharStr,
  32. int cchWideChar
  33. )
  34. {
  35. if (1252 == CodePage) {
  36. //
  37. // Change the code page
  38. //
  39. CodePage = CP_ACP;
  40. LOGN(eDbgLevelWarning, "Code page corrected");
  41. }
  42. return ORIGINAL_API(MultiByteToWideChar)(CodePage, dwFlags, lpMultiByteStr,
  43. cbMultiByte, lpWideCharStr, cchWideChar);
  44. }
  45. /*++
  46. Register hooked functions
  47. --*/
  48. HOOK_BEGIN
  49. APIHOOK_ENTRY(KERNEL32.DLL, MultiByteToWideChar)
  50. HOOK_END
  51. IMPLEMENT_SHIM_END