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.

108 lines
3.2 KiB

  1. /*****************************************************************************
  2. *
  3. * DILib1.c
  4. *
  5. * Copyright (c) 1996 Microsoft Corporation. All Rights Reserved.
  6. *
  7. * Abstract:
  8. *
  9. * Objects exported statically into our library.
  10. *
  11. * Contents:
  12. *
  13. * c_dfDIKeyboard
  14. *
  15. *****************************************************************************/
  16. #include "dinputpr.h"
  17. /*****************************************************************************
  18. *
  19. * @doc INTERNAL
  20. *
  21. * @global DIOBJECTDATAFORMAT | c_rgdoiDIKbd[] |
  22. *
  23. * Device object data formats for keyboard-style access.
  24. *
  25. * @doc EXTERNAL
  26. *
  27. * @global DIDATAFORMAT | c_dfDIKeyboard |
  28. *
  29. * A predefined <t DIDATAFORMAT> structure which describes a
  30. * keyboard device. This object is provided in the
  31. * DINPUT.LIB library file as a convenience.
  32. *
  33. * A pointer to this structure may be passed to
  34. * <mf IDirectInputDevice::SetDataFormat> to indicate that
  35. * the device will be accessed in the form of a keyboard.
  36. *
  37. * When a device has been set to the keyboard data format,
  38. * the <mf IDirectInputDevice::GetDeviceState> function
  39. * behaves in the same way as the Windows <f GetKeyboardState>
  40. * function: The device state is stored in an array of
  41. * 256 bytes, with each byte corresponding to the state
  42. * of a key. For example, if high bit of the <c DIK_ENTER>'th
  43. * byte is set, then the Enter key is being held down.
  44. *
  45. * When a device has been set to the keyboard data format,
  46. * the <mf IDirectInputDevice::GetDeviceData> function
  47. * returns a <t DIDEVICEOBJECTDATA> whose <p dwOfs>
  48. * field is a <c DIK_*> value which describes the
  49. * key which was pressed or released.
  50. *
  51. *****************************************************************************/
  52. #pragma BEGIN_CONST_DATA
  53. #define MAKEODF(b) \
  54. { &GUID_Key, b, \
  55. DIDFT_BUTTON | DIDFT_MAKEINSTANCE(b) | 0x80000000, } \
  56. #define MAKEODF16(b) \
  57. MAKEODF(b+0x00), \
  58. MAKEODF(b+0x01), \
  59. MAKEODF(b+0x02), \
  60. MAKEODF(b+0x03), \
  61. MAKEODF(b+0x04), \
  62. MAKEODF(b+0x05), \
  63. MAKEODF(b+0x06), \
  64. MAKEODF(b+0x07), \
  65. MAKEODF(b+0x08), \
  66. MAKEODF(b+0x09), \
  67. MAKEODF(b+0x0A), \
  68. MAKEODF(b+0x0B), \
  69. MAKEODF(b+0x0C), \
  70. MAKEODF(b+0x0D), \
  71. MAKEODF(b+0x0E), \
  72. MAKEODF(b+0x0F) \
  73. static DIOBJECTDATAFORMAT c_rgodfDIKeyboard[] = {
  74. MAKEODF16(0x00),
  75. MAKEODF16(0x10),
  76. MAKEODF16(0x20),
  77. MAKEODF16(0x30),
  78. MAKEODF16(0x40),
  79. MAKEODF16(0x50),
  80. MAKEODF16(0x60),
  81. MAKEODF16(0x70),
  82. MAKEODF16(0x80),
  83. MAKEODF16(0x90),
  84. MAKEODF16(0xA0),
  85. MAKEODF16(0xB0),
  86. MAKEODF16(0xC0),
  87. MAKEODF16(0xD0),
  88. MAKEODF16(0xE0),
  89. MAKEODF16(0xF0),
  90. };
  91. const DIDATAFORMAT c_dfDIKeyboard = {
  92. sizeof(DIDATAFORMAT),
  93. sizeof(DIOBJECTDATAFORMAT),
  94. DIDF_RELAXIS,
  95. 256,
  96. cA(c_rgodfDIKeyboard),
  97. c_rgodfDIKeyboard,
  98. };
  99. #pragma END_CONST_DATA