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.

123 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. enumports.h
  6. Abstract:
  7. USBMON header file
  8. --*/
  9. //
  10. // Sizes
  11. //
  12. #define MAX_PORT_LEN 20
  13. #define MAX_PORT_DESC_LEN 60
  14. #define MAX_DEVICE_PATH 256
  15. #define PAR_QUERY_TIMEOUT 5000
  16. static const GUID USB_PRINTER_GUID =
  17. { 0x28d78fad, 0x5a12, 0x11d1, { 0xae, 0x5b, 0x0, 0x0, 0xf8, 0x3, 0xa8, 0xc2 } };
  18. //
  19. // Functions needed
  20. #ifdef UNICODE
  21. #define lstrchr wcschr
  22. #define lstrncmpi _wcsnicmp
  23. #else
  24. #define lstrchr strchr
  25. #define lstrncmpi _strnicmp
  26. #endif
  27. #define USB_SIGNATURE 0x89AB
  28. typedef struct USBMON_PORT_INFO_DEF {
  29. DWORD dwSignature;
  30. struct USBMON_PORT_INFO_DEF *pNext;
  31. DWORD cRef;
  32. DWORD dwFlags;
  33. DWORD dwDeviceFlags;
  34. DWORD dwJobId;
  35. HANDLE hDeviceHandle;
  36. HANDLE hPrinter;
  37. LPBYTE pWriteBuffer;
  38. //
  39. // dwBufferSize : size of buffer
  40. // dwDataSize : size of data in buffer
  41. // (could be smaller than dwBufferSize)
  42. // dwDataCompleted : size of data sent and acknowledged
  43. // dwScheduledData : size of data we have scheduled using WriteFile
  44. //
  45. DWORD dwBufferSize, dwDataSize, dwDataCompleted, dwDataScheduled;
  46. OVERLAPPED Ov;
  47. CRITICAL_SECTION CriticalSection;
  48. DWORD ReadTimeoutMultiplier;
  49. DWORD ReadTimeoutConstant;
  50. DWORD WriteTimeoutMultiplier;
  51. DWORD WriteTimeoutConstant;
  52. TCHAR szPortName[MAX_PORT_LEN];
  53. TCHAR szPortDescription[MAX_PORT_DESC_LEN];
  54. TCHAR szDevicePath[256];
  55. } USBMON_PORT_INFO, *PUSBMON_PORT_INFO;
  56. #define USBMON_STARTDOC 0x00000001
  57. typedef struct PORT_UPDATE_INFO_DEF {
  58. struct PORT_UPDATE_INFO_DEF *pNext;
  59. TCHAR szPortName[MAX_PORT_LEN];
  60. HKEY hKey;
  61. BOOL bActive;
  62. } PORT_UPDATE_INFO, *PPORT_UPDATE_INFO;
  63. typedef struct USELESS_PORT_INFO_DEF {
  64. struct USELESS_PORT_INFO_DEF *pNext;
  65. TCHAR szDevicePath[256];
  66. } USELESS_PORT_INFO, *PUSELESS_PORT_INFO;
  67. typedef struct USBMON_MONITOR_INFO_DEF {
  68. DWORD dwLastEnumIndex, dwEnumPortCount,
  69. dwPortCount, dwUselessPortCount;
  70. PUSBMON_PORT_INFO pPortInfo;
  71. PUSELESS_PORT_INFO pJunkList;
  72. CRITICAL_SECTION EnumPortsCS, BackThreadCS;
  73. } USBMON_MONITOR_INFO, *PUSBMON_MONITOR_INFO;
  74. typedef struct BACKGROUND_THREAD_DEF {
  75. PUSBMON_MONITOR_INFO pMonitorInfo;
  76. PPORT_UPDATE_INFO pPortUpdateList;
  77. HANDLE hWaitToStart;
  78. } BACKGROUND_THREAD_DATA, PBACKGROUND_THREAD_DATA;
  79. extern USBMON_MONITOR_INFO gUsbmonInfo;
  80. PUSBMON_PORT_INFO
  81. FindPort(
  82. PUSBMON_MONITOR_INFO pMonitorInfo,
  83. LPTSTR pszPortName,
  84. PUSBMON_PORT_INFO *pPrev
  85. );
  86. BOOL
  87. WINAPI
  88. USBMON_EnumPorts(
  89. LPTSTR pszName,
  90. DWORD dwLevel,
  91. LPBYTE pPorts,
  92. DWORD cbBuf,
  93. LPDWORD pcbNeeded,
  94. LPDWORD pcReturned
  95. );