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.

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