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.

246 lines
5.8 KiB

  1. /** FILE: cyyports.h ********* Module Header ********************************
  2. *
  3. * Control Panel System applet common definitions, resource ids, typedefs,
  4. * external declarations and library routine function prototypes.
  5. *
  6. * History:
  7. *
  8. *
  9. * Copyright (C) 2000 Cyclades Corporation
  10. *
  11. *************************************************************************/
  12. //==========================================================================
  13. // Include Files
  14. //==========================================================================
  15. #ifndef PORTS_H
  16. #define PORTS_H
  17. #include <windows.h>
  18. #include <tchar.h>
  19. #include <cfgmgr32.h>
  20. #include <setupapi.h>
  21. #include <regstr.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <malloc.h>
  26. #include "resource.h"
  27. #include "portstr.h"
  28. #define PORTS 4
  29. #define MAXPORTS 32
  30. #define KEYBZ 4096
  31. #define BUFFER_SIZE 81
  32. #define DEF_BAUD 3 // 1200
  33. #define DEF_WORD 4 // 8 bits
  34. #define DEF_PARITY 2 // None
  35. #define DEF_STOP 0 // 1
  36. #define DEF_PORT 0 // Null Port
  37. #define DEF_SHAKE 2 // None
  38. #define PAR_EVEN 0
  39. #define PAR_ODD 1
  40. #define PAR_NONE 2
  41. #define PAR_MARK 3
  42. #define PAR_SPACE 4
  43. #define STOP_1 0
  44. #define STOP_15 1
  45. #define STOP_2 2
  46. #define FLOW_XON 0
  47. #define FLOW_HARD 1
  48. #define FLOW_NONE 2
  49. //#define MAX_COM_PORT COMDB_MIN_PORTS_ARBITRATED // Maximum number of COM ports NT supports
  50. #define MAX_COM_PORT 2048 // We should support at least 1024 ports.
  51. #define MIN_COM 1 // Minimum new COM port number
  52. #define POLL_PERIOD_DEFAULT_IDX 1
  53. //==========================================================================
  54. // Definitions
  55. //==========================================================================
  56. //
  57. // General definitions
  58. //
  59. #define PATHMAX MAX_PATH
  60. //
  61. // Help IDs -- for the Ports applet
  62. //
  63. //
  64. #define IDH_HELPFIRST 5000
  65. #define IDH_SYSMENU (IDH_HELPFIRST + 2000)
  66. #define IDH_MBFIRST (IDH_HELPFIRST + 2001)
  67. #define IDH_MBLAST (IDH_HELPFIRST + 2099)
  68. #define IDH_DLGFIRST (IDH_HELPFIRST + 3000)
  69. #define IDH_MENU_SCHHELP (IDH_HELPFIRST + MENU_SCHHELP)
  70. #define IDH_MENU_INDHELP (IDH_HELPFIRST + MENU_INDHELP)
  71. #define IDH_MENU_USEHELP (IDH_HELPFIRST + MENU_USEHELP)
  72. #define IDH_MENU_ABOUT (IDH_HELPFIRST + MENU_ABOUT )
  73. #define IDH_MENU_EXIT (IDH_HELPFIRST + MENU_EXIT)
  74. #define IDH_CHILD_PORTS (IDH_HELPFIRST + 4 /* CHILD_PORTS */ )
  75. #define IDH_DLG_PORTS2 (IDH_DLGFIRST + DLG_PORTS2)
  76. #define IDH_DLG_PORTS3 (IDH_DLGFIRST + DLG_PORTS3)
  77. //==========================================================================
  78. // Typedefs
  79. //==========================================================================
  80. typedef struct {
  81. SP_DEVINFO_DATA DeviceInfoData;
  82. TCHAR ComName[20];
  83. TCHAR Settings[20];
  84. ULONG BaseAddress;
  85. } PORT_INFO, *PPORT_INFO;
  86. typedef struct _PORTS_WIZARD_DATA {
  87. HDEVINFO DeviceInfoSet;
  88. PSP_DEVINFO_DATA pDeviceInfoData;
  89. ULONG BaseAddress;
  90. ULONG FirstComNumber;
  91. ULONG PortsCount;
  92. PPORT_INFO Ports;
  93. PUINT UsedComNumbers;
  94. UINT UsedComNumbersCount;
  95. BOOL IsMulti;
  96. } PORTS_WIZARD_DATA, *PPORTS_WIZARD_DATA;
  97. //==========================================================================
  98. // Macros
  99. //==========================================================================
  100. #define CharSizeOf(x) (sizeof(x) / sizeof(*x))
  101. #define ByteCountOf(x) ((x) * sizeof(TCHAR))
  102. #if DBG
  103. #define DbgOut(Text) OutputDebugString(Text)
  104. #else
  105. #define DbgOut(Text)
  106. #endif
  107. //==========================================================================
  108. // External Declarations
  109. //==========================================================================
  110. //
  111. // DATA
  112. //
  113. // exported from cpl.c
  114. //
  115. extern HANDLE g_hInst;
  116. extern TCHAR g_szErrMem[ ]; // Low memory message
  117. extern TCHAR g_szPortsApplet[ ]; // "Ports Control Panel Applet" title
  118. extern TCHAR g_szNull[]; // Null string
  119. extern DWORD PollingPeriods[];
  120. extern TCHAR m_szPorts[];
  121. extern TCHAR m_szPortName[];
  122. //==========================================================================
  123. // Function Prototypes
  124. //==========================================================================
  125. //
  126. // LibMain module
  127. //
  128. extern
  129. VOID
  130. InitStrings(void);
  131. //
  132. // cyfriend.c
  133. //
  134. extern
  135. BOOL
  136. ReplaceFriendlyName(
  137. IN HDEVINFO DeviceInfoSet,
  138. IN PSP_DEVINFO_DATA DeviceInfoData,
  139. IN PTCHAR NewComName
  140. );
  141. //
  142. // util.c
  143. //
  144. extern
  145. LPTSTR
  146. BackslashTerm(LPTSTR pszPath);
  147. extern
  148. VOID
  149. ErrMemDlg(HWND hParent);
  150. extern
  151. int
  152. MyAtoi(LPTSTR string);
  153. extern
  154. int
  155. myatoi(LPTSTR pszInt);
  156. extern
  157. int
  158. MyMessageBox(HWND hWnd,
  159. DWORD wText,
  160. DWORD wCaption,
  161. DWORD wType,
  162. ...);
  163. extern
  164. int
  165. MyMessageBoxWithErr(
  166. HWND hWnd,
  167. DWORD wText,
  168. DWORD wCaption,
  169. DWORD wType,
  170. DWORD wError
  171. );
  172. extern
  173. LPTSTR
  174. MyItoa(INT value,
  175. LPTSTR string,
  176. INT radix);
  177. extern
  178. LPTSTR
  179. MyUltoa(unsigned long value,
  180. LPTSTR string,
  181. INT radix);
  182. extern
  183. VOID
  184. SendWinIniChange(LPTSTR szSection);
  185. extern
  186. LPTSTR
  187. strscan(LPTSTR pszString,
  188. LPTSTR pszTarget);
  189. extern
  190. VOID
  191. StripBlanks(LPTSTR pszString);
  192. #endif // PORTS_H