Release 1.6-rc2.
[wine/testsucceed.git] / dlls / keyboard.drv16 / keyboard.c
blobf42ee4bb411367e73ea37df3857fc487b81430e2
1 /*
2 * KEYBOARD driver
4 * Copyright 1993 Bob Amstadt
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1997 David Faure
7 * Copyright 1998 Morten Welinder
8 * Copyright 1998 Ulrich Weigand
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <ctype.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "winerror.h"
35 #include "wine/winuser16.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
40 #include "pshpack1.h"
41 typedef struct _KBINFO
43 BYTE Begin_First_Range;
44 BYTE End_First_Range;
45 BYTE Begin_Second_Range;
46 BYTE End_Second_Range;
47 WORD StateSize;
48 } KBINFO, *LPKBINFO;
49 #include "poppack.h"
51 static FARPROC16 DefKeybEventProc;
52 static LPBYTE pKeyStateTable;
54 /***********************************************************************
55 * Inquire (KEYBOARD.1)
57 WORD WINAPI Inquire16(LPKBINFO kbInfo)
59 kbInfo->Begin_First_Range = 0;
60 kbInfo->End_First_Range = 0;
61 kbInfo->Begin_Second_Range = 0;
62 kbInfo->End_Second_Range = 0;
63 kbInfo->StateSize = 16;
65 return sizeof(KBINFO);
68 /***********************************************************************
69 * Enable (KEYBOARD.2)
71 VOID WINAPI Enable16( FARPROC16 proc, LPBYTE lpKeyState )
73 DefKeybEventProc = proc;
74 pKeyStateTable = lpKeyState;
76 memset( lpKeyState, 0, 256 ); /* all states to false */
79 /***********************************************************************
80 * Disable (KEYBOARD.3)
82 VOID WINAPI Disable16(VOID)
84 DefKeybEventProc = NULL;
85 pKeyStateTable = NULL;
88 /****************************************************************************
89 * ToAscii (KEYBOARD.4)
91 INT16 WINAPI ToAscii16(UINT16 virtKey,UINT16 scanCode, LPBYTE lpKeyState,
92 LPVOID lpChar, UINT16 flags)
94 return ToAscii( virtKey, scanCode, lpKeyState, lpChar, flags );
97 /***********************************************************************
98 * AnsiToOem (KEYBOARD.5)
100 INT16 WINAPI AnsiToOem16( LPCSTR s, LPSTR d )
102 CharToOemA( s, d );
103 return -1;
106 /***********************************************************************
107 * OemToAnsi (KEYBOARD.6)
109 INT16 WINAPI OemToAnsi16( LPCSTR s, LPSTR d )
111 OemToCharA( s, d );
112 return -1;
115 /**********************************************************************
116 * SetSpeed (KEYBOARD.7)
118 WORD WINAPI SetSpeed16(WORD unused)
120 FIXME("(%04x): stub\n", unused);
121 return 0xffff;
124 /**********************************************************************
125 * ScreenSwitchEnable (KEYBOARD.100)
127 VOID WINAPI ScreenSwitchEnable16(WORD unused)
129 FIXME("(%04x): stub\n", unused);
132 /**********************************************************************
133 * OemKeyScan (KEYBOARD.128)
135 DWORD WINAPI OemKeyScan16(WORD wOemChar)
137 return OemKeyScan( wOemChar );
140 /**********************************************************************
141 * VkKeyScan (KEYBOARD.129)
143 WORD WINAPI VkKeyScan16(CHAR cChar)
145 return VkKeyScanA( cChar );
148 /******************************************************************************
149 * GetKeyboardType (KEYBOARD.130)
151 INT16 WINAPI GetKeyboardType16(INT16 nTypeFlag)
153 return GetKeyboardType( nTypeFlag );
156 /******************************************************************************
157 * MapVirtualKey (KEYBOARD.131)
159 * MapVirtualKey translates keycodes from one format to another
161 UINT16 WINAPI MapVirtualKey16(UINT16 wCode, UINT16 wMapType)
163 return MapVirtualKeyA(wCode,wMapType);
166 /****************************************************************************
167 * GetKBCodePage (KEYBOARD.132)
169 INT16 WINAPI GetKBCodePage16(void)
171 return GetKBCodePage();
174 /****************************************************************************
175 * GetKeyNameText (KEYBOARD.133)
177 INT16 WINAPI GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
179 return GetKeyNameTextA( lParam, lpBuffer, nSize );
182 /***********************************************************************
183 * AnsiToOemBuff (KEYBOARD.134)
185 void WINAPI AnsiToOemBuff16( LPCSTR s, LPSTR d, UINT16 len )
187 if (len != 0) CharToOemBuffA( s, d, len );
190 /***********************************************************************
191 * OemToAnsiBuff (KEYBOARD.135)
193 void WINAPI OemToAnsiBuff16( LPCSTR s, LPSTR d, UINT16 len )
195 if (len != 0) OemToCharBuffA( s, d, len );