Source code of Windows XP (NT5)
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.

159 lines
5.0 KiB

  1. /***************************************************************************************************
  2. **
  3. ** MODULE:
  4. **
  5. **
  6. ** DESCRIPTION:
  7. **
  8. **
  9. ** AUTHOR: Daniel Dean.
  10. **
  11. **
  12. **
  13. ** CREATED:
  14. **
  15. **
  16. **
  17. **
  18. ** (C) C O P Y R I G H T D A N I E L D E A N 1 9 9 6.
  19. ***************************************************************************************************/
  20. #include <hidsdi.h>
  21. #define SUCCESS 0
  22. #define FAILURE (!SUCCESS)
  23. #define WINDOWMENU 1 /* position of window menu */
  24. #ifdef RC_INVOKED
  25. #define ID(id) id
  26. #else
  27. #define ID(id) MAKEINTRESOURCE(id)
  28. #endif
  29. // Extra bytes associated with each child window
  30. #define CBWNDEXTRA sizeof(ULONG)*5
  31. #define SetDeviceHandle(pw, h) SetWindowLong(pw, 0, (LONG) h)
  32. #define GetDeviceHandle(w) (HANDLE)GetWindowLong(w, 0)
  33. #define SetEditWin(pw, w) SetWindowLong(pw, 4, (LONG) w)
  34. #define GetEditWin(w) (HWND)GetWindowLong(w, 4)
  35. #define SetThreadData(pw, p) SetWindowLong(pw, 8, (LONG) p)
  36. #define GetThreadData(w) (PREADTHREAD)GetWindowLong(w, 8)
  37. #define SetThreadDataSize(pw,p) SetWindowLong(pw,12,(ULONG) p)
  38. #define GetThreadDataSize(w) (ULONG)GetWindowLong(w, 12)
  39. #define SetDeviceInfo(pw,p) SetWindowLong(pw,16,(ULONG) p)
  40. #define GetDeviceInfo(w) (ULONG)GetWindowLong(w, 16)
  41. #define EDIT_WRAP (WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_AUTOVSCROLL | ES_MULTILINE | ES_LEFT)
  42. /* resource ID's */
  43. #define IDHIDFRAME ID(1)
  44. #define IDHIDCHILD ID(2)
  45. #define IDHIDMENU ID(3)
  46. #define IDS_CLIENTTITLE 16
  47. #define IDS_UNTITLED 17
  48. #define IDS_APPNAME 18
  49. #define IDD_CHANNELDIALOG 102
  50. #define IDC_ITEMLIST 1000
  51. #define IDC_NEXT 1001
  52. #define IDM_FILENEW 1001
  53. #define IDM_FILEEXIT 1006
  54. #define IDM_FILEREENUM 1007
  55. #define IDM_DEVICECHANGE 1008
  56. #define IDM_CHANNEL 2001
  57. #define IDM_DEVICE 2002
  58. #define IDM_ENABLE 2003
  59. #define IDM_DISABLE 2004
  60. #define IDM_READ 2005
  61. #define IDM_WRITE 2006
  62. #define IDM_STOP 2007
  63. #define IDEDIT 3001
  64. #define IDM_WINDOWTILE 4001
  65. #define IDM_WINDOWCASCADE 4002
  66. #define IDM_WINDOWCLOSEALL 4003
  67. #define IDM_WINDOWICONS 4004
  68. #define IDM_WINDOWCHILD 4100
  69. #define IDT_TIMER 5000
  70. #define METHOD_BUFFERED 0
  71. #define METHOD_IN_DIRECT 1
  72. #define METHOD_OUT_DIRECT 2
  73. #define METHOD_NEITHER 3
  74. #define FILE_DEVICE_MOUSE 0x0000000f
  75. //
  76. // Define the access check value for any access
  77. //
  78. //
  79. // The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
  80. // ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
  81. // constants *MUST* always be in sync.
  82. //
  83. #define FILE_ANY_ACCESS 0
  84. #define FILE_READ_ACCESS ( 0x0001 ) // file & pipe
  85. #define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe
  86. #define CTL_CODE( DeviceType, Function, Method, Access ) ( \
  87. ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
  88. )
  89. /* Structs */
  90. //
  91. // Every MDI child window has one of these structures
  92. // associated with it.
  93. typedef struct _CHILDINFO{
  94. PHIDP_PREPARSED_DATA hidPPData; // Pointer the preparsed data for this device
  95. ULONG ulMaxUsageListLen; // Max usages returned from HidP_GetUsage
  96. PHIDP_CAPS hidCaps; // Pointer to struct containing capabilitis for this device
  97. PHIDP_VALUE_CAPS pValueCaps; // Pointer to a list of Value channel description structs
  98. ULONG NumValues; // Number of Value channels on this device
  99. PHIDP_BUTTON_CAPS pButtonCaps; // Pointer to a list of Button channel description structs
  100. ULONG NumButtons; // Number of Button channels on this device
  101. } CHILD_INFO, *PCHILD_INFO;
  102. /* External variable declarations */
  103. extern HANDLE hInst; /* application instance handle */
  104. extern HWND hWndFrame; /* main window handle */
  105. extern HWND hWndMDIClient; /* handle of MDI Client window */
  106. extern LONG styleDefault; /* default child creation state */
  107. extern char szChild[]; /* class of child */
  108. /* External functions */
  109. ULONG InitializeApplication(VOID);
  110. ULONG InitializeInstance(LPSTR, INT);
  111. VOID OpenClassObjects(VOID);
  112. HWND MakeNewChild(PCHAR pName, HANDLE hDevice);
  113. VOID CommandHandler(HWND hWnd, UINT uParam);
  114. VOID CloseAllChildren (VOID);
  115. LONG WINAPI HIDFrameWndProc(HWND, UINT, WPARAM, LPARAM);
  116. LONG WINAPI HIDMDIChildWndProc(HWND, UINT, WPARAM, LPARAM);
  117. LRESULT PopUpMenu(HANDLE hInst, HWND hWnd, HWND hMWnd, LPARAM lPoint, LPSTR lpMenu);
  118. void GetDeviceDescription(char *,char *);
  119. BOOL CALLBACK ChannelDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);