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.

176 lines
3.8 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WKBMAN.C
  8. * WOW32 16-bit Keyboard API support (manually-coded thunks)
  9. *
  10. * History:
  11. * Created 27-Jan-1991 by Jeff Parsons (jeffpar)
  12. * Modified 13-Jan-1992 by Nandurir . Added all the code.
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. MODNAME(wkbman.c);
  17. ULONG FASTCALL WKB32ToAscii(PVDMFRAME pFrame)
  18. {
  19. ULONG ul;
  20. register PTOASCII16 parg16;
  21. LPSTR lpstrT;
  22. LPVOID lpvoidT;
  23. GETARGPTR(pFrame, sizeof(TOASCII16), parg16);
  24. GETPSZPTR(parg16->f3, lpstrT);
  25. GETMISCPTR(parg16->f4, lpvoidT);
  26. ul = ToAscii((WORD)(parg16->f1),
  27. (WORD)(parg16->f2),
  28. lpstrT,
  29. lpvoidT,
  30. (WORD)(parg16->f5));
  31. FREEPSZPTR(lpstrT);
  32. FLUSHVDMPTR(parg16->f4, 4, lpvoidT);
  33. FREEMISCPTR(lpvoidT);
  34. FREEARGPTR(parg16);
  35. RETURN(ul);
  36. }
  37. ULONG FASTCALL WKB32OemKeyScan(PVDMFRAME pFrame)
  38. {
  39. ULONG ul;
  40. register POEMKEYSCAN16 parg16;
  41. GETARGPTR(pFrame, sizeof(OEMKEYSCAN16), parg16);
  42. ul = (ULONG)OemKeyScan((WORD)(parg16->f1));
  43. FREEARGPTR(parg16);
  44. RETURN(ul);
  45. }
  46. ULONG FASTCALL WKB32VkKeyScan(PVDMFRAME pFrame)
  47. {
  48. ULONG ul;
  49. register PVKKEYSCAN16 parg16;
  50. GETARGPTR(pFrame, sizeof(VKKEYSCAN16), parg16);
  51. ul = (ULONG)VkKeyScan((CHAR)(parg16->f1));
  52. FREEARGPTR(parg16);
  53. RETURN(ul);
  54. }
  55. ULONG FASTCALL WKB32GetKeyboardType(PVDMFRAME pFrame)
  56. {
  57. ULONG ul;
  58. register PGETKEYBOARDTYPE16 parg16;
  59. GETARGPTR(pFrame, sizeof(GETKEYBOARDTYPE16), parg16);
  60. ul = GetKeyboardType(INT32(parg16->f1));
  61. FREEARGPTR(parg16);
  62. RETURN(ul);
  63. }
  64. ULONG FASTCALL WKB32MapVirtualKey(PVDMFRAME pFrame)
  65. {
  66. ULONG ul;
  67. register PMAPVIRTUALKEY16 parg16;
  68. GETARGPTR(pFrame, sizeof(MAPVIRTUALKEY16), parg16);
  69. ul = MapVirtualKey((UINT)(parg16->f1), (UINT)(parg16->f2));
  70. // MapVirtualKey sets the high bit (Win16 & Win32) to indicate diacritic
  71. if (ul & 0x80000000) {
  72. ul |= 0x8000;
  73. }
  74. FREEARGPTR(parg16);
  75. RETURN(ul);
  76. }
  77. ULONG FASTCALL WKB32GetKBCodePage(PVDMFRAME pFrame)
  78. {
  79. ULONG ul;
  80. ul = (ULONG)GetKBCodePage();
  81. RETURN(ul);
  82. }
  83. ULONG FASTCALL WKB32GetKeyNameText(PVDMFRAME pFrame)
  84. {
  85. ULONG ul;
  86. register PGETKEYNAMETEXT16 parg16;
  87. LPSTR lpstrT;
  88. GETARGPTR(pFrame, sizeof(GETKEYNAMETEXT16), parg16);
  89. GETPSZPTR(parg16->f2, lpstrT);
  90. ul = (ULONG)GetKeyNameText(DWORD32(parg16->f1), lpstrT,
  91. (INT)(WORD)(parg16->f3));
  92. FLUSHVDMPTR(parg16->f2, (WORD) (parg16->f3), lpstrT);
  93. FREEPSZPTR(lpstrT);
  94. FREEARGPTR(parg16);
  95. RETURN(ul);
  96. }
  97. ULONG FASTCALL WKB32AnsiToOemBuff(PVDMFRAME pFrame)
  98. {
  99. ULONG ul;
  100. register PANSITOOEMBUFF16 parg16;
  101. LPSTR lpstrAnsi, lpstrOem;
  102. GETARGPTR(pFrame, sizeof(ANSITOOEMBUFF16), parg16);
  103. GETPSZPTR(parg16->f1, lpstrAnsi);
  104. GETPSZPTR(parg16->f2, lpstrOem);
  105. ul = AnsiToOemBuff(lpstrAnsi, lpstrOem, (DWORD)(WORD)(parg16->f3));
  106. FLUSHVDMPTR(parg16->f2, ((parg16->f3) ? (parg16->f3) : 0xFFFF), lpstrOem);
  107. FREEPSZPTR(lpstrAnsi);
  108. FREEPSZPTR(lpstrOem);
  109. FREEARGPTR(parg16);
  110. RETURN(ul);
  111. }
  112. ULONG FASTCALL WKB32OemToAnsiBuff(PVDMFRAME pFrame)
  113. {
  114. ULONG ul;
  115. register POEMTOANSIBUFF16 parg16;
  116. LPSTR lpstrAnsi, lpstrOem;
  117. GETARGPTR(pFrame, sizeof(OEMTOANSIBUFF16), parg16);
  118. GETPSZPTR(parg16->f1, lpstrOem);
  119. GETPSZPTR(parg16->f2, lpstrAnsi);
  120. ul = (ULONG)OemToAnsiBuff(lpstrOem, lpstrAnsi, (DWORD)(WORD)(parg16->f3));
  121. FLUSHVDMPTR(parg16->f2, ((parg16->f3) ? (parg16->f3) : 0xFFFF), lpstrAnsi);
  122. FREEPSZPTR(lpstrOem);
  123. FREEPSZPTR(lpstrAnsi);
  124. FREEARGPTR(parg16);
  125. RETURN(ul);
  126. }