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.

99 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1990-1998 Microsoft Corporation, All Rights Reserved
  3. Module Name:
  4. TOASCII.C
  5. ++*/
  6. /**********************************************************************/
  7. #include "windows.h"
  8. #include "immdev.h"
  9. #include "fakeime.h"
  10. /**********************************************************************/
  11. /* ImeToAsciiEx */
  12. /* */
  13. /* HIBYTE of uVirtKey is char code now. */
  14. /**********************************************************************/
  15. UINT WINAPI ImeToAsciiEx (UINT uVKey,UINT uScanCode,CONST LPBYTE lpbKeyState,LPTRANSMSGLIST lpTransBuf,UINT fuState,HIMC hIMC)
  16. {
  17. LPARAM lParam;
  18. LPINPUTCONTEXT lpIMC;
  19. BOOL fOpen;
  20. ImeLog(LOGF_KEY | LOGF_API, TEXT("ImeToAsciiEx"));
  21. lpCurTransKey = lpTransBuf;
  22. lParam = ((DWORD)uScanCode << 16) + 1L;
  23. // Init uNumTransKey here.
  24. uNumTransKey = 0;
  25. // if hIMC is NULL, this means DISABLE IME.
  26. if (!hIMC)
  27. return 0;
  28. if (!(lpIMC = ImmLockIMC(hIMC)))
  29. return 0;
  30. fOpen = lpIMC->fOpen;
  31. ImmUnlockIMC(hIMC);
  32. // The current status of IME is "closed".
  33. if (!fOpen)
  34. goto itae_exit;
  35. if (uScanCode & 0x8000)
  36. IMEKeyupHandler( hIMC, uVKey, lParam, lpbKeyState);
  37. else
  38. IMEKeydownHandler( hIMC, uVKey, lParam, lpbKeyState);
  39. // Clear static value, no more generated message!
  40. lpCurTransKey = NULL;
  41. itae_exit:
  42. // If trans key buffer that is allocated by USER.EXE full up,
  43. // the return value is the negative number.
  44. if (fOverTransKey)
  45. {
  46. #ifdef DEBUG
  47. OutputDebugString((LPTSTR)TEXT("***************************************\r\n"));
  48. OutputDebugString((LPTSTR)TEXT("* TransKey OVER FLOW Messages!!! *\r\n"));
  49. OutputDebugString((LPTSTR)TEXT("* by FAKEIME.DLL *\r\n"));
  50. OutputDebugString((LPTSTR)TEXT("***************************************\r\n"));
  51. #endif
  52. return (int)uNumTransKey;
  53. }
  54. return (int)uNumTransKey;
  55. }
  56. /**********************************************************************/
  57. /* GenerateMessageToTransKey() */
  58. /* */
  59. /* Update the transrate key buffer. */
  60. /**********************************************************************/
  61. BOOL PASCAL GenerateMessageToTransKey(LPTRANSMSGLIST lpTransBuf,LPTRANSMSG lpGeneMsg)
  62. {
  63. LPTRANSMSG lpgmT0;
  64. uNumTransKey++;
  65. if (uNumTransKey >= lpTransBuf->uMsgCount)
  66. {
  67. fOverTransKey = TRUE;
  68. return FALSE;
  69. }
  70. lpgmT0= lpTransBuf->TransMsg + (uNumTransKey - 1);
  71. *lpgmT0= *lpGeneMsg;
  72. return TRUE;
  73. }