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.

145 lines
2.9 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. PURPOSE.
  7. Module Name:
  8. TESTAPP.h
  9. Abstract:
  10. Author:
  11. Eliyas Yakub
  12. Environment:
  13. Revision History:
  14. --*/
  15. #ifndef __TESTAPP_H
  16. #define __TESTAPP_H
  17. //
  18. // Copied Macros from ntddk.h
  19. //
  20. #define CONTAINING_RECORD(address, type, field) ((type *)( \
  21. (PCHAR)(address) - \
  22. (ULONG_PTR)(&((type *)0)->field)))
  23. #define InitializeListHead(ListHead) (\
  24. (ListHead)->Flink = (ListHead)->Blink = (ListHead))
  25. #define RemoveHeadList(ListHead) \
  26. (ListHead)->Flink;\
  27. {RemoveEntryList((ListHead)->Flink)}
  28. #define IsListEmpty(ListHead) \
  29. ((ListHead)->Flink == (ListHead))
  30. #define RemoveEntryList(Entry) {\
  31. PLIST_ENTRY _EX_Blink;\
  32. PLIST_ENTRY _EX_Flink;\
  33. _EX_Flink = (Entry)->Flink;\
  34. _EX_Blink = (Entry)->Blink;\
  35. _EX_Blink->Flink = _EX_Flink;\
  36. _EX_Flink->Blink = _EX_Blink;\
  37. }
  38. #define InsertTailList(ListHead,Entry) {\
  39. PLIST_ENTRY _EX_Blink;\
  40. PLIST_ENTRY _EX_ListHead;\
  41. _EX_ListHead = (ListHead);\
  42. _EX_Blink = _EX_ListHead->Blink;\
  43. (Entry)->Flink = _EX_ListHead;\
  44. (Entry)->Blink = _EX_Blink;\
  45. _EX_Blink->Flink = (Entry);\
  46. _EX_ListHead->Blink = (Entry);\
  47. }
  48. typedef struct _DEVICE_INFO
  49. {
  50. HANDLE hDevice; // file handle
  51. HANDLE hControlDevice; // file handle
  52. HDEVNOTIFY hHandleNotification; // notification handle
  53. TCHAR DeviceName[MAX_PATH];// friendly name of device description
  54. TCHAR DevicePath[MAX_PATH];//
  55. LIST_ENTRY ListEntry;
  56. } DEVICE_INFO, *PDEVICE_INFO;
  57. #define ID_EDIT 1
  58. #define IDM_OPEN 100
  59. #define IDM_CLOSE 101
  60. #define IDM_EXIT 102
  61. #define IDM_CTL_IOCTL 103
  62. #define IDM_CLEAR 105
  63. LRESULT FAR PASCAL
  64. WndProc (
  65. HWND hwnd,
  66. UINT message,
  67. WPARAM wParam,
  68. LPARAM lParam
  69. );
  70. BOOLEAN EnumExistingDevices(
  71. HWND hWnd
  72. );
  73. BOOL HandleDeviceInterfaceChange(
  74. HWND hwnd,
  75. DWORD evtype,
  76. PDEV_BROADCAST_DEVICEINTERFACE dip
  77. );
  78. BOOL HandleDeviceChange(
  79. HWND hwnd,
  80. DWORD evtype,
  81. PDEV_BROADCAST_HANDLE dhp
  82. );
  83. LRESULT
  84. HandleCommands(
  85. HWND hWnd,
  86. UINT uMsg,
  87. WPARAM wParam,
  88. LPARAM lParam
  89. );
  90. BOOLEAN Cleanup(
  91. HWND hWnd
  92. );
  93. BOOL
  94. GetDeviceDescription(
  95. LPTSTR InputName,
  96. LPTSTR OutBuffer,
  97. PULONG SerialNo
  98. );
  99. VOID CloseDeviceHandles(
  100. IN PDEVICE_INFO deviceInfo);
  101. BOOLEAN
  102. SendIoctlToControlDevice(
  103. IN PDEVICE_INFO deviceInfo);
  104. #endif