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.

377 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. All rights reserved
  4. Module Name:
  5. localmon.h
  6. // @@BEGIN_DDKSPLIT
  7. Abstract:
  8. Author:
  9. Environment:
  10. User Mode -Win32
  11. Revision History:
  12. // @@END_DDKSPLIT
  13. --*/
  14. // @@BEGIN_DDKSPLIT
  15. #ifdef INTERNAL
  16. #include "splcom.h"
  17. #else
  18. // @@END_DDKSPLIT
  19. LPWSTR AllocSplStr(LPWSTR pStr);
  20. LPVOID AllocSplMem(DWORD cbAlloc);
  21. #define FreeSplMem( pMem ) (GlobalFree( pMem ) ? FALSE:TRUE)
  22. #define FreeSplStr( lpStr ) ((lpStr) ? (GlobalFree(lpStr) ? FALSE:TRUE):TRUE)
  23. #define COUNTOF(x) (sizeof(x)/sizeof *(x))
  24. /* DEBUGGING:
  25. */
  26. #define DBG_NONE 0x0000
  27. #define DBG_INFO 0x0001
  28. #define DBG_WARN 0x0002
  29. #define DBG_WARNING 0x0002
  30. #define DBG_ERROR 0x0004
  31. #define DBG_TRACE 0x0008
  32. #define DBG_SECURITY 0x0010
  33. #define DBG_EXEC 0x0020
  34. #define DBG_PORT 0x0040
  35. #define DBG_NOTIFY 0x0080
  36. #define DBG_PAUSE 0x0100
  37. #define DBG_ASSERT 0x0200
  38. #define DBG_THREADM 0x0400
  39. #define DBG_MIN 0x0800
  40. #define DBG_TIME 0x1000
  41. #define DBG_FOLDER 0x2000
  42. #define DBG_NOHEAD 0x8000
  43. #if DBG
  44. ULONG
  45. DbgPrint(
  46. PCH Format,
  47. ...
  48. );
  49. VOID
  50. DbgBreakPoint(
  51. VOID
  52. );
  53. #define GLOBAL_DEBUG_FLAGS LocalMonDebug
  54. extern DWORD GLOBAL_DEBUG_FLAGS;
  55. /* These flags are not used as arguments to the LcmDBGMSG macro.
  56. * You have to set the high word of the global variable to cause it to break.
  57. * It is ignored if used with LcmDBGMSG.
  58. * (Here mainly for explanatory purposes.)
  59. */
  60. #define DBG_BREAK_ON_WARNING ( DBG_WARNING << 16 )
  61. #define DBG_BREAK_ON_ERROR ( DBG_ERROR << 16 )
  62. /* Double braces are needed for this one, e.g.:
  63. *
  64. * LcmDBGMSG( DBG_ERROR, ( "Error code %d", Error ) );
  65. *
  66. * This is because we can't use variable parameter lists in macros.
  67. * The statement gets pre-processed to a semi-colon in non-debug mode.
  68. *
  69. * Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
  70. * Setting the flag in the low word causes that level to be printed;
  71. * setting the high word causes a break into the debugger.
  72. * E.g. setting it to 0x00040006 will print out all warning and error
  73. * messages, and break on errors.
  74. */
  75. #define LcmDBGMSG( Level, MsgAndArgs ) \
  76. { \
  77. if( ( Level & 0xFFFF ) & GLOBAL_DEBUG_FLAGS ) \
  78. DbgPrint MsgAndArgs; \
  79. if( ( Level << 16 ) & GLOBAL_DEBUG_FLAGS ) \
  80. DbgBreakPoint(); \
  81. }
  82. #else
  83. #define LcmDBGMSG
  84. #endif
  85. // @@BEGIN_DDKSPLIT
  86. #endif
  87. // @@END_DDKSPLIT
  88. BOOL
  89. PortExists(
  90. LPWSTR pName,
  91. LPWSTR pPortName,
  92. PDWORD pError
  93. );
  94. BOOL
  95. PortIsValid(
  96. LPWSTR pPortName
  97. );
  98. extern HANDLE LcmhInst;
  99. extern CRITICAL_SECTION LcmSpoolerSection;
  100. extern DWORD LcmPortInfo1Strings[];
  101. extern DWORD LcmPortInfo2Strings[];
  102. extern PINIPORT pIniFirstPort;
  103. extern PINIXCVPORT pIniFirstXcvPort;
  104. extern WCHAR szNULL[];
  105. extern WCHAR szPorts[];
  106. extern WCHAR szWindows[];
  107. extern WCHAR szINIKey_TransmissionRetryTimeout[];
  108. extern WCHAR szLcmDeviceNameHeader[];
  109. extern WCHAR szFILE[];
  110. extern WCHAR szLcmCOM[];
  111. extern WCHAR szLcmLPT[];
  112. extern WCHAR szIRDA[];
  113. #define MSG_ERROR MB_OK | MB_ICONSTOP
  114. #define MSG_WARNING MB_OK | MB_ICONEXCLAMATION
  115. #define MSG_YESNO MB_YESNO | MB_ICONQUESTION
  116. #define MSG_INFORMATION MB_OK | MB_ICONINFORMATION
  117. #define MSG_CONFIRMATION MB_OKCANCEL | MB_ICONEXCLAMATION
  118. #define TIMEOUT_MIN 1
  119. #define TIMEOUT_MAX 999999
  120. #define TIMEOUT_STRING_MAX 6
  121. #define WITHINRANGE( val, lo, hi ) \
  122. ( ( val <= hi ) && ( val >= lo ) )
  123. #define IS_FILE_PORT(pName) \
  124. !_wcsicmp( pName, szFILE )
  125. #define IS_IRDA_PORT(pName) \
  126. !_wcsicmp( pName, szIRDA )
  127. #define IS_COM_PORT(pName) \
  128. IsCOMPort( pName )
  129. #define IS_LPT_PORT(pName) \
  130. IsLPTPort( pName )
  131. BOOL
  132. IsCOMPort(
  133. LPWSTR pPort
  134. );
  135. BOOL
  136. IsLPTPort(
  137. LPWSTR pPort
  138. );
  139. VOID
  140. LcmEnterSplSem(
  141. VOID
  142. );
  143. VOID
  144. LcmLeaveSplSem(
  145. VOID
  146. );
  147. VOID
  148. LcmSplOutSem(
  149. VOID
  150. );
  151. PINIENTRY
  152. LcmFindName(
  153. PINIENTRY pIniKey,
  154. LPWSTR pName
  155. );
  156. PINIENTRY
  157. LcmFindIniKey(
  158. PINIENTRY pIniEntry,
  159. LPWSTR lpName
  160. );
  161. LPBYTE
  162. PackStrings(
  163. LPWSTR *pSource,
  164. LPBYTE pDest,
  165. DWORD *DestOffsets,
  166. LPBYTE pEnd
  167. );
  168. INT
  169. LcmMessage(
  170. HWND hwnd,
  171. DWORD Type,
  172. INT CaptionID,
  173. INT TextID,
  174. ...
  175. );
  176. DWORD
  177. ReportError(
  178. HWND hwndParent,
  179. DWORD idTitle,
  180. DWORD idDefaultError
  181. );
  182. VOID
  183. LcmRemoveColon(
  184. LPWSTR pName
  185. );
  186. PINIPORT
  187. LcmCreatePortEntry(
  188. PINILOCALMON pIniLocalMon,
  189. LPWSTR pPortName
  190. );
  191. BOOL
  192. LcmDeletePortEntry(
  193. PINILOCALMON pIniLocalMon,
  194. LPWSTR pPortName
  195. );
  196. PINIXCVPORT
  197. CreateXcvPortEntry(
  198. PINILOCALMON pIniLocalMon,
  199. LPCWSTR pszName,
  200. ACCESS_MASK GrantedAccess
  201. );
  202. BOOL
  203. DeleteXcvPortEntry(
  204. PINIXCVPORT pIniXcvPort
  205. );
  206. BOOL
  207. GetIniCommValues(
  208. LPWSTR pName,
  209. LPDCB pdcb,
  210. LPCOMMTIMEOUTS pcto
  211. );
  212. BOOL
  213. LocalAddPortEx(
  214. LPWSTR pName,
  215. DWORD Level,
  216. LPBYTE pBuffer,
  217. LPWSTR pMonitorName
  218. );
  219. BOOL
  220. MakeLink(
  221. LPWSTR pOldDosDeviceName,
  222. LPWSTR pNewDosDeviceName,
  223. LPWSTR *ppOldNtDeviceName,
  224. LPWSTR pNewNtDeviceName,
  225. SECURITY_DESCRIPTOR *pSecurityDescriptor
  226. );
  227. BOOL
  228. RemoveLink(
  229. LPWSTR pOldDosDeviceName,
  230. LPWSTR pNewDosDeviceName,
  231. LPWSTR *ppOldNtDeviceName
  232. );
  233. DWORD
  234. ConfigureLPTPortCommandOK(
  235. PBYTE pInputData,
  236. DWORD cbInputData,
  237. PBYTE pOutputData,
  238. DWORD cbOutputData,
  239. PDWORD pcbOutputNeeded,
  240. PINIXCVPORT pIniXcv
  241. );
  242. DWORD
  243. GetPortSize(
  244. PINIPORT pIniPort,
  245. DWORD Level
  246. );
  247. LPBYTE
  248. CopyIniPortToPort(
  249. PINIPORT pIniPort,
  250. DWORD Level,
  251. LPBYTE pPortInfo,
  252. LPBYTE pEnd
  253. );
  254. BOOL
  255. ValidateDosDevicePort(
  256. PINIPORT pIniPort
  257. );
  258. BOOL
  259. RemoveDosDeviceDefinition(
  260. PINIPORT pIniPort
  261. );
  262. BOOL
  263. DeletePortNode(
  264. PINILOCALMON pIniLocalMon,
  265. PINIPORT pIniPort
  266. );
  267. BOOL
  268. FixupDosDeviceDefinition(
  269. PINIPORT pIniPort
  270. );
  271. DWORD
  272. LcmXcvDataPort(
  273. HANDLE hXcv,
  274. LPCWSTR pszDataName,
  275. PBYTE pInputData,
  276. DWORD cbInputData,
  277. PBYTE pOutputData,
  278. DWORD cbOutputData,
  279. PDWORD pcbOutputNeeded
  280. );
  281. BOOL
  282. LcmXcvOpenPort(
  283. HANDLE hMonitor,
  284. LPCWSTR pszObject,
  285. ACCESS_MASK GrantedAccess,
  286. PHANDLE phXcv
  287. );
  288. BOOL
  289. LcmXcvClosePort(
  290. HANDLE hXcv
  291. );
  292. DWORD
  293. WINAPIV
  294. StrNCatBuffW(
  295. IN PWSTR pszBuffer,
  296. IN UINT cchBuffer,
  297. ...
  298. );