kbd101.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
#include <windows.h>
00010
#include <ime.h>
00011
#include "vkoem.h"
00012
#include "kbdjpn.h"
00013
#include "kbd101.h"
00014
00015
#if defined(_M_IA64)
00016
#pragma section(".data")
00017
#define ALLOC_SECTION_LDATA __declspec(allocate(".data"))
00018
#else
00019
#pragma data_seg(".data")
00020 #define ALLOC_SECTION_LDATA
00021
#endif
00022
00023
00024
00025
00026
00027 static ALLOC_SECTION_LDATA USHORT ausVK[] = {
00028 T00, T01, T02, T03, T04, T05, T06, T07,
00029 T08, T09, T0A, T0B, T0C, T0D, T0E, T0F,
00030 T10, T11, T12, T13, T14, T15, T16, T17,
00031 T18, T19, T1A, T1B, T1C, T1D, T1E, T1F,
00032 T20, T21, T22, T23, T24, T25, T26, T27,
00033 T28,
00034
00035
00036
00037
00038 T29 | KBDSPECIAL,
00039
00040 T2A, T2B, T2C, T2D, T2E, T2F,
00041 T30, T31, T32, T33, T34, T35,
00042
00043
00044
00045
00046 T36 | KBDEXT,
00047
00048
00049
00050
00051 T37 | KBDMULTIVK,
00052
00053 T38, T39,
00054
00055
00056
00057
00058 T3A | KBDSPECIAL,
00059
00060 T3B, T3C, T3D, T3E, T3F,
00061 T40, T41, T42, T43, T44,
00062
00063
00064
00065
00066
00067
00068 T45 | KBDEXT | KBDMULTIVK,
00069
00070 T46 | KBDMULTIVK,
00071
00072
00073
00074
00075
00076
00077 T47 | KBDNUMPAD | KBDSPECIAL,
00078 T48 | KBDNUMPAD | KBDSPECIAL,
00079 T49 | KBDNUMPAD | KBDSPECIAL,
00080 T4A,
00081 T4B | KBDNUMPAD | KBDSPECIAL,
00082 T4C | KBDNUMPAD | KBDSPECIAL,
00083 T4D | KBDNUMPAD | KBDSPECIAL,
00084 T4E,
00085 T4F | KBDNUMPAD | KBDSPECIAL,
00086 T50 | KBDNUMPAD | KBDSPECIAL,
00087 T51 | KBDNUMPAD | KBDSPECIAL,
00088 T52 | KBDNUMPAD | KBDSPECIAL,
00089 T53 | KBDNUMPAD | KBDSPECIAL,
00090
00091 T54, T55, T56, T57, T58, T59, T5A, T5B,
00092 T5C, T5D, T5E, T5F, T60, T61, T62, T63,
00093 T64, T65, T66, T67, T68, T69, T6A, T6B,
00094 T6C, T6D, T6E, T6F, T70, T71, T72, T73,
00095 T74, T75, T76, T77, T78, T79, T7A, T7B,
00096 T7C, T7D, T7E, T7F
00097
00098 };
00099
00100 static ALLOC_SECTION_LDATA VSC_VK
aE0VscToVk[] = {
00101 { 0x10, X10 | KBDEXT },
00102 { 0x19, X19 | KBDEXT },
00103 { 0x1C, X1C | KBDEXT },
00104 { 0x1D, X1D | KBDEXT },
00105 { 0x20, X20 | KBDEXT },
00106 { 0x21, X21 | KBDEXT },
00107 { 0x22, X22 | KBDEXT },
00108 { 0x24, X24 | KBDEXT },
00109 { 0x2E, X2E | KBDEXT },
00110 { 0x30, X30 | KBDEXT },
00111 { 0x32, X32 | KBDEXT },
00112 { 0x35, X35 | KBDEXT },
00113 { 0x37, X37 | KBDEXT },
00114 { 0x38, X38 | KBDEXT },
00115 { 0x46, X46 | KBDEXT },
00116 { 0x47, X47 | KBDEXT },
00117 { 0x48, X48 | KBDEXT },
00118 { 0x49, X49 | KBDEXT },
00119 { 0x4B, X4B | KBDEXT },
00120 { 0x4D, X4D | KBDEXT },
00121 { 0x4F, X4F | KBDEXT },
00122 { 0x50, X50 | KBDEXT },
00123 { 0x51, X51 | KBDEXT },
00124 { 0x52, X52 | KBDEXT },
00125 { 0x53, X53 | KBDEXT },
00126 { 0x5B, X5B | KBDEXT },
00127 { 0x5C, X5C | KBDEXT },
00128 { 0x5D, X5D | KBDEXT },
00129 { 0x5F, X5F | KBDEXT },
00130 { 0x65, X65 | KBDEXT },
00131 { 0x66, X66 | KBDEXT },
00132 { 0x67, X67 | KBDEXT },
00133 { 0x68, X68 | KBDEXT },
00134 { 0x69, X69 | KBDEXT },
00135 { 0x6A, X6A | KBDEXT },
00136 { 0x6B, X6B | KBDEXT },
00137 { 0x6C, X6C | KBDEXT },
00138 { 0x6D, X6D | KBDEXT },
00139 { 0, 0 }
00140 };
00141
00142 static ALLOC_SECTION_LDATA VSC_VK
aE1VscToVk[] = {
00143 { 0x1D, Y1D },
00144 { 0 , 0 }
00145 };
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 static ALLOC_SECTION_LDATA VK_TO_BIT
aVkToBits[] = {
00159 { VK_SHIFT, KBDSHIFT },
00160 { VK_CONTROL, KBDCTRL },
00161 { VK_MENU, KBDALT },
00162 { VK_KANA, KBDKANA },
00163 { 0, 0 }
00164 };
00165
00166
00167
00168
00169
00170
00171
00172
00173 static ALLOC_SECTION_LDATA MODIFIERS
CharModifiers = {
00174 &
aVkToBits[0],
00175 11,
00176 {
00177
00178
00179 0,
00180 1,
00181 4,
00182 6,
00183 SHFT_INVALID,
00184 SHFT_INVALID,
00185 SHFT_INVALID,
00186 SHFT_INVALID,
00187 2,
00188 3,
00189 5,
00190 7
00191 }
00192 };
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 static ALLOC_SECTION_LDATA VK_TO_WCHARS4
aVkToWch4[] = {
00220
00221
00222 {
'0' , KANALOK ,
'0' ,
')' ,
WCH_WA ,
WCH_WO },
00223 {
'1' , KANALOK ,
'1' ,
'!' ,
WCH_NU ,
WCH_NU },
00224 {
'3' , KANALOK ,
'3' ,
'#' ,
WCH_A ,
WCH_AA },
00225 {
'4' , KANALOK ,
'4' ,
'$' ,
WCH_U ,
WCH_UU },
00226 {
'5' , KANALOK ,
'5' ,
'%' ,
WCH_E ,
WCH_EE },
00227 {
'7' , KANALOK ,
'7' ,
'&' ,
WCH_YA ,
WCH_YAA },
00228 {
'8' , KANALOK ,
'8' ,
'*' ,
WCH_YU ,
WCH_YUU },
00229 {
'9' , KANALOK ,
'9' ,
'(' ,
WCH_YO ,
WCH_YOO },
00230 {
'A' , CAPLOK | KANALOK ,
'a' ,
'A' ,
WCH_TI ,
WCH_TI },
00231 {
'B' , CAPLOK | KANALOK ,
'b' ,
'B' ,
WCH_KO ,
WCH_KO },
00232 {
'C' , CAPLOK | KANALOK ,
'c' ,
'C' ,
WCH_SO ,
WCH_SO },
00233 {
'D' , CAPLOK | KANALOK ,
'd' ,
'D' ,
WCH_SI ,
WCH_SI },
00234 {
'E' , CAPLOK | KANALOK ,
'e' ,
'E' ,
WCH_I ,
WCH_II },
00235 {
'F' , CAPLOK | KANALOK ,
'f' ,
'F' ,
WCH_HA ,
WCH_HA },
00236 {
'G' , CAPLOK | KANALOK ,
'g' ,
'G' ,
WCH_KI ,
WCH_KI },
00237 {
'H' , CAPLOK | KANALOK ,
'h' ,
'H' ,
WCH_KU ,
WCH_KU },
00238 {
'I' , CAPLOK | KANALOK ,
'i' ,
'I' ,
WCH_NI ,
WCH_NI },
00239 {
'J' , CAPLOK | KANALOK ,
'j' ,
'J' ,
WCH_MA ,
WCH_MA },
00240 {
'K' , CAPLOK | KANALOK ,
'k' ,
'K' ,
WCH_NO ,
WCH_NO },
00241 {
'L' , CAPLOK | KANALOK ,
'l' ,
'L' ,
WCH_RI ,
WCH_RI },
00242 {
'M' , CAPLOK | KANALOK ,
'm' ,
'M' ,
WCH_MO ,
WCH_MO },
00243 {
'N' , CAPLOK | KANALOK ,
'n' ,
'N' ,
WCH_MI ,
WCH_MI },
00244 {
'O' , CAPLOK | KANALOK ,
'o' ,
'O' ,
WCH_RA ,
WCH_RA },
00245 {
'P' , CAPLOK | KANALOK ,
'p' ,
'P' ,
WCH_SE ,
WCH_SE },
00246 {
'Q' , CAPLOK | KANALOK ,
'q' ,
'Q' ,
WCH_TA ,
WCH_TA },
00247 {
'R' , CAPLOK | KANALOK ,
'r' ,
'R' ,
WCH_SU ,
WCH_SU },
00248 {
'S' , CAPLOK | KANALOK ,
's' ,
'S' ,
WCH_TO ,
WCH_TO },
00249 {
'T' , CAPLOK | KANALOK ,
't' ,
'T' ,
WCH_KA ,
WCH_KA },
00250 {
'U' , CAPLOK | KANALOK ,
'u' ,
'U' ,
WCH_NA ,
WCH_NA },
00251 {
'V' , CAPLOK | KANALOK ,
'v' ,
'V' ,
WCH_HI ,
WCH_HI },
00252 {
'W' , CAPLOK | KANALOK ,
'w' ,
'W' ,
WCH_TE ,
WCH_TE },
00253 {
'X' , CAPLOK | KANALOK ,
'x' ,
'X' ,
WCH_SA ,
WCH_SA },
00254 {
'Y' , CAPLOK | KANALOK ,
'y' ,
'Y' ,
WCH_NN ,
WCH_NN },
00255 {
'Z' , CAPLOK | KANALOK ,
'z' ,
'Z' ,
WCH_TU ,
WCH_TUU },
00256 {VK_OEM_1 , KANALOK ,
';' ,
':' ,
WCH_RE ,
WCH_RE },
00257 {VK_OEM_2 , KANALOK ,
'/' ,
'?' ,
WCH_ME ,
WCH_MD },
00258 {VK_OEM_3 , KANALOK ,
'`' ,
'~' ,
WCH_RO ,
WCH_RO },
00259 {VK_OEM_7 , KANALOK ,0x27 ,
'"' ,
WCH_KE ,
WCH_KE },
00260 {VK_OEM_8 , 0 ,WCH_NONE ,WCH_NONE ,WCH_NONE,WCH_NONE},
00261 {VK_OEM_COMMA , KANALOK ,
',' ,
'<' ,
WCH_NE ,
WCH_IC },
00262 {VK_OEM_PERIOD, KANALOK ,
'.' ,
'>' ,
WCH_RU ,
WCH_IP },
00263 {VK_OEM_PLUS , KANALOK ,
'=' ,
'+' ,
WCH_HE ,
WCH_HE },
00264 {VK_TAB , 0 ,
'\t' ,
'\t' ,
'\t' ,
'\t' },
00265 {VK_ADD , 0 ,
'+' ,
'+' ,
'+' ,
'+' },
00266 {VK_DECIMAL , 0 ,
'.' ,
'.' ,
'.' ,
'.' },
00267 {VK_DIVIDE , 0 ,
'/' ,
'/' ,
'/' ,
'/' },
00268 {VK_MULTIPLY , 0 ,
'*' ,
'*' ,
'*' ,
'*' },
00269 {VK_SUBTRACT , 0 ,
'-' ,
'-' ,
'-' ,
'-' },
00270 {0 , 0 ,0 ,0 ,0 ,0 }
00271 };
00272
00273 static ALLOC_SECTION_LDATA VK_TO_WCHARS6
aVkToWch6[] = {
00274
00275
00276 {VK_BACK , 0 ,
'\b' ,
'\b' ,
'\b' ,
'\b' , 0x7f , 0x7f },
00277 {VK_CANCEL , 0 ,0x03 ,0x03 ,0x03 ,0x03 , 0x03 , 0x03 },
00278 {VK_ESCAPE , 0 ,0x1b ,0x1b ,0x1b ,0x1b , 0x1b , 0x1b },
00279 {VK_OEM_4 , KANALOK ,
'[' ,
'{' ,
WCH_VS ,
WCH_OB , 0x1b , 0x1b },
00280 {VK_OEM_5 , KANALOK ,
'\\' ,
'|' ,
WCH_MU ,
WCH_MU , 0x1c , 0x1c },
00281 {VK_OEM_102 , KANALOK ,
'\\' ,
'|' ,
WCH_MU ,
WCH_MU , 0x1c , 0x1c },
00282 {VK_OEM_6 , KANALOK ,
']' ,
'}' ,
WCH_SVS ,
WCH_CB , 0x1d , 0x1d },
00283 {VK_RETURN , 0 ,
'\r' ,
'\r' ,
'\r' ,
'\r' ,
'\n' ,
'\n' },
00284 {VK_SPACE , 0 ,
' ' ,
' ' ,
' ' ,
' ' , 0x20 , 0x20 },
00285 {0 , 0 ,0 ,0 ,0 ,0 , 0 , 0 }
00286 };
00287
00288 static ALLOC_SECTION_LDATA VK_TO_WCHARS8
aVkToWch8[] = {
00289
00290
00291 {
'2' , KANALOK ,
'2' ,
'@' ,
WCH_HU ,
WCH_HU , WCH_NONE , WCH_NONE , 0x00 , 0x00 },
00292 {
'6' , KANALOK ,
'6' ,
'^' ,
WCH_O ,
WCH_OO , WCH_NONE , WCH_NONE , 0x1e , 0x1e },
00293 {VK_OEM_MINUS , KANALOK ,
'-' ,
'_' ,
WCH_HO ,
WCH_PS , WCH_NONE , WCH_NONE , 0x1f , 0x1f },
00294 {0 , 0 ,0 ,0 ,0 ,0 , 0 , 0 , 0 , 0 }
00295 };
00296
00297
00298
00299
00300
00301 static ALLOC_SECTION_LDATA VK_TO_WCHARS4
aVkToWch1[] = {
00302
00303
00304 { VK_NUMPAD0 , 0 ,
'0' , WCH_NONE ,
'0' ,WCH_NONE},
00305 { VK_NUMPAD1 , 0 ,
'1' , WCH_NONE ,
'1' ,WCH_NONE},
00306 { VK_NUMPAD2 , 0 ,
'2' , WCH_NONE ,
'2' ,WCH_NONE},
00307 { VK_NUMPAD3 , 0 ,
'3' , WCH_NONE ,
'3' ,WCH_NONE},
00308 { VK_NUMPAD4 , 0 ,
'4' , WCH_NONE ,
'4' ,WCH_NONE},
00309 { VK_NUMPAD5 , 0 ,
'5' , WCH_NONE ,
'5' ,WCH_NONE},
00310 { VK_NUMPAD6 , 0 ,
'6' , WCH_NONE ,
'6' ,WCH_NONE},
00311 { VK_NUMPAD7 , 0 ,
'7' , WCH_NONE ,
'7' ,WCH_NONE},
00312 { VK_NUMPAD8 , 0 ,
'8' , WCH_NONE ,
'8' ,WCH_NONE},
00313 { VK_NUMPAD9 , 0 ,
'9' , WCH_NONE ,
'9' ,WCH_NONE},
00314 { 0 , 0 ,
'\0' , 0 , 0 ,0 }
00315 };
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330 static ALLOC_SECTION_LDATA VK_TO_WCHAR_TABLE
aVkToWcharTable[] = {
00331 { (PVK_TO_WCHARS1)
aVkToWch6, 6,
sizeof(
aVkToWch6[0]) },
00332 { (PVK_TO_WCHARS1)
aVkToWch8, 8,
sizeof(
aVkToWch8[0]) },
00333 { (PVK_TO_WCHARS1)
aVkToWch4, 4,
sizeof(
aVkToWch4[0]) },
00334 { (PVK_TO_WCHARS1)
aVkToWch1, 4,
sizeof(
aVkToWch1[0]) },
00335 {
NULL, 0, 0 }
00336 };
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 static ALLOC_SECTION_LDATA VSC_LPWSTR
aKeyNames[] = {
00348 0x01,
L"Esc",
00349 0x0e,
L"Backspace",
00350 0x0f,
L"Tab",
00351 0x1c,
L"Enter",
00352 0x1d,
L"Ctrl",
00353 0x2a,
L"Shift",
00354 0x36,
L"Right Shift",
00355 0x37,
L"Num *",
00356 0x38,
L"Alt",
00357 0x39,
L"Space",
00358 0x3a,
L"Caps Lock",
00359 0x3b,
L"F1",
00360 0x3c,
L"F2",
00361 0x3d,
L"F3",
00362 0x3e,
L"F4",
00363 0x3f,
L"F5",
00364 0x40,
L"F6",
00365 0x41,
L"F7",
00366 0x42,
L"F8",
00367 0x43,
L"F9",
00368 0x44,
L"F10",
00369 0x45,
L"Pause",
00370 0x46,
L"Scroll Lock",
00371 0x47,
L"Num 7",
00372 0x48,
L"Num 8",
00373 0x49,
L"Num 9",
00374 0x4a,
L"Num -",
00375 0x4b,
L"Num 4",
00376 0x4c,
L"Num 5",
00377 0x4d,
L"Num 6",
00378 0x4e,
L"Num +",
00379 0x4f,
L"Num 1",
00380 0x50,
L"Num 2",
00381 0x51,
L"Num 3",
00382 0x52,
L"Num 0",
00383 0x53,
L"Num Del",
00384 0x54,
L"Sys Req",
00385 0x57,
L"F11",
00386 0x58,
L"F12",
00387 0x7C,
L"F13",
00388 0x7D,
L"F14",
00389 0x7E,
L"F15",
00390 0x7F,
L"F16",
00391 0x80,
L"F17",
00392 0x81,
L"F18",
00393 0x82,
L"F19",
00394 0x83,
L"F20",
00395 0x84,
L"F21",
00396 0x85,
L"F22",
00397 0x86,
L"F23",
00398 0x87,
L"F24",
00399 0 ,
NULL
00400 };
00401
00402 static ALLOC_SECTION_LDATA VSC_LPWSTR
aKeyNamesExt[] = {
00403 0x1c,
L"Num Enter",
00404 0x1d,
L"Right Control",
00405 0x35,
L"Num /",
00406 0x37,
L"Prnt Scrn",
00407 0x38,
L"Right Alt",
00408 0x45,
L"Num Lock",
00409 0x46,
L"Break",
00410 0x47,
L"Home",
00411 0x48,
L"Up",
00412 0x49,
L"Page Up",
00413 0x4b,
L"Left",
00414 0x4d,
L"Right",
00415 0x4f,
L"End",
00416 0x50,
L"Down",
00417 0x51,
L"Page Down",
00418 0x52,
L"Insert",
00419 0x53,
L"Delete",
00420 0x5B,
L"Left Windows",
00421 0x5C,
L"Right Windows",
00422 0x5D,
L"Application",
00423 0 ,
NULL
00424 };
00425
00426 static ALLOC_SECTION_LDATA KBDTABLES
KbdTables = {
00427
00428
00429
00430 &
CharModifiers,
00431
00432
00433
00434
00435
aVkToWcharTable,
00436
00437
00438
00439
00440
NULL,
00441
00442
00443
00444
00445
aKeyNames,
00446
aKeyNamesExt,
00447
NULL,
00448
00449
00450
00451
00452
ausVK,
00453
sizeof(
ausVK) /
sizeof(
ausVK[0]),
00454
aE0VscToVk,
00455
aE1VscToVk,
00456
00457
00458
00459
00460 0
00461 };
00462
00463 PKBDTABLES
KbdLayerDescriptor(VOID)
00464 {
00465
return &
KbdTables;
00466 }
00467
00468
00469
00470
00471
00472
00473 static ALLOC_SECTION_LDATA VK_F
VkToFuncTable_101[] = {
00474 {
00475 VK_CAPITAL,
00476 KBDNLS_TYPE_TOGGLE,
00477 KBDNLS_INDEX_NORMAL,
00478 0x08,
00479 {
00480 {KBDNLS_SEND_BASE_VK,0},
00481 {KBDNLS_ALPHANUM,0},
00482 {KBDNLS_HIRAGANA,0},
00483 {KBDNLS_SEND_PARAM_VK,VK_KANA},
00484 {KBDNLS_KATAKANA,0},
00485 {KBDNLS_SEND_BASE_VK,0},
00486 {KBDNLS_SEND_BASE_VK,0},
00487 {KBDNLS_SEND_BASE_VK,0}
00488 },
00489 {
00490 {KBDNLS_SEND_PARAM_VK,VK_KANA},
00491 {KBDNLS_SEND_PARAM_VK,VK_KANA},
00492 {KBDNLS_SEND_PARAM_VK,VK_KANA},
00493 {KBDNLS_SEND_PARAM_VK,VK_KANA},
00494 {KBDNLS_SEND_BASE_VK,0},
00495 {KBDNLS_SEND_BASE_VK,0},
00496 {KBDNLS_SEND_BASE_VK,0},
00497 {KBDNLS_SEND_BASE_VK,0}
00498 }
00499 },
00500 {
00501 VK_OEM_3,
00502 KBDNLS_TYPE_NORMAL,
00503 KBDNLS_INDEX_NORMAL,
00504 0,
00505 {
00506 {KBDNLS_SEND_BASE_VK,0},
00507 {KBDNLS_SEND_BASE_VK,0},
00508 {KBDNLS_SBCSDBCS,0},
00509 {KBDNLS_SEND_BASE_VK,0},
00510 {KBDNLS_SEND_PARAM_VK,VK_KANJI},
00511 {KBDNLS_SEND_BASE_VK,0},
00512 {KBDNLS_SEND_BASE_VK,0},
00513 {KBDNLS_SEND_BASE_VK,0}
00514 },
00515 {
00516 {KBDNLS_NULL,0},
00517 {KBDNLS_NULL,0},
00518 {KBDNLS_NULL,0},
00519 {KBDNLS_NULL,0},
00520 {KBDNLS_NULL,0},
00521 {KBDNLS_NULL,0},
00522 {KBDNLS_NULL,0},
00523 {KBDNLS_NULL,0}
00524 }
00525 }
00526 };
00527
00528
00529
00530
00531
00532
00533 static ALLOC_SECTION_LDATA KBDNLSTABLES
KbdNlsTables = {
00534 0,
00535 0,
00536 2,
00537
VkToFuncTable_101,
00538 0,
00539
NULL
00540 };
00541
00542 PKBDNLSTABLES
KbdNlsLayerDescriptor(VOID)
00543 {
00544
return &
KbdNlsTables;
00545 }
00546
Generated on Sat May 15 19:40:32 2004 for test by
1.3.7