/* INCLUDES ******************************************************************/
#include <user32.h>
+#define NDEBUG
+#include <debug.h>
/* GLOBALS *******************************************************************/
/*
- * @unimplemented
+ * @implemented
*/
HKL STDCALL
GetKeyboardLayout(DWORD idThread)
{
- UNIMPLEMENTED;
- return (HKL)0;
+ return (HKL)NtUserCallOneParam((DWORD) idThread, ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT);
}
/*
- * @unimplemented
+ * @implemented
*/
UINT STDCALL
GetKBCodePage(VOID)
{
- UNIMPLEMENTED;
- return 0;
+ return GetOEMCP();
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL STDCALL
GetKeyboardLayoutNameA(LPSTR pwszKLID)
{
- UNIMPLEMENTED;
+ WCHAR buf[KL_NAMELENGTH];
+
+ if (GetKeyboardLayoutNameW(buf))
+ return WideCharToMultiByte( CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH, NULL, NULL ) != 0;
return FALSE;
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL STDCALL
GetKeyboardLayoutNameW(LPWSTR pwszKLID)
{
- UNIMPLEMENTED;
- return FALSE;
+ return NtUserGetKeyboardLayoutName( pwszKLID );
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL STDCALL
GetKeyboardState(PBYTE lpKeyState)
/*
- * @unimplemented
+ * @implemented
*/
int STDCALL
GetKeyboardType(int nTypeFlag)
{
- UNIMPLEMENTED;
- return 0;
+return (int)NtUserCallOneParam((DWORD) nTypeFlag, ONEPARAM_ROUTINE_GETKEYBOARDTYPE);
}
/*
- * @unimplemented
+ * @implemented
*/
HKL STDCALL
LoadKeyboardLayoutA(LPCSTR pwszKLID,
UINT Flags)
{
- UNIMPLEMENTED;
- return (HKL)0;
+ HKL ret;
+ UNICODE_STRING pwszKLIDW;
+
+ if (pwszKLID) RtlCreateUnicodeStringFromAsciiz(&pwszKLIDW, pwszKLID);
+ else pwszKLIDW.Buffer = NULL;
+
+ ret = LoadKeyboardLayoutW(pwszKLIDW.Buffer, Flags);
+ RtlFreeUnicodeString(&pwszKLIDW);
+ return ret;
+
}
/*
- * @unimplemented
- */
+ * @implemented
+ */
DWORD STDCALL
OemKeyScan(WORD wOemChar)
{
- UNIMPLEMENTED;
- return 0;
+ WCHAR p;
+ SHORT Vk;
+ UINT Scan;
+
+ MultiByteToWideChar(CP_OEMCP, 0, (PCSTR)&wOemChar, 1, &p, 1);
+ Vk = VkKeyScanW(p);
+ Scan = MapVirtualKeyW((Vk & 0x00ff), 0);
+ if(!Scan) return -1;
+ /*
+ Page 450-1, MS W2k SuperBible by SAMS. Return, low word has the
+ scan code and high word has the shift state.
+ */
+ return ((Vk & 0xff00) << 8) | Scan;
}
/*
- * @unimplemented
+ * @implemented
*/
HWND STDCALL
SetFocus(HWND hWnd)
/*
- * @unimplemented
+ * @implemented
*/
BOOL STDCALL
SetKeyboardState(LPBYTE lpKeyState)
/*
- * @unimplemented
+ * @implemented
*/
int STDCALL
ToUnicodeEx(UINT wVirtKey,
/*
- * @unimplemented
+ * @implemented
*/
SHORT STDCALL
VkKeyScanExW(WCHAR ch,
HKL dwhkl)
{
- UNIMPLEMENTED;
- return -1;
+ return (SHORT) NtUserVkKeyScanEx((DWORD) ch,(DWORD) dwhkl,(DWORD)NULL);
}