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.

245 lines
5.7 KiB

  1. /** FILE: cyzports.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 2048 // We should support at least 1024 ports.
  50. #define MIN_COM 1 // Minimum new COM port number
  51. #define POLL_PERIOD_DEFAULT_IDX 1
  52. //==========================================================================
  53. // Definitions
  54. //==========================================================================
  55. //
  56. // General definitions
  57. //
  58. #define PATHMAX MAX_PATH
  59. //
  60. // Help IDs -- for the Ports applet
  61. //
  62. //
  63. #define IDH_HELPFIRST 5000
  64. #define IDH_SYSMENU (IDH_HELPFIRST + 2000)
  65. #define IDH_MBFIRST (IDH_HELPFIRST + 2001)
  66. #define IDH_MBLAST (IDH_HELPFIRST + 2099)
  67. #define IDH_DLGFIRST (IDH_HELPFIRST + 3000)
  68. #define IDH_MENU_SCHHELP (IDH_HELPFIRST + MENU_SCHHELP)
  69. #define IDH_MENU_INDHELP (IDH_HELPFIRST + MENU_INDHELP)
  70. #define IDH_MENU_USEHELP (IDH_HELPFIRST + MENU_USEHELP)
  71. #define IDH_MENU_ABOUT (IDH_HELPFIRST + MENU_ABOUT )
  72. #define IDH_MENU_EXIT (IDH_HELPFIRST + MENU_EXIT)
  73. #define IDH_CHILD_PORTS (IDH_HELPFIRST + 4 /* CHILD_PORTS */ )
  74. #define IDH_DLG_PORTS2 (IDH_DLGFIRST + DLG_PORTS2)
  75. #define IDH_DLG_PORTS3 (IDH_DLGFIRST + DLG_PORTS3)
  76. //==========================================================================
  77. // Typedefs
  78. //==========================================================================
  79. typedef struct {
  80. SP_DEVINFO_DATA DeviceInfoData;
  81. TCHAR ComName[20];
  82. TCHAR Settings[20];
  83. ULONG BaseAddress;
  84. } PORT_INFO, *PPORT_INFO;
  85. typedef struct _PORTS_WIZARD_DATA {
  86. HDEVINFO DeviceInfoSet;
  87. PSP_DEVINFO_DATA pDeviceInfoData;
  88. ULONG BaseAddress;
  89. ULONG FirstComNumber;
  90. ULONG PortsCount;
  91. PPORT_INFO Ports;
  92. PUINT UsedComNumbers;
  93. UINT UsedComNumbersCount;
  94. BOOL IsMulti;
  95. } PORTS_WIZARD_DATA, *PPORTS_WIZARD_DATA;
  96. //==========================================================================
  97. // Macros
  98. //==========================================================================
  99. #define CharSizeOf(x) (sizeof(x) / sizeof(*x))
  100. #define ByteCountOf(x) ((x) * sizeof(TCHAR))
  101. #if DBG
  102. #define DbgOut(Text) OutputDebugString(Text)
  103. #else
  104. #define DbgOut(Text)
  105. #endif
  106. //==========================================================================
  107. // External Declarations
  108. //==========================================================================
  109. //
  110. // DATA
  111. //
  112. // exported from cpl.c
  113. //
  114. extern HANDLE g_hInst;
  115. extern TCHAR g_szErrMem[ ]; // Low memory message
  116. extern TCHAR g_szPortsApplet[ ]; // "Ports Control Panel Applet" title
  117. extern TCHAR g_szNull[]; // Null string
  118. extern DWORD PollingPeriods[];
  119. extern TCHAR m_szPorts[];
  120. extern TCHAR m_szPortName[];
  121. //==========================================================================
  122. // Function Prototypes
  123. //==========================================================================
  124. //
  125. // LibMain module
  126. //
  127. extern
  128. VOID
  129. InitStrings(void);
  130. //
  131. // cyfriend.c
  132. //
  133. extern
  134. BOOL
  135. ReplaceFriendlyName(
  136. IN HDEVINFO DeviceInfoSet,
  137. IN PSP_DEVINFO_DATA DeviceInfoData,
  138. IN PTCHAR NewComName
  139. );
  140. //
  141. // util.c
  142. //
  143. extern
  144. LPTSTR
  145. BackslashTerm(LPTSTR pszPath);
  146. extern
  147. VOID
  148. ErrMemDlg(HWND hParent);
  149. extern
  150. int
  151. MyAtoi(LPTSTR string);
  152. extern
  153. int
  154. myatoi(LPTSTR pszInt);
  155. extern
  156. int
  157. MyMessageBox(HWND hWnd,
  158. DWORD wText,
  159. DWORD wCaption,
  160. DWORD wType,
  161. ...);
  162. extern
  163. int
  164. MyMessageBoxWithErr(
  165. HWND hWnd,
  166. DWORD wText,
  167. DWORD wCaption,
  168. DWORD wType,
  169. DWORD wError
  170. );
  171. extern
  172. LPTSTR
  173. MyItoa(INT value,
  174. LPTSTR string,
  175. INT radix);
  176. extern
  177. LPTSTR
  178. MyUltoa(unsigned long value,
  179. LPTSTR string,
  180. INT radix);
  181. extern
  182. VOID
  183. SendWinIniChange(LPTSTR szSection);
  184. extern
  185. LPTSTR
  186. strscan(LPTSTR pszString,
  187. LPTSTR pszTarget);
  188. extern
  189. VOID
  190. StripBlanks(LPTSTR pszString);
  191. #endif // PORTS_H