Source code of Windows XP (NT5)
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.

663 lines
19 KiB

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name:
  4. esp.h
  5. Abstract:
  6. This module contains
  7. Author:
  8. Dan Knudson (DanKn) 18-Sep-1995
  9. Revision History:
  10. Notes:
  11. --*/
  12. #include "windows.h"
  13. #include "intrface.h"
  14. #include "tapi.h"
  15. #include "tspi.h"
  16. #include "espidl.h"
  17. #define DRVLINE_KEY ((DWORD) 'LPSE')
  18. #define DRVPHONE_KEY ((DWORD) 'PPSE')
  19. #define DRVCALL_KEY ((DWORD) 'CPSE')
  20. #define INVAL_KEY ((DWORD) 'XPSE')
  21. #define SYNC 0
  22. #define ASYNC 1
  23. #define LINE_ICON 1
  24. #define PHONE_ICON 2
  25. #define IDD_DIALOG1 3
  26. #define IDC_LIST1 1001
  27. #define IDC_COMBO1 1002
  28. #define IDC_LIST2 1003
  29. #define MAX_STRING_PARAM_SIZE 32
  30. #define PT_DWORD 1
  31. #define PT_FLAGS 2
  32. #define PT_STRING 3
  33. #define PT_ORDINAL 4
  34. #define DEF_NUM_ASYNC_REQUESTS_IN_QUEUE 256
  35. #define DEF_NUM_EXTRA_LOOKUP_ENTRIES 32
  36. #define MAX_VAR_DATA_SIZE 1024
  37. #define MAX_NUM_COMPLETION_MESSAGES 100
  38. #define PHONE_DISPLAY_SIZE_IN_CHARS 32
  39. #define PHONE_DISPLAY_SIZE_IN_BYTES (PHONE_DISPLAY_SIZE_IN_CHARS * sizeof (WCHAR))
  40. #define AllAddrCaps1_0 \
  41. (LINEADDRCAPFLAGS_FWDNUMRINGS | \
  42. LINEADDRCAPFLAGS_PICKUPGROUPID | \
  43. LINEADDRCAPFLAGS_SECURE | \
  44. LINEADDRCAPFLAGS_BLOCKIDDEFAULT | \
  45. LINEADDRCAPFLAGS_BLOCKIDOVERRIDE | \
  46. LINEADDRCAPFLAGS_DIALED | \
  47. LINEADDRCAPFLAGS_ORIGOFFHOOK | \
  48. LINEADDRCAPFLAGS_DESTOFFHOOK | \
  49. LINEADDRCAPFLAGS_FWDCONSULT | \
  50. LINEADDRCAPFLAGS_SETUPCONFNULL | \
  51. LINEADDRCAPFLAGS_AUTORECONNECT | \
  52. LINEADDRCAPFLAGS_COMPLETIONID | \
  53. LINEADDRCAPFLAGS_TRANSFERHELD | \
  54. LINEADDRCAPFLAGS_TRANSFERMAKE | \
  55. LINEADDRCAPFLAGS_CONFERENCEHELD | \
  56. LINEADDRCAPFLAGS_CONFERENCEMAKE | \
  57. LINEADDRCAPFLAGS_PARTIALDIAL | \
  58. LINEADDRCAPFLAGS_FWDSTATUSVALID | \
  59. LINEADDRCAPFLAGS_FWDINTEXTADDR | \
  60. LINEADDRCAPFLAGS_FWDBUSYNAADDR | \
  61. LINEADDRCAPFLAGS_ACCEPTTOALERT | \
  62. LINEADDRCAPFLAGS_CONFDROP | \
  63. LINEADDRCAPFLAGS_PICKUPCALLWAIT)
  64. #define AllAddrCaps2_0 \
  65. (AllAddrCaps1_0 | \
  66. LINEADDRCAPFLAGS_PREDICTIVEDIALER | \
  67. LINEADDRCAPFLAGS_QUEUE | \
  68. LINEADDRCAPFLAGS_ROUTEPOINT | \
  69. LINEADDRCAPFLAGS_HOLDMAKESNEW | \
  70. LINEADDRCAPFLAGS_NOINTERNALCALLS | \
  71. LINEADDRCAPFLAGS_NOEXTERNALCALLS | \
  72. LINEADDRCAPFLAGS_SETCALLINGID)
  73. #define AllAddrFeatures1_0 \
  74. (LINEADDRFEATURE_FORWARD | \
  75. LINEADDRFEATURE_MAKECALL | \
  76. LINEADDRFEATURE_PICKUP | \
  77. LINEADDRFEATURE_SETMEDIACONTROL | \
  78. LINEADDRFEATURE_SETTERMINAL | \
  79. LINEADDRFEATURE_SETUPCONF | \
  80. LINEADDRFEATURE_UNCOMPLETECALL | \
  81. LINEADDRFEATURE_UNPARK)
  82. #define AllAddrFeatures2_0 \
  83. (AllAddrFeatures1_0 | \
  84. LINEADDRFEATURE_PICKUPHELD | \
  85. LINEADDRFEATURE_PICKUPGROUP | \
  86. LINEADDRFEATURE_PICKUPDIRECT | \
  87. LINEADDRFEATURE_PICKUPWAITING | \
  88. LINEADDRFEATURE_FORWARDFWD | \
  89. LINEADDRFEATURE_FORWARDDND)
  90. #define AllBearerModes1_0 \
  91. (LINEBEARERMODE_VOICE | \
  92. LINEBEARERMODE_SPEECH | \
  93. LINEBEARERMODE_MULTIUSE | \
  94. LINEBEARERMODE_DATA | \
  95. LINEBEARERMODE_ALTSPEECHDATA | \
  96. LINEBEARERMODE_NONCALLSIGNALING)
  97. #define AllBearerModes1_4 \
  98. (AllBearerModes1_0 | \
  99. LINEBEARERMODE_PASSTHROUGH)
  100. #define AllBearerModes2_0 \
  101. (AllBearerModes1_4 | \
  102. LINEBEARERMODE_RESTRICTEDDATA)
  103. #define AllCallFeatures1_0 \
  104. (LINECALLFEATURE_ACCEPT | \
  105. LINECALLFEATURE_ADDTOCONF | \
  106. LINECALLFEATURE_ANSWER | \
  107. LINECALLFEATURE_BLINDTRANSFER | \
  108. LINECALLFEATURE_COMPLETECALL | \
  109. LINECALLFEATURE_COMPLETETRANSF | \
  110. LINECALLFEATURE_DIAL | \
  111. LINECALLFEATURE_DROP | \
  112. LINECALLFEATURE_GATHERDIGITS | \
  113. LINECALLFEATURE_GENERATEDIGITS | \
  114. LINECALLFEATURE_GENERATETONE | \
  115. LINECALLFEATURE_HOLD | \
  116. LINECALLFEATURE_MONITORDIGITS | \
  117. LINECALLFEATURE_MONITORMEDIA | \
  118. LINECALLFEATURE_MONITORTONES | \
  119. LINECALLFEATURE_PARK | \
  120. LINECALLFEATURE_PREPAREADDCONF | \
  121. LINECALLFEATURE_REDIRECT | \
  122. LINECALLFEATURE_REMOVEFROMCONF | \
  123. LINECALLFEATURE_SECURECALL | \
  124. LINECALLFEATURE_SENDUSERUSER | \
  125. LINECALLFEATURE_SETCALLPARAMS | \
  126. LINECALLFEATURE_SETMEDIACONTROL | \
  127. LINECALLFEATURE_SETTERMINAL | \
  128. LINECALLFEATURE_SETUPCONF | \
  129. LINECALLFEATURE_SETUPTRANSFER | \
  130. LINECALLFEATURE_SWAPHOLD | \
  131. LINECALLFEATURE_UNHOLD)
  132. #define AllCallFeatures1_4 \
  133. (AllCallFeatures1_0 | \
  134. LINECALLFEATURE_RELEASEUSERUSERINFO)
  135. #define AllCallFeatures2_0 \
  136. (AllCallFeatures1_4 | \
  137. LINECALLFEATURE_SETTREATMENT | \
  138. LINECALLFEATURE_SETQOS | \
  139. LINECALLFEATURE_SETCALLDATA)
  140. #define AllCallFeaturesTwo \
  141. (LINECALLFEATURE2_NOHOLDCONFERENCE | \
  142. LINECALLFEATURE2_COMPLCAMPON | \
  143. LINECALLFEATURE2_COMPLCALLBACK | \
  144. LINECALLFEATURE2_COMPLINTRUDE | \
  145. LINECALLFEATURE2_COMPLMESSAGE | \
  146. LINECALLFEATURE2_TRANSFERNORM | \
  147. LINECALLFEATURE2_TRANSFERCONF | \
  148. LINECALLFEATURE2_PARKDIRECT | \
  149. LINECALLFEATURE2_PARKNONDIRECT)
  150. // LINECALLFEATURE2_ONESTEPTRANSFER | \
  151. #define AllLineFeatures1_0 \
  152. (LINEFEATURE_DEVSPECIFIC | \
  153. LINEFEATURE_DEVSPECIFICFEAT | \
  154. LINEFEATURE_FORWARD | \
  155. LINEFEATURE_MAKECALL | \
  156. LINEFEATURE_SETMEDIACONTROL | \
  157. LINEFEATURE_SETTERMINAL)
  158. #define AllLineFeatures2_0 \
  159. (AllLineFeatures1_0 | \
  160. LINEFEATURE_SETDEVSTATUS | \
  161. LINEFEATURE_FORWARDFWD | \
  162. LINEFEATURE_FORWARDDND)
  163. #define AllMediaModes1_0 \
  164. (LINEMEDIAMODE_UNKNOWN | \
  165. LINEMEDIAMODE_INTERACTIVEVOICE | \
  166. LINEMEDIAMODE_AUTOMATEDVOICE | \
  167. LINEMEDIAMODE_DATAMODEM | \
  168. LINEMEDIAMODE_G3FAX | \
  169. LINEMEDIAMODE_TDD | \
  170. LINEMEDIAMODE_G4FAX | \
  171. LINEMEDIAMODE_DIGITALDATA | \
  172. LINEMEDIAMODE_TELETEX | \
  173. LINEMEDIAMODE_VIDEOTEX | \
  174. LINEMEDIAMODE_TELEX | \
  175. LINEMEDIAMODE_MIXED | \
  176. LINEMEDIAMODE_ADSI)
  177. #define AllMediaModes1_4 \
  178. (AllMediaModes1_0 | \
  179. LINEMEDIAMODE_VOICEVIEW)
  180. #define AllMediaModes2_1 \
  181. (AllMediaModes1_4 | \
  182. LINEMEDIAMODE_VIDEO)
  183. #define AllHookSwitchDevs \
  184. (PHONEHOOKSWITCHDEV_HANDSET | \
  185. PHONEHOOKSWITCHDEV_SPEAKER | \
  186. PHONEHOOKSWITCHDEV_HEADSET)
  187. #define AllHookSwitchModes \
  188. (PHONEHOOKSWITCHMODE_ONHOOK | \
  189. PHONEHOOKSWITCHMODE_MIC | \
  190. PHONEHOOKSWITCHMODE_SPEAKER | \
  191. PHONEHOOKSWITCHMODE_MICSPEAKER | \
  192. PHONEHOOKSWITCHMODE_UNKNOWN)
  193. #define AllPhoneFeatures \
  194. (PHONEFEATURE_GETBUTTONINFO | \
  195. PHONEFEATURE_GETDATA | \
  196. PHONEFEATURE_GETDISPLAY | \
  197. PHONEFEATURE_GETGAINHANDSET | \
  198. PHONEFEATURE_GETGAINSPEAKER | \
  199. PHONEFEATURE_GETGAINHEADSET | \
  200. PHONEFEATURE_GETHOOKSWITCHHANDSET | \
  201. PHONEFEATURE_GETHOOKSWITCHSPEAKER | \
  202. PHONEFEATURE_GETHOOKSWITCHHEADSET | \
  203. PHONEFEATURE_GETLAMP | \
  204. PHONEFEATURE_GETRING | \
  205. PHONEFEATURE_GETVOLUMEHANDSET | \
  206. PHONEFEATURE_GETVOLUMESPEAKER | \
  207. PHONEFEATURE_GETVOLUMEHEADSET | \
  208. PHONEFEATURE_SETBUTTONINFO | \
  209. PHONEFEATURE_SETDATA | \
  210. PHONEFEATURE_SETDISPLAY | \
  211. PHONEFEATURE_SETGAINHANDSET | \
  212. PHONEFEATURE_SETGAINSPEAKER | \
  213. PHONEFEATURE_SETGAINHEADSET | \
  214. PHONEFEATURE_SETHOOKSWITCHHANDSET | \
  215. PHONEFEATURE_SETHOOKSWITCHSPEAKER | \
  216. PHONEFEATURE_SETHOOKSWITCHHEADSET | \
  217. PHONEFEATURE_SETLAMP | \
  218. PHONEFEATURE_SETRING | \
  219. PHONEFEATURE_SETVOLUMEHANDSET | \
  220. PHONEFEATURE_SETVOLUMESPEAKER | \
  221. PHONEFEATURE_SETVOLUMEHEADSET)
  222. typedef struct _DRVCALL
  223. {
  224. DWORD dwKey;
  225. LPVOID pLine;
  226. HTAPICALL htCall;
  227. DWORD dwAddressID;
  228. DWORD dwMediaMode;
  229. DWORD dwBearerMode;
  230. DWORD dwMinRate;
  231. DWORD dwMaxRate;
  232. LINEDIALPARAMS DialParams;
  233. DWORD dwTreatment;
  234. DWORD dwCallState;
  235. DWORD dwCallStateMode;
  236. DWORD dwAppSpecific;
  237. DWORD dwSendingFlowspecSize;
  238. LPVOID pSendingFlowspec;
  239. DWORD dwReceivingFlowspecSize;
  240. LPVOID pReceivingFlowspec;
  241. DWORD dwCallDataSize;
  242. LPVOID pCallData;
  243. struct _DRVCALL *pPrev;
  244. struct _DRVCALL *pNext;
  245. struct _DRVCALL *pConfParent;
  246. struct _DRVCALL *pNextConfChild;
  247. struct _DRVCALL *pDestCall;
  248. DWORD bConnectedToDestCall;
  249. DWORD dwCallInstance;
  250. DWORD dwGatherDigitsEndToEndID;
  251. DWORD dwGenerateDigitsEndToEndID;
  252. DWORD dwGenerateToneEndToEndID;
  253. DWORD dwMonitorToneListID;
  254. DWORD dwCallID;
  255. DWORD dwRelatedCallID;
  256. DWORD dwAddressType;
  257. } DRVCALL, *PDRVCALL;
  258. typedef struct _DRVADDRESS
  259. {
  260. DWORD dwNumCalls;
  261. PDRVCALL pCalls;
  262. } DRVADDRESS, *PDRVADDRESS;
  263. typedef struct _DRVLINE
  264. {
  265. DWORD dwDeviceID;
  266. HTAPILINE htLine;
  267. DWORD dwMediaModes;
  268. DRVADDRESS aAddrs[1];
  269. DWORD dwMSGWAITFlag; //smarandb added this field to test winseqfe bug #23974
  270. } DRVLINE, *PDRVLINE;
  271. typedef struct _DRVLINETABLE
  272. {
  273. DWORD dwNumTotalEntries;
  274. DWORD dwNumUsedEntries;
  275. struct _DRVLINETABLE *pNext;
  276. DRVLINE aLines[1];
  277. } DRVLINETABLE, *PDRVLINETABLE;
  278. typedef struct _DRVPHONE
  279. {
  280. DWORD dwDeviceID;
  281. HTAPIPHONE htPhone;
  282. DWORD dwHandsetGain;
  283. DWORD dwSpeakerGain;
  284. DWORD dwHeadsetGain;
  285. DWORD dwHandsetHookSwitchMode;
  286. DWORD dwSpeakerHookSwitchMode;
  287. DWORD dwHeadsetHookSwitchMode;
  288. DWORD dwHandsetVolume;
  289. DWORD dwSpeakerVolume;
  290. DWORD dwHeadsetVolume;
  291. DWORD dwRingMode;
  292. DWORD dwRingVolume;
  293. DWORD dwLampMode;
  294. DWORD dwDataSize;
  295. LPVOID pData;
  296. LPPHONEBUTTONINFO pButtonInfo;
  297. WCHAR *pDisplay;
  298. } DRVPHONE, *PDRVPHONE;
  299. typedef struct _DRVPHONETABLE
  300. {
  301. DWORD dwNumTotalEntries;
  302. DWORD dwNumUsedEntries;
  303. struct _DRVPHONETABLE *pNext;
  304. DRVPHONE aPhones[1];
  305. } DRVPHONETABLE, *PDRVPHONETABLE;
  306. typedef struct _ASYNC_REQUEST_INFO
  307. {
  308. FARPROC pfnPostProcessProc;
  309. DWORD dwRequestID;
  310. LONG lResult;
  311. ULONG_PTR dwParam1;
  312. ULONG_PTR dwParam2;
  313. ULONG_PTR dwParam3;
  314. ULONG_PTR dwParam4;
  315. ULONG_PTR dwParam5;
  316. ULONG_PTR dwParam6;
  317. ULONG_PTR dwParam7;
  318. ULONG_PTR dwParam8;
  319. char *pszFuncName;
  320. } ASYNC_REQUEST_INFO, far *PASYNC_REQUEST_INFO;
  321. typedef struct _ESPGLOBALS
  322. {
  323. DWORD dwDebugOptions;
  324. DWORD dwCompletionMode;
  325. DWORD dwNumLines;
  326. DWORD dwNumAddressesPerLine;
  327. DWORD dwNumCallsPerAddress;
  328. DWORD dwNumPhones;
  329. DWORD dwSPIVersion;
  330. CRITICAL_SECTION CallListCritSec;
  331. CRITICAL_SECTION PhoneCritSec;
  332. HICON hIconLine;
  333. HICON hIconPhone;
  334. LINEEVENT pfnLineEvent;
  335. PHONEEVENT pfnPhoneEvent;
  336. ASYNC_COMPLETION pfnCompletion;
  337. HPROVIDER hProvider;
  338. DWORD dwPermanentProviderID;
  339. DWORD dwLineDeviceIDBase;
  340. DWORD dwPhoneDeviceIDBase;
  341. DWORD dwInitialNumLines;
  342. DWORD dwInitialNumPhones;
  343. PDRVLINETABLE pLines;
  344. PDRVPHONETABLE pPhones;
  345. BOOL bProviderShutdown;
  346. HANDLE hAsyncEventQueueServiceThread;
  347. HANDLE hAsyncEventsPendingEvent;
  348. CRITICAL_SECTION AsyncEventQueueCritSec;
  349. DWORD dwNumTotalQueueEntries;
  350. DWORD dwNumUsedQueueEntries;
  351. PASYNC_REQUEST_INFO *pAsyncRequestQueue;
  352. PASYNC_REQUEST_INFO *pAsyncRequestQueueIn;
  353. PASYNC_REQUEST_INFO *pAsyncRequestQueueOut;
  354. CRITICAL_SECTION DebugBufferCritSec;
  355. DWORD dwDebugBufferTotalSize;
  356. DWORD dwDebugBufferUsedSize;
  357. char *pDebugBuffer;
  358. char *pDebugBufferIn;
  359. char *pDebugBufferOut;
  360. CRITICAL_SECTION EventBufferCritSec;
  361. DWORD dwEventBufferTotalSize;
  362. DWORD dwEventBufferUsedSize;
  363. char *pEventBuffer;
  364. char *pEventBufferIn;
  365. char *pEventBufferOut;
  366. } ESPGLOBALS, *PESPGLOBALS;
  367. typedef struct _LOOKUP
  368. {
  369. DWORD dwVal;
  370. char *lpszVal;
  371. } LOOKUP, *PLOOKUP;
  372. typedef void (FAR PASCAL *POSTPROCESSPROC)(PASYNC_REQUEST_INFO, BOOL);
  373. typedef struct _FUNC_PARAM
  374. {
  375. char *lpszVal;
  376. ULONG_PTR dwVal;
  377. PLOOKUP pLookup;
  378. } FUNC_PARAM, *PFUNC_PARAM;
  379. typedef struct _FUNC_INFO
  380. {
  381. char *pszFuncName;
  382. DWORD bAsync;
  383. DWORD dwNumParams;
  384. PFUNC_PARAM aParams;
  385. POSTPROCESSPROC pfnPostProcessProc;
  386. PASYNC_REQUEST_INFO pAsyncReqInfo;
  387. LONG lResult;
  388. } FUNC_INFO, *PFUNC_INFO;
  389. typedef struct _EVENT_PARAM
  390. {
  391. char far *szName;
  392. DWORD dwType;
  393. ULONG_PTR dwValue;
  394. union
  395. {
  396. PLOOKUP pLookup;
  397. char far *buf;
  398. LPVOID ptr;
  399. ULONG_PTR dwDefValue;
  400. };
  401. } EVENT_PARAM, far *PEVENT_PARAM;
  402. typedef struct _EVENT_PARAM_HEADER
  403. {
  404. DWORD dwNumParams;
  405. LPSTR pszDlgTitle;
  406. DWORD dwEventType;
  407. PEVENT_PARAM aParams;
  408. } EVENT_PARAM_HEADER, far *PEVENT_PARAM_HEADER;
  409. #if DBG
  410. #define DBGOUT(arg) DbgPrt arg
  411. VOID
  412. DbgPrt(
  413. IN DWORD dwDbgLevel,
  414. IN PUCHAR DbgMessage,
  415. IN ...
  416. );
  417. DWORD gdwDebugLevel;
  418. #else
  419. #define DBGOUT(arg)
  420. #endif
  421. BOOL
  422. Prolog(
  423. PFUNC_INFO pInfo
  424. );
  425. LONG
  426. Epilog(
  427. PFUNC_INFO pInfo
  428. );
  429. void
  430. PASCAL
  431. DoCompletion(
  432. PASYNC_REQUEST_INFO pAsyncRequestInfo,
  433. BOOL bAsync
  434. );
  435. LONG
  436. PASCAL
  437. SetCallState(
  438. PDRVCALL pCall,
  439. DWORD dwExpectedCallInstance,
  440. DWORD dwValidCurrentStates,
  441. DWORD dwNewCallState,
  442. ULONG_PTR dwNewCallStateMode,
  443. BOOL bSendStateMsgToExe
  444. );
  445. void
  446. PASCAL
  447. WriteEventBuffer(
  448. ULONG_PTR Param1,
  449. ULONG_PTR Param2,
  450. ULONG_PTR Param3,
  451. ULONG_PTR Param4,
  452. ULONG_PTR Param5,
  453. ULONG_PTR Param6
  454. );
  455. LPVOID
  456. DrvAlloc(
  457. size_t numBytes
  458. );
  459. void
  460. DrvFree(
  461. LPVOID p
  462. );
  463. LONG
  464. PASCAL
  465. AllocCall(
  466. PDRVLINE pLine,
  467. HTAPICALL htCall,
  468. LPLINECALLPARAMS pCallParams,
  469. PDRVCALL *ppCall
  470. );
  471. void
  472. PASCAL
  473. FreeCall(
  474. PDRVCALL pCall,
  475. DWORD dwExpectedCallInstance
  476. );
  477. PDRVLINE
  478. PASCAL
  479. GetLineFromID(
  480. DWORD dwDeviceID
  481. );
  482. PDRVPHONE
  483. PASCAL
  484. GetPhoneFromID(
  485. DWORD dwDeviceID
  486. );
  487. BOOL
  488. WINAPI
  489. _CRT_INIT(
  490. HINSTANCE hDLL,
  491. DWORD dwReason,
  492. LPVOID lpReserved
  493. );
  494. VOID
  495. ShowStr(
  496. BOOL bAlertApp,
  497. char *format,
  498. ...
  499. );
  500. void
  501. PASCAL
  502. SendLineEvent(
  503. PDRVLINE pLine,
  504. PDRVCALL pCall,
  505. DWORD dwMsg,
  506. ULONG_PTR Param1,
  507. ULONG_PTR Param2,
  508. ULONG_PTR Param3
  509. );
  510. void
  511. PASCAL
  512. SendPhoneEvent(
  513. PDRVPHONE pPhone,
  514. DWORD dwMsg,
  515. ULONG_PTR Param1,
  516. ULONG_PTR Param2,
  517. ULONG_PTR Param3
  518. );