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.

1580 lines
41 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name:
  4. server.h
  5. Abstract:
  6. Header file for tapi server & client
  7. Author:
  8. Dan Knudson (DanKn) 01-Apr-1995
  9. Revision History:
  10. --*/
  11. #include "rmotsp.h"
  12. #include "tapiclnt.h"
  13. #include "tlnklist.h"
  14. #include "tapievt.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define INVAL_KEY ((DWORD) 'LVNI')
  19. #define TCALL_KEY ((DWORD) 'LLAC')
  20. #define TINCOMPLETECALL_KEY ((DWORD) 'LACI')
  21. #define TZOMBIECALL_KEY ((DWORD) 'LACZ')
  22. #define TCALLCLIENT_KEY ((DWORD) 'ILCC')
  23. #define TCALLHUBCLIENT_KEY ((DWORD) 'CBUH')
  24. #define TINCOMPLETECALLCLIENT_KEY ((DWORD) 'LCCI')
  25. #define TLINE_KEY ((DWORD) 'ENIL')
  26. #define TINCOMPLETELINE_KEY ((DWORD) 'NILI')
  27. #define TLINECLIENT_KEY ((DWORD) 'ILCL')
  28. #define TPHONE_KEY ((DWORD) 'NOHP')
  29. #define TINCOMPLETEPHONE_KEY ((DWORD) 'OHPI')
  30. #define TPHONECLIENT_KEY ((DWORD) 'ILCP')
  31. #define TLINEAPP_KEY ((DWORD) 'PPAL')
  32. #define TPHONEAPP_KEY ((DWORD) 'PPAP')
  33. #define TCLIENT_KEY ((DWORD) 'TNLC')
  34. #define TCLIENTCLEANUP_KEY ((DWORD) 'CNLC')
  35. #define TZOMBIECLIENT_KEY ((DWORD) 'ZNLC')
  36. #define TPROVIDER_KEY ((DWORD) 'VORP')
  37. #define TASYNC_KEY ((DWORD) 'CYSA')
  38. #define TDLGINST_KEY ((DWORD) 'GOLD')
  39. #define TCONFLIST_KEY ((DWORD) 'FNOC')
  40. #define RSP_MSG ((DWORD)'RXYQ')
  41. #define RSP_CALLPARAMS 0xFEDC
  42. #ifdef _WIN64
  43. #define TALIGN_MASK 0xfffffff8
  44. #define TALIGN_COUNT 7
  45. #else
  46. #define TALIGN_MASK 0xfffffffc
  47. #define TALIGN_COUNT 3
  48. #endif
  49. #define ALIGN(a) (((a)+TALIGN_COUNT)&TALIGN_MASK)
  50. #define ALIGNED(a) (0 == ((a)&TALIGN_COUNT))
  51. #define INITIAL_EVENT_BUFFER_SIZE 1024
  52. #define DEF_NUM_LOOKUP_ENTRIES 16
  53. #define DEF_NUM_CONF_LIST_ENTRIES 4
  54. #define DEF_NUM_PTR_LIST_ENTRIES 8
  55. #define LINEPROXYREQUEST_LASTVALUE LINEPROXYREQUEST_SETAGENTSTATEEX
  56. #define BOGUS_REQUEST_ID 0x7fffffff
  57. #define DCF_SPIRETURNED 0x00000001
  58. #define DCF_DRVCALLVALID 0x00000002
  59. #define DCF_CREATEDINITIALMONITORS 0x00000004
  60. #define DCF_INCOMINGCALL 0x00010000
  61. #define SYNC_REQUESTS_ALL 0
  62. #define SYNC_REQUESTS_PER_WIDGET 1
  63. #define SYNC_REQUESTS_NONE 2
  64. #define SP_NONE 0xffffffff
  65. #define DGCLIENT_TIMEOUT 1000 // milliseconds
  66. #define DGCLIENTDISCONNECT_TIMEOUT (5*60*1000) // milliseconds
  67. #define SP_LINEACCEPT 0
  68. #define SP_LINEADDTOCONFERENCE 1
  69. #define SP_LINEAGENTSPECIFIC 2
  70. #define SP_LINEANSWER 3
  71. #define SP_LINEBLINDTRANSFER 4
  72. #define SP_LINECLOSE 5
  73. #define SP_LINECLOSECALL 6
  74. #define SP_LINECOMPLETECALL 7
  75. #define SP_LINECOMPLETETRANSFER 8
  76. #define SP_LINECONDITIONALMEDIADETECTION 9
  77. #define SP_LINEDEVSPECIFIC 10
  78. #define SP_LINEDEVSPECIFICFEATURE 11
  79. #define SP_LINEDIAL 12
  80. #define SP_LINEDROP 13
  81. #define SP_LINEFORWARD 14
  82. #define SP_LINEGATHERDIGITS 15
  83. #define SP_LINEGENERATEDIGITS 16
  84. #define SP_LINEGENERATETONE 17
  85. #define SP_LINEGETADDRESSCAPS 18
  86. #define SP_LINEGETADDRESSID 19
  87. #define SP_LINEGETADDRESSSTATUS 20
  88. #define SP_LINEGETAGENTACTIVITYLIST 21
  89. #define SP_LINEGETAGENTCAPS 22
  90. #define SP_LINEGETAGENTGROUPLIST 23
  91. #define SP_LINEGETAGENTSTATUS 24
  92. #define SP_LINEGETCALLADDRESSID 25
  93. #define SP_LINEGETCALLINFO 26
  94. #define SP_LINEGETCALLSTATUS 27
  95. #define SP_LINEGETDEVCAPS 28
  96. #define SP_LINEGETDEVCONFIG 29
  97. #define SP_LINEGETEXTENSIONID 30
  98. #define SP_LINEGETICON 31
  99. #define SP_LINEGETID 32
  100. #define SP_LINEGETLINEDEVSTATUS 33
  101. #define SP_LINEGETNUMADDRESSIDS 34
  102. #define SP_LINEHOLD 35
  103. #define SP_LINEMAKECALL 36
  104. #define SP_LINEMONITORDIGITS 37
  105. #define SP_LINEMONITORMEDIA 38
  106. #define SP_LINEMONITORTONES 39
  107. #define SP_LINENEGOTIATEEXTVERSION 40
  108. #define SP_LINENEGOTIATETSPIVERSION 41
  109. #define SP_LINEOPEN 42
  110. #define SP_LINEPARK 43
  111. #define SP_LINEPICKUP 44
  112. #define SP_LINEPREPAREADDTOCONFERENCE 45
  113. #define SP_LINEREDIRECT 46
  114. #define SP_LINERELEASEUSERUSERINFO 47
  115. #define SP_LINEREMOVEFROMCONFERENCE 48
  116. #define SP_LINESECURECALL 49
  117. #define SP_LINESELECTEXTVERSION 50
  118. #define SP_LINESENDUSERUSERINFO 51
  119. #define SP_LINESETAGENTACTIVITY 52
  120. #define SP_LINESETAGENTGROUP 53
  121. #define SP_LINESETAGENTSTATE 54
  122. #define SP_LINESETAPPSPECIFIC 55
  123. #define SP_LINESETCALLDATA 56
  124. #define SP_LINESETCALLPARAMS 57
  125. #define SP_LINESETCALLQUALITYOFSERVICE 58
  126. #define SP_LINESETCALLTREATMENT 59
  127. #define SP_LINESETCURRENTLOCATION 60
  128. #define SP_LINESETDEFAULTMEDIADETECTION 61
  129. #define SP_LINESETDEVCONFIG 62
  130. #define SP_LINESETLINEDEVSTATUS 63
  131. #define SP_LINESETMEDIACONTROL 64
  132. #define SP_LINESETMEDIAMODE 65
  133. #define SP_LINESETSTATUSMESSAGES 66
  134. #define SP_LINESETTERMINAL 67
  135. #define SP_LINESETUPCONFERENCE 68
  136. #define SP_LINESETUPTRANSFER 69
  137. #define SP_LINESWAPHOLD 70
  138. #define SP_LINEUNCOMPLETECALL 71
  139. #define SP_LINEUNHOLD 72
  140. #define SP_LINEUNPARK 73
  141. #define SP_PHONECLOSE 74
  142. #define SP_PHONEDEVSPECIFIC 75
  143. #define SP_PHONEGETBUTTONINFO 76
  144. #define SP_PHONEGETDATA 77
  145. #define SP_PHONEGETDEVCAPS 78
  146. #define SP_PHONEGETDISPLAY 79
  147. #define SP_PHONEGETEXTENSIONID 80
  148. #define SP_PHONEGETGAIN 81
  149. #define SP_PHONEGETHOOKSWITCH 82
  150. #define SP_PHONEGETICON 83
  151. #define SP_PHONEGETID 84
  152. #define SP_PHONEGETLAMP 85
  153. #define SP_PHONEGETRING 86
  154. #define SP_PHONEGETSTATUS 87
  155. #define SP_PHONEGETVOLUME 88
  156. #define SP_PHONENEGOTIATEEXTVERSION 89
  157. #define SP_PHONENEGOTIATETSPIVERSION 90
  158. #define SP_PHONEOPEN 91
  159. #define SP_PHONESELECTEXTVERSION 92
  160. #define SP_PHONESETBUTTONINFO 93
  161. #define SP_PHONESETDATA 94
  162. #define SP_PHONESETDISPLAY 95
  163. #define SP_PHONESETGAIN 96
  164. #define SP_PHONESETHOOKSWITCH 97
  165. #define SP_PHONESETLAMP 98
  166. #define SP_PHONESETRING 99
  167. #define SP_PHONESETSTATUSMESSAGES 100
  168. #define SP_PHONESETVOLUME 101
  169. #define SP_PROVIDERCREATELINEDEVICE 102
  170. #define SP_PROVIDERCREATEPHONEDEVICE 103
  171. #define SP_PROVIDERENUMDEVICES 104
  172. #define SP_PROVIDERFREEDIALOGINSTANCE 105
  173. #define SP_PROVIDERGENERICDIALOGDATA 106
  174. #define SP_PROVIDERINIT 107
  175. #define SP_PROVIDERSHUTDOWN 108
  176. #define SP_PROVIDERUIIDENTIFY 109
  177. #define SP_LINEMSPIDENTIFY 110
  178. #define SP_LINERECEIVEMSPDATA 111
  179. #define SP_PROVIDERCHECKFORNEWUSER 112
  180. #define SP_LINEGETCALLIDS 113
  181. #define SP_LINEGETCALLHUBTRACKING 114
  182. #define SP_LINESETCALLHUBTRACKING 115
  183. #define SP_PROVIDERPRIVATEFACTORYIDENTIFY 116
  184. #define SP_LINEDEVSPECIFICEX 117
  185. #define SP_LINECREATEAGENT 118
  186. #define SP_LINECREATEAGENTSESSION 119
  187. #define SP_LINEGETAGENTINFO 120
  188. #define SP_LINEGETAGENTSESSIONINFO 121
  189. #define SP_LINEGETAGENTSESSIONLIST 122
  190. #define SP_LINEGETQUEUEINFO 123
  191. #define SP_LINEGETGROUPLIST 124
  192. #define SP_LINEGETQUEUELIST 125
  193. #define SP_LINESETAGENTMEASUREMENTPERIOD 126
  194. #define SP_LINESETAGENTSESSIONSTATE 127
  195. #define SP_LINESETQUEUEMEASUREMENTPERIOD 128
  196. #define SP_LINESETAGENTSTATEEX 129
  197. #define SP_LINEGETPROXYSTATUS 130
  198. #define SP_LINECREATEMSPINSTANCE 131
  199. #define SP_LINECLOSEMSPINSTANCE 132
  200. #define SP_LASTPROCNUMBER (SP_LINECLOSEMSPINSTANCE + 1)
  201. // TAPICLIENT api
  202. #define TC_LOAD 0
  203. #define TC_FREE 1
  204. #define TC_CLIENTINITIALIZE 2
  205. #define TC_CLIENTSHUTDOWN 3
  206. #define TC_GETDEVICEACCESS 4
  207. #define TC_LINEADDTOCONFERENCE 5
  208. #define TC_LINEBLINDTRANSFER 6
  209. #define TC_LINECONFIGDIALOG 7
  210. #define TC_LINEDIAL 8
  211. #define TC_LINEFORWARD 9
  212. #define TC_LINEGENERATEDIGITS 10
  213. #define TC_LINEMAKECALL 11
  214. #define TC_LINEOPEN 12
  215. #define TC_LINEREDIRECT 13
  216. #define TC_LINESETCALLDATA 14
  217. #define TC_LINESETCALLPARAMS 15
  218. #define TC_LINESETCALLPRIVILEGE 16
  219. #define TC_LINESETCALLTREATMENT 17
  220. #define TC_LINESETCURRENTLOCATION 18
  221. #define TC_LINESETDEVCONFIG 19
  222. #define TC_LINESETLINEDEVSTATUS 20
  223. #define TC_LINESETMEDIACONTROL 21
  224. #define TC_LINESETMEDIAMODE 22
  225. #define TC_LINESETTERMINAL 23
  226. #define TC_LINESETTOLLLIST 24
  227. #define TC_PHONECONFIGDIALOG 25
  228. #define TC_PHONEOPEN 26
  229. #define TC_LASTPROCNUMBER TC_PHONEOPEN+1
  230. #define myexcept except(EXCEPTION_EXECUTE_HANDLER)
  231. #define CN_CLIENT ((ULONG_PTR) -1)
  232. #define DG_CLIENT ((ULONG_PTR) -2)
  233. #define MMC_CLIENT ((ULONG_PTR) -3)
  234. #define IS_REMOTE_CLIENT(ptClient) \
  235. (((((ULONG_PTR) ptClient->hProcess) & DG_CLIENT) == DG_CLIENT) || \
  236. (ptClient->hProcess == (HANDLE) MMC_CLIENT))
  237. #define IS_REMOTE_CN_CLIENT(ptClient) \
  238. (ptClient->hProcess == (HANDLE) CN_CLIENT)
  239. #define IS_REMOTE_DG_CLIENT(ptClient) \
  240. (ptClient->hProcess == (HANDLE) DG_CLIENT)
  241. #define IS_REMOTE_MMC_CLIENT(ptClient) \
  242. (ptClient->hProcess == (HANDLE) MMC_CLIENT)
  243. #define SET_FLAG(dw,fl) (dw) |= (fl)
  244. #define RESET_FLAG(dw,fl) (dw) &= ~(fl)
  245. #define IS_FLAG_SET(dw,fl) ((dw) & (fl))
  246. typedef LONG (PASCAL *TSPIPROC)();
  247. typedef LONG (PASCAL *CLIENTPROC)();
  248. typedef struct _TPOINTERLIST
  249. {
  250. DWORD dwNumUsedEntries;
  251. LPVOID aEntries[DEF_NUM_PTR_LIST_ENTRIES];
  252. } TPOINTERLIST, *PTPOINTERLIST;
  253. typedef struct _THASHTABLEENTRY
  254. {
  255. DWORD dwCallHubID;
  256. LONG lCookie;
  257. LIST_ENTRY CallHubList;
  258. struct _TCALLHUBCLIENT *ptCallHubClients;
  259. struct _THASHTABLEENTRY *pNext;
  260. } THASHTABLEENTRY, *PTHASHTABLEENTRY;
  261. typedef struct _TPROVIDER
  262. {
  263. DWORD dwKey;
  264. HANDLE hMutex;
  265. HINSTANCE hDll;
  266. DWORD dwTSPIOptions;
  267. DWORD dwSPIVersion;
  268. DWORD dwPermanentProviderID;
  269. struct _TPROVIDER *pPrev;
  270. struct _TPROVIDER *pNext;
  271. DWORD dwNumHashTableEntries;
  272. DWORD dwNumDynamicHashTableEntries;
  273. PTHASHTABLEENTRY pHashTable;
  274. LONG lHashTableReaderCount;
  275. HANDLE hHashTableReaderEvent;
  276. CRITICAL_SECTION HashTableCritSec;
  277. TSPIPROC apfn[SP_LASTPROCNUMBER];
  278. DWORD dwNameHash;
  279. TCHAR szFileName[1];
  280. } TPROVIDER, *PTPROVIDER;
  281. typedef struct _TCALLHUBCLIENT
  282. {
  283. DWORD dwKey;
  284. struct _TCLIENT * ptClient;
  285. PTPROVIDER ptProvider;
  286. DWORD dwCallHubID;
  287. HCALLHUB hCallHub;
  288. struct _TLINEAPP *ptLineApp;
  289. struct _TCALLHUBCLIENT *pNext;
  290. } TCALLHUBCLIENT, *PTCALLHUBCLIENT;
  291. typedef struct _TCALLCLIENT
  292. {
  293. DWORD dwKey;
  294. struct _TCLIENT *ptClient;
  295. struct _TLINECLIENT *ptLineClient;
  296. struct _TCALL *ptCall;
  297. DWORD dwPrivilege;
  298. DWORD dwMonitorDigitModes;
  299. DWORD dwMonitorMediaModes;
  300. //
  301. // The following field is used to determine whether we need to
  302. // set or zero the LINE_CALLSTATE\dwParam3 parameter to indicate
  303. // a privilege change to the app
  304. //
  305. BYTE bIndicatePrivilege;
  306. BYTE bMonitoringTones;
  307. BYTE bUnused1;
  308. BYTE bUnused2;
  309. struct _TCALLCLIENT *pPrevSametCall;
  310. struct _TCALLCLIENT *pNextSametCall;
  311. struct _TCALLCLIENT *pPrevSametLineClient;
  312. struct _TCALLCLIENT *pNextSametLineClient;
  313. struct _TCALLHUBCLIENT *ptCallHubClient;
  314. DWORD hCall;
  315. DWORD adwEventSubMasks[EM_NUM_MASKS];
  316. } TCALLCLIENT, *PTCALLCLIENT;
  317. typedef struct _TCALL
  318. {
  319. DWORD dwKey;
  320. PTCALLCLIENT ptCallClients;
  321. struct _TLINE *ptLine;
  322. PTPROVIDER ptProvider;
  323. DWORD dwDrvCallFlags;
  324. BOOL bCreatedInitialMonitors;
  325. HDRVCALL hdCall;
  326. HCALL hCall;
  327. DWORD dwAddressID;
  328. DWORD dwCallState;
  329. DWORD dwCallStateMode;
  330. DWORD dwNumOwners;
  331. DWORD dwNumMonitors;
  332. BOOL bAlertApps;
  333. DWORD dwAppNameSize;
  334. LPVOID pszAppName;
  335. DWORD dwDisplayableAddressSize;
  336. LPVOID pszDisplayableAddress;
  337. DWORD dwCalledPartySize;
  338. LPVOID pszCalledParty;
  339. DWORD dwCommentSize;
  340. LPVOID pszComment;
  341. struct _TCONFERENCELIST * pConfList;
  342. struct _TCALL *pPrev;
  343. struct _TCALL *pNext;
  344. DWORD dwCallID;
  345. DWORD dwRelatedCallID;
  346. LIST_ENTRY CallHubList;
  347. #define DEF_NUM_FAST_CALLCLIENTS 2
  348. LONG lUsedFastCallClients;
  349. LONG lActiveFastCallClients;
  350. TCALLCLIENT aFastCallClients[DEF_NUM_FAST_CALLCLIENTS];
  351. } TCALL, *PTCALL;
  352. typedef struct _TCONFERENCELIST
  353. {
  354. DWORD dwKey;
  355. DWORD dwNumTotalEntries;
  356. DWORD dwNumUsedEntries;
  357. struct _TCONFERENCELIST *pNext;
  358. PTCALL aptCalls[1];
  359. } TCONFERENCELIST, *PTCONFERENCELIST;
  360. typedef struct _TLINE
  361. {
  362. DWORD dwKey;
  363. HANDLE hMutex;
  364. struct _TLINECLIENT * ptLineClients;
  365. LPVOID apProxys[LINEPROXYREQUEST_LASTVALUE+1];
  366. PTPROVIDER ptProvider;
  367. HDRVLINE hdLine;
  368. HLINE hLine;
  369. DWORD dwDeviceID;
  370. DWORD dwSPIVersion;
  371. DWORD dwExtVersion;
  372. DWORD dwExtVersionCount;
  373. DWORD dwNumAddresses;
  374. DWORD dwOpenMediaModes;
  375. DWORD dwNumOpens;
  376. DWORD dwUnionLineStates;
  377. DWORD dwUnionAddressStates;
  378. PTCALL ptCalls;
  379. DWORD dwNumCallHubTrackers;
  380. DWORD dwNumCallHubTrackersSPLevel;
  381. DWORD dwBusy;
  382. } TLINE, *PTLINE;
  383. typedef struct _TLINECLIENT
  384. {
  385. DWORD dwKey;
  386. struct _TCLIENT * ptClient;
  387. struct _TLINEAPP * ptLineApp;
  388. DWORD hLine;
  389. PTLINE ptLine;
  390. DWORD dwAddressID;
  391. PTCALLCLIENT ptCallClients;
  392. DWORD hRemoteLine;
  393. DWORD dwAPIVersion;
  394. DWORD dwPrivileges;
  395. DWORD dwMediaModes;
  396. DWORD OpenContext; // was : DWORD dwCallbackInstance;
  397. DWORD dwLineStates;
  398. DWORD dwAddressStates;
  399. LPDWORD aNumRings;
  400. DWORD dwExtVersion;
  401. struct _TLINECLIENT *pPrevSametLine;
  402. struct _TLINECLIENT *pNextSametLine;
  403. struct _TLINECLIENT *pPrevSametLineApp;
  404. struct _TLINECLIENT *pNextSametLineApp;
  405. LPVOID pPendingProxyRequests;
  406. DWORD dwCurrentTracking;
  407. HDRVMSPLINE hdMSPLine;
  408. LPTSTR szProxyClsid;
  409. DWORD adwEventSubMasks[EM_NUM_MASKS];
  410. } TLINECLIENT, *PTLINECLIENT;
  411. typedef struct _TPHONE
  412. {
  413. DWORD dwKey;
  414. HANDLE hMutex;
  415. struct _TPHONECLIENT * ptPhoneClients;
  416. PTPROVIDER ptProvider;
  417. HDRVPHONE hdPhone;
  418. HPHONE hPhone;
  419. DWORD dwDeviceID;
  420. DWORD dwSPIVersion;
  421. DWORD dwExtVersion;
  422. DWORD dwExtVersionCount;
  423. DWORD dwNumOwners;
  424. DWORD dwNumMonitors;
  425. DWORD dwUnionPhoneStates;
  426. DWORD dwUnionButtonModes;
  427. DWORD dwUnionButtonStates;
  428. DWORD dwBusy;
  429. } TPHONE, *PTPHONE;
  430. typedef struct _TPHONECLIENT
  431. {
  432. DWORD dwKey;
  433. struct _TCLIENT * ptClient;
  434. struct _TPHONEAPP * ptPhoneApp;
  435. PTPHONE ptPhone;
  436. DWORD hRemotePhone;
  437. DWORD dwAPIVersion;
  438. DWORD dwExtVersion;
  439. DWORD dwPrivilege;
  440. DWORD OpenContext; // was : DWORD dwCallbackInstance;
  441. DWORD dwPhoneStates;
  442. DWORD dwButtonModes;
  443. DWORD dwButtonStates;
  444. struct _TPHONECLIENT *pPrevSametPhone;
  445. struct _TPHONECLIENT *pNextSametPhone;
  446. struct _TPHONECLIENT *pPrevSametPhoneApp;
  447. struct _TPHONECLIENT *pNextSametPhoneApp;
  448. DWORD hPhone;
  449. DWORD adwEventSubMasks[EM_NUM_MASKS];
  450. } TPHONECLIENT, *PTPHONECLIENT;
  451. typedef struct _TLINEAPP
  452. {
  453. DWORD dwKey;
  454. struct _TCLIENT * ptClient;
  455. PTLINECLIENT ptLineClients;
  456. DWORD hLineApp;
  457. DWORD InitContext; // was: LINECALLBACK lpfnCallback;
  458. struct _TLINEAPP *pPrev;
  459. struct _TLINEAPP *pNext;
  460. DWORD dwAPIVersion;
  461. DWORD bReqMediaCallRecipient;
  462. LPVOID pRequestRecipient;
  463. DWORD dwFriendlyNameSize;
  464. WCHAR *pszFriendlyName;
  465. DWORD adwEventSubMasks[EM_NUM_MASKS];
  466. DWORD dwModuleNameSize;
  467. WCHAR *pszModuleName;
  468. } TLINEAPP, *PTLINEAPP;
  469. typedef struct _TPHONEAPP
  470. {
  471. DWORD dwKey;
  472. DWORD hPhoneApp;
  473. struct _TCLIENT * ptClient;
  474. DWORD InitContext; // was: PHONECALLBACK lpfnCallback;
  475. PTPHONECLIENT ptPhoneClients;
  476. struct _TPHONEAPP *pPrev;
  477. struct _TPHONEAPP *pNext;
  478. WCHAR *pszFriendlyName;
  479. WCHAR *pszModuleName;
  480. DWORD dwAPIVersion;
  481. DWORD dwFriendlyNameSize;
  482. DWORD dwModuleNameSize;
  483. DWORD adwEventSubMasks[EM_NUM_MASKS];
  484. } TPHONEAPP, *PTPHONEAPP;
  485. typedef struct _TAPIDIALOGINSTANCE
  486. {
  487. DWORD dwKey;
  488. struct _TCLIENT * ptClient;
  489. DWORD dwPermanentProviderID;
  490. HINSTANCE hTsp;
  491. TSPIPROC pfnTSPI_providerGenericDialogData;
  492. PTPROVIDER ptProvider;
  493. HDRVDIALOGINSTANCE hdDlgInst;
  494. WCHAR *pszProviderFilename;
  495. DWORD bRemoveProvider;
  496. struct _TAPIDIALOGINSTANCE *pPrev;
  497. struct _TAPIDIALOGINSTANCE *pNext;
  498. HTAPIDIALOGINSTANCE htDlgInst;
  499. } TAPIDIALOGINSTANCE, *PTAPIDIALOGINSTANCE;
  500. // management DLL client info
  501. typedef struct _TMANAGEDLLINFO
  502. {
  503. HINSTANCE hDll;
  504. DWORD dwID;
  505. CLIENTPROC aProcs[TC_LASTPROCNUMBER];
  506. LPWSTR pszName;
  507. DWORD dwAPIVersion;
  508. struct _TMANAGEDLLINFO *pNext;
  509. } TMANAGEDLLINFO, *PTMANAGEDLLINFO;
  510. typedef struct _TCLIENTHANDLE
  511. {
  512. HMANAGEMENTCLIENT hClient;
  513. DWORD dwID;
  514. BOOL fValid;
  515. struct _TCLIENTHANDLE *pNext;
  516. } TCLIENTHANDLE, *PTCLIENTHANDLE;
  517. typedef struct _TCLIENT
  518. {
  519. DWORD dwKey;
  520. HANDLE hProcess;
  521. DWORD dwUserNameSize;
  522. WCHAR *pszUserName;
  523. DWORD dwComputerNameSize;
  524. WCHAR *pszComputerName;
  525. WCHAR *pszDomainName;
  526. PCONTEXT_HANDLE_TYPE2 phContext;
  527. PTCLIENTHANDLE pClientHandles;
  528. HMANAGEMENTCLIENT hMapper;
  529. LPTAPIPERMANENTID pLineMap;
  530. LPDWORD pLineDevices;
  531. DWORD dwLineDevices;
  532. LPTAPIPERMANENTID pPhoneMap;
  533. LPDWORD pPhoneDevices;
  534. DWORD dwPhoneDevices;
  535. union
  536. {
  537. HANDLE hValidEventBufferDataEvent;
  538. HANDLE hMailslot;
  539. };
  540. DWORD dwEventBufferTotalSize;
  541. DWORD dwEventBufferUsedSize;
  542. LPBYTE pEventBuffer;
  543. LPBYTE pDataIn;
  544. LPBYTE pDataOut;
  545. PTLINEAPP ptLineApps;
  546. PTPHONEAPP ptPhoneApps;
  547. PTAPIDIALOGINSTANCE pProviderXxxDlgInsts;
  548. PTAPIDIALOGINSTANCE pGenericDlgInsts;
  549. struct _TCLIENT *pPrev;
  550. struct _TCLIENT *pNext;
  551. DWORD dwFlags;
  552. LIST_ENTRY MsgPendingListEntry;
  553. union
  554. {
  555. DWORD dwDgRetryTimeoutTickCount;
  556. DWORD dwCnBusy;
  557. };
  558. DWORD dwDgEventsRetrievedTickCount;
  559. DWORD htClient;
  560. DWORD adwEventSubMasks[EM_NUM_MASKS];
  561. } TCLIENT, *PTCLIENT;
  562. #define PTCLIENT_FLAG_ADMINISTRATOR 1
  563. #define PTCLIENT_FLAG_SKIPFIRSTMESSAGE 2
  564. #define PTCLIENT_FLAG_LOCKEDMMCWRITE 4
  565. typedef struct _TREQUESTRECIPIENT
  566. {
  567. PTLINEAPP ptLineApp;
  568. DWORD dwRegistrationInstance;
  569. struct _TREQUESTRECIPIENT *pPrev;
  570. struct _TREQUESTRECIPIENT *pNext;
  571. } TREQUESTRECIPIENT, *PTREQUESTRECIPIENT;
  572. typedef void (*SRVPOSTPROCESSPROC)(LPVOID, LPVOID, LPVOID);
  573. //WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
  574. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  575. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  576. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  577. //
  578. // The SPEVENT struct below must have the dwKey/dwType and ListEntry
  579. // fields in the same relative place in the structure as ASYNCREQUESTINFO!
  580. // Code in SERVER.C assumes this is an OK thing to do.
  581. //
  582. typedef struct _ASYNCREQUESTINFO
  583. {
  584. DWORD dwKey;
  585. LIST_ENTRY ListEntry;
  586. ULONG_PTR htXxx;
  587. PTCLIENT ptClient;
  588. LONG lResult;
  589. SRVPOSTPROCESSPROC pfnPostProcess;
  590. DWORD dwLineFlags;
  591. DWORD InitContext;
  592. DWORD OpenContext;
  593. DWORD hfnClientPostProcessProc;
  594. DWORD dwLocalRequestID;
  595. DWORD dwRemoteRequestID;
  596. ULONG_PTR dwParam1;
  597. ULONG_PTR dwParam2;
  598. ULONG_PTR dwParam3;
  599. ULONG_PTR dwParam4;
  600. ULONG_PTR dwParam5;
  601. } ASYNCREQUESTINFO, *PASYNCREQUESTINFO;
  602. enum {
  603. SP_LINE_EVENT = 1,
  604. SP_COMPLETION_EVENT,
  605. SP_PHONE_EVENT
  606. };
  607. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  608. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  609. //
  610. // (see above)
  611. //
  612. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  613. //DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY! DEPENDENCY!
  614. typedef struct _SPEVENT
  615. {
  616. DWORD dwType;
  617. LIST_ENTRY ListEntry;
  618. union
  619. {
  620. HTAPILINE htLine;
  621. HTAPIPHONE htPhone;
  622. DWORD dwRequestID;
  623. };
  624. union
  625. {
  626. HTAPICALL htCall;
  627. LONG lResult;
  628. };
  629. DWORD dwMsg;
  630. ULONG_PTR dwParam1;
  631. ULONG_PTR dwParam2;
  632. ULONG_PTR dwParam3;
  633. } SPEVENT, *PSPEVENT;
  634. typedef struct _SPEVENTHANDLERTHREADINFO
  635. {
  636. LIST_ENTRY ListHead;
  637. HANDLE hEvent;
  638. CRITICAL_SECTION CritSec;
  639. } SPEVENTHANDLERTHREADINFO, *PSPEVENTHANDLERTHREADINFO;
  640. //
  641. // The following XXXTUPLE types give us a quick easy way to retrieve
  642. // the ptProvider and ptXxx associated with the widget (the widget ID
  643. // is used as an index into a global array)
  644. //
  645. typedef struct _TLINELOOKUPENTRY
  646. {
  647. DWORD dwSPIVersion;
  648. PTLINE ptLine;
  649. HANDLE hMutex;
  650. PTPROVIDER ptProvider;
  651. DWORD bRemoved;
  652. DWORD bRemote;
  653. } TLINELOOKUPENTRY, *PTLINELOOKUPENTRY;
  654. typedef struct _TLINELOOKUPTABLE
  655. {
  656. DWORD dwNumTotalEntries;
  657. DWORD dwNumUsedEntries;
  658. struct _TLINELOOKUPTABLE *pNext;
  659. TLINELOOKUPENTRY aEntries[1];
  660. } TLINELOOKUPTABLE, *PTLINELOOKUPTABLE;
  661. typedef struct _TPHONELOOKUPENTRY
  662. {
  663. DWORD dwSPIVersion;
  664. PTPHONE ptPhone;
  665. HANDLE hMutex;
  666. PTPROVIDER ptProvider;
  667. DWORD bRemoved;
  668. } TPHONELOOKUPENTRY, *PTPHONELOOKUPENTRY;
  669. typedef struct _TPHONELOOKUPTABLE
  670. {
  671. DWORD dwNumTotalEntries;
  672. DWORD dwNumUsedEntries;
  673. struct _TPHONELOOKUPTABLE *pNext;
  674. TPHONELOOKUPENTRY aEntries[1];
  675. } TPHONELOOKUPTABLE, *PTPHONELOOKUPTABLE;
  676. typedef struct _TREQUESTMAKECALL
  677. {
  678. LINEREQMAKECALLW LineReqMakeCall;
  679. struct _TREQUESTMAKECALL *pNext;
  680. } TREQUESTMAKECALL, *PTREQUESTMAKECALL;
  681. typedef struct _TMANAGEDLLLISTHEADER
  682. {
  683. LONG lCount;
  684. PTMANAGEDLLINFO pFirst;
  685. } TMANAGEDLLLISTHEADER, *PTMANAGEDLLLISTHEADER;
  686. typedef struct _PERMANENTIDELEMENT
  687. {
  688. DWORD dwPermanentID;
  689. DWORD dwDeviceID;
  690. } PERMANENTIDELEMENT, *PPERMANENTIDELEMENT;
  691. typedef struct _PERMANENTIDARRAYHEADER
  692. {
  693. LONG lCookie;
  694. DWORD dwPermanentProviderID;
  695. PPERMANENTIDELEMENT pLineElements;
  696. DWORD dwNumLines;
  697. DWORD dwCurrentLines;
  698. PPERMANENTIDELEMENT pPhoneElements;
  699. DWORD dwNumPhones;
  700. DWORD dwCurrentPhones;
  701. struct _PERMANENTIDARRAYHEADER *pNext;
  702. } PERMANENTIDARRAYHEADER, *PPERMANENTIDARRAYHEADER;
  703. typedef struct _PRILISTSTRUCT
  704. {
  705. DWORD dwMediaModes;
  706. LPWSTR pszPriList;
  707. } PRILISTSTRUCT, *PPRILISTSTRUCT;
  708. #ifdef __TAPI_DEBUG_CS__
  709. #define DEBUG_CS_FILENAME_LEN 16
  710. typedef struct _DEBUG_CS_CODEPATH
  711. {
  712. char szSourceFile[ DEBUG_CS_FILENAME_LEN ];
  713. DWORD dwSourceLine;
  714. DWORD dwThreadId;
  715. } DEBUG_CS_CODEPATH;
  716. typedef struct _DEBUG_CS_CRITICAL_SECTION
  717. {
  718. CRITICAL_SECTION CriticalSection;
  719. DEBUG_CS_CODEPATH LastEnter;
  720. DEBUG_CS_CODEPATH LastLeave;
  721. } DEBUG_CS_CRITICAL_SECTION, *PDEBUG_CS_CRITICAL_SECTION;
  722. #define TapiInitializeCriticalSection(a) \
  723. ZeroMemory((a), sizeof(DEBUG_CS_CRITICAL_SECTION)); \
  724. InitializeCriticalSection(&((a)->CriticalSection));
  725. #define TapiInitializeCriticalSectionAndSpinCount(a, b) \
  726. (ZeroMemory((a), sizeof(DEBUG_CS_CRITICAL_SECTION)), \
  727. InitializeCriticalSectionAndSpinCount(&((a)->CriticalSection), b))
  728. #define TapiMyInitializeCriticalSection(a, b) \
  729. (ZeroMemory((a), sizeof(DEBUG_CS_CRITICAL_SECTION)), \
  730. MyInitializeCriticalSection(&((a)->CriticalSection), b))
  731. #define TapiDeleteCriticalSection(a) \
  732. DeleteCriticalSection(&((a)->CriticalSection));
  733. #define TapiEnterCriticalSection(a) \
  734. EnterCriticalSection(&((a)->CriticalSection)); \
  735. (a)->LastEnter.dwSourceLine = __LINE__; \
  736. (a)->LastEnter.dwThreadId = GetCurrentThreadId( ); \
  737. strcpy( \
  738. (a)->LastEnter.szSourceFile, \
  739. (strlen(__FILE__) < DEBUG_CS_FILENAME_LEN)? \
  740. (__FILE__) : (__FILE__ + (strlen(__FILE__) + 1 - DEBUG_CS_FILENAME_LEN) ));
  741. #define TapiLeaveCriticalSection(a) \
  742. (a)->LastLeave.dwSourceLine = __LINE__; \
  743. (a)->LastLeave.dwThreadId = GetCurrentThreadId( ); \
  744. strcpy( \
  745. (a)->LastLeave.szSourceFile, \
  746. (strlen(__FILE__) < DEBUG_CS_FILENAME_LEN)? \
  747. (__FILE__) : (__FILE__ + (strlen(__FILE__) + 1 - DEBUG_CS_FILENAME_LEN) )); \
  748. LeaveCriticalSection(&((a)->CriticalSection));
  749. #else // #ifdef __TAPI_DEBUG_CS__
  750. #define TapiInitializeCriticalSection(a) \
  751. InitializeCriticalSection(a);
  752. #define TapiInitializeCriticalSectionAndSpinCount(a, b) \
  753. InitializeCriticalSectionAndSpinCount(a, b)
  754. #define TapiMyInitializeCriticalSection(a, b) \
  755. MyInitializeCriticalSection(a, b)
  756. #define TapiDeleteCriticalSection(a) \
  757. DeleteCriticalSection(a);
  758. #define TapiEnterCriticalSection(a) \
  759. EnterCriticalSection(a);
  760. #define TapiLeaveCriticalSection(a) \
  761. LeaveCriticalSection(a);
  762. #endif // #ifdef __TAPI_DEBUG_CS__
  763. typedef struct _TAPIGLOBALS
  764. {
  765. HINSTANCE hinstDll;
  766. HICON hLineIcon;
  767. HICON hPhoneIcon;
  768. HANDLE hProcess;
  769. #define TAPIGLOBALS_REINIT (0x00000001)
  770. #define TAPIGLOBALS_SERVER (0x00000002)
  771. #define TAPIGLOBALS_PAUSED (0x00000004)
  772. DWORD dwFlags;
  773. PTCLIENT ptClients;
  774. PTPROVIDER ptProviders;
  775. DWORD dwNumLineInits;
  776. DWORD dwNumLines;
  777. PTLINELOOKUPTABLE pLineLookup;
  778. DWORD dwNumPhoneInits;
  779. DWORD dwNumPhones;
  780. PTPHONELOOKUPTABLE pPhoneLookup;
  781. PTREQUESTRECIPIENT pRequestRecipients;
  782. PTREQUESTRECIPIENT pHighestPriorityRequestRecipient;
  783. PTREQUESTMAKECALL pRequestMakeCallList;
  784. PTREQUESTMAKECALL pRequestMakeCallListEnd;
  785. PRILISTSTRUCT * pPriLists;
  786. DWORD dwUsedPriorityLists;
  787. DWORD dwTotalPriorityLists;
  788. WCHAR *pszReqMakeCallPriList;
  789. WCHAR *pszReqMediaCallPriList;
  790. DWORD dwComputerNameSize;
  791. WCHAR *pszComputerName;
  792. SERVICE_STATUS_HANDLE sshStatusHandle;
  793. #if TELE_SERVER
  794. PTMANAGEDLLINFO pMapperDll;
  795. PTMANAGEDLLLISTHEADER pManageDllList;
  796. PPERMANENTIDARRAYHEADER pIDArrays;
  797. #endif
  798. ULONG64 ulPermMasks;
  799. #ifdef __TAPI_DEBUG_CS__
  800. DEBUG_CS_CRITICAL_SECTION CritSec;
  801. #else
  802. CRITICAL_SECTION CritSec;
  803. #endif
  804. CRITICAL_SECTION RemoteSPCritSec;
  805. } TAPIGLOBALS, *PTAPIGLOBALS;
  806. typedef struct _GETEVENTS_PARAMS
  807. {
  808. union
  809. {
  810. OUT LONG lResult;
  811. };
  812. DWORD dwUnused;
  813. union
  814. {
  815. IN DWORD dwTotalBufferSize;
  816. };
  817. union
  818. {
  819. OUT DWORD dwNeededBufferSize;
  820. };
  821. union
  822. {
  823. OUT DWORD dwUsedBufferSize;
  824. };
  825. } GETEVENTS_PARAMS, *PGETEVENTS_PARAMS;
  826. typedef struct _GETUIDLLNAME_PARAMS
  827. {
  828. union
  829. {
  830. OUT LONG lResult;
  831. };
  832. DWORD dwUnused;
  833. union
  834. {
  835. IN DWORD dwObjectID;
  836. };
  837. union
  838. {
  839. IN DWORD dwObjectType;
  840. };
  841. union
  842. {
  843. OUT DWORD dwUIDllNameOffset;
  844. };
  845. union
  846. {
  847. IN OUT DWORD dwUIDllNameSize;
  848. };
  849. //
  850. // The following fields used only for providerConfig, -Install, & -Remove
  851. //
  852. union
  853. {
  854. IN DWORD dwProviderFilenameOffset;
  855. };
  856. union
  857. {
  858. IN DWORD bRemoveProvider;
  859. };
  860. OUT HTAPIDIALOGINSTANCE htDlgInst;
  861. } GETUIDLLNAME_PARAMS, *PGETUIDLLNAME_PARAMS;
  862. typedef struct _UIDLLCALLBACK_PARAMS
  863. {
  864. union
  865. {
  866. OUT LONG lResult;
  867. };
  868. DWORD dwUnused;
  869. IN DWORD ObjectID;
  870. union
  871. {
  872. IN DWORD dwObjectType;
  873. };
  874. union
  875. {
  876. IN DWORD dwParamsInOffset;
  877. };
  878. union
  879. {
  880. IN DWORD dwParamsInSize;
  881. };
  882. union
  883. {
  884. OUT DWORD dwParamsOutOffset;
  885. };
  886. union
  887. {
  888. IN OUT DWORD dwParamsOutSize;
  889. };
  890. } UIDLLCALLBACK_PARAMS, *PUIDLLCALLBACK_PARAMS;
  891. typedef struct _FREEDIALOGINSTANCE_PARAMS
  892. {
  893. union
  894. {
  895. OUT LONG lResult;
  896. };
  897. DWORD dwUnused;
  898. union
  899. {
  900. IN HTAPIDIALOGINSTANCE htDlgInst;
  901. };
  902. union
  903. {
  904. IN LONG lUIDllResult;
  905. };
  906. } FREEDIALOGINSTANCE_PARAMS, *PFREEDIALOGINSTANCE_PARAMS;
  907. typedef struct _PROXYREQUESTWRAPPER
  908. {
  909. ASYNCEVENTMSG AsyncEventMsg;
  910. LINEPROXYREQUEST ProxyRequest;
  911. } PROXYREQUESTWRAPPER, *PPROXYREQUESTWRAPPER;
  912. typedef struct _PRIVATEFACTORYIDENTIFY_PARAMS
  913. {
  914. union
  915. {
  916. OUT LONG lResult;
  917. };
  918. DWORD dwUnused;
  919. union
  920. {
  921. IN DWORD dwDeviceID;
  922. };
  923. union
  924. {
  925. OUT DWORD dwCLSIDOffset;
  926. };
  927. union
  928. {
  929. IN OUT DWORD dwCLSIDSize;
  930. };
  931. } PRIVATEFACTORYIDENTIFY_PARAMS, *PPRIVATEFACTORYIDENTIFY_PARAMS;
  932. #if DBG
  933. #define DBGOUT(arg) DbgPrt arg
  934. VOID
  935. DbgPrt(
  936. IN DWORD dwDbgLevel,
  937. IN PUCHAR DbgMessage,
  938. IN ...
  939. );
  940. #define ASSERT(exp) if(!(exp)) { DbgPrt(0, "ASSERT : File : %s; Line : %d\n", __FILE__, __LINE__) ;}
  941. typedef struct _MYMEMINFO
  942. {
  943. //
  944. // The dwDummy field at the top of this struct is there because on
  945. // x86 the heap mgr seems to trash this field when you free the
  946. // block (uses it as a list entry pointer or some such). We'd like
  947. // to see the line/file info preserved in hopes of getting more
  948. // clues when debugging.
  949. //
  950. DWORD dwDummy;
  951. DWORD dwLine;
  952. PSTR pszFile;
  953. } MYMEMINFO, *PMYMEMINFO;
  954. #else
  955. #define DBGOUT(arg)
  956. #define ASSERT(exp)
  957. #endif
  958. #if DBG
  959. #define ServerAlloc( __size__ ) ServerAllocReal( __size__, __LINE__, __FILE__ )
  960. LPVOID
  961. WINAPI
  962. ServerAllocReal(
  963. DWORD dwSize,
  964. DWORD dwLine,
  965. PSTR pszFile
  966. );
  967. #else
  968. #define ServerAlloc( __size__ ) ServerAllocReal( __size__ )
  969. LPVOID
  970. WINAPI
  971. ServerAllocReal(
  972. DWORD dwSize
  973. );
  974. #endif
  975. VOID
  976. WINAPI
  977. ServerFree(
  978. LPVOID lp
  979. );
  980. #if DBG
  981. #define MyCreateMutex() MyRealCreateMutex(__FILE__, __LINE__)
  982. HANDLE
  983. MyRealCreateMutex(PSTR pFile, DWORD dwLine);
  984. #else
  985. #define MyCreateMutex() MyRealCreateMutex()
  986. HANDLE
  987. MyRealCreateMutex(
  988. void
  989. );
  990. #endif
  991. void
  992. MyCloseMutex(
  993. HANDLE hMutex
  994. );
  995. BOOL
  996. PASCAL
  997. MyDuplicateHandle(
  998. HANDLE hSource,
  999. LPHANDLE phTarget
  1000. );
  1001. VOID
  1002. CALLBACK
  1003. CompletionProc(
  1004. PASYNCREQUESTINFO pAsyncRequestInfo,
  1005. LONG lResult
  1006. );
  1007. BOOL
  1008. WaitForMutex(
  1009. HANDLE hMutex,
  1010. HANDLE *phMutex,
  1011. BOOL *pbCloseMutex,
  1012. LPVOID pWidget,
  1013. DWORD dwKey,
  1014. DWORD dwTimeout
  1015. );
  1016. void
  1017. MyReleaseMutex(
  1018. HANDLE hMutex,
  1019. BOOL bCloseMutex
  1020. );
  1021. LONG
  1022. PASCAL
  1023. DestroytLineApp(
  1024. HLINEAPP hLineApp
  1025. );
  1026. LONG
  1027. DestroytPhoneApp(
  1028. HPHONEAPP hPhoneApp
  1029. );
  1030. LONG
  1031. ServerInit(
  1032. BOOL fReinit
  1033. );
  1034. LONG
  1035. ServerShutdown(
  1036. void
  1037. );
  1038. void
  1039. WriteEventBuffer(
  1040. PTCLIENT ptClient,
  1041. PASYNCEVENTMSG pMsg
  1042. );
  1043. BOOL
  1044. PASCAL
  1045. QueueSPEvent(
  1046. PSPEVENT pSPEvent
  1047. );
  1048. VOID
  1049. QueueStaleObject(
  1050. LPVOID pObjectToQueue
  1051. );
  1052. #if DBG
  1053. #define SP_FUNC_SYNC 0
  1054. #define SP_FUNC_ASYNC 1
  1055. LONG
  1056. WINAPI
  1057. CallSP1(
  1058. TSPIPROC pfn,
  1059. LPCSTR lpszFuncName,
  1060. DWORD dwFlags,
  1061. ULONG_PTR Arg1
  1062. );
  1063. LONG
  1064. WINAPI
  1065. CallSP2(
  1066. TSPIPROC pfn,
  1067. LPCSTR lpszFuncName,
  1068. DWORD dwFlags,
  1069. ULONG_PTR Arg1,
  1070. ULONG_PTR Arg2
  1071. );
  1072. LONG
  1073. WINAPI
  1074. CallSP3(
  1075. TSPIPROC pfn,
  1076. LPCSTR lpszFuncName,
  1077. DWORD dwFlags,
  1078. ULONG_PTR Arg1,
  1079. ULONG_PTR Arg2,
  1080. ULONG_PTR Arg3
  1081. );
  1082. LONG
  1083. WINAPI
  1084. CallSP4(
  1085. TSPIPROC pfn,
  1086. LPCSTR lpszFuncName,
  1087. DWORD dwFlags,
  1088. ULONG_PTR Arg1,
  1089. ULONG_PTR Arg2,
  1090. ULONG_PTR Arg3,
  1091. ULONG_PTR Arg4
  1092. );
  1093. LONG
  1094. WINAPI
  1095. CallSP5(
  1096. TSPIPROC pfn,
  1097. LPCSTR lpszFuncName,
  1098. DWORD dwFlags,
  1099. ULONG_PTR Arg1,
  1100. ULONG_PTR Arg2,
  1101. ULONG_PTR Arg3,
  1102. ULONG_PTR Arg4,
  1103. ULONG_PTR Arg5
  1104. );
  1105. LONG
  1106. WINAPI
  1107. CallSP6(
  1108. TSPIPROC pfn,
  1109. LPCSTR lpszFuncName,
  1110. DWORD dwFlags,
  1111. ULONG_PTR Arg1,
  1112. ULONG_PTR Arg2,
  1113. ULONG_PTR Arg3,
  1114. ULONG_PTR Arg4,
  1115. ULONG_PTR Arg5,
  1116. ULONG_PTR Arg6
  1117. );
  1118. LONG
  1119. WINAPI
  1120. CallSP7(
  1121. TSPIPROC pfn,
  1122. LPCSTR lpszFuncName,
  1123. DWORD dwFlags,
  1124. ULONG_PTR Arg1,
  1125. ULONG_PTR Arg2,
  1126. ULONG_PTR Arg3,
  1127. ULONG_PTR Arg4,
  1128. ULONG_PTR Arg5,
  1129. ULONG_PTR Arg6,
  1130. ULONG_PTR Arg7
  1131. );
  1132. LONG
  1133. WINAPI
  1134. CallSP8(
  1135. TSPIPROC pfn,
  1136. LPCSTR lpszFuncName,
  1137. DWORD dwFlags,
  1138. ULONG_PTR Arg1,
  1139. ULONG_PTR Arg2,
  1140. ULONG_PTR Arg3,
  1141. ULONG_PTR Arg4,
  1142. ULONG_PTR Arg5,
  1143. ULONG_PTR Arg6,
  1144. ULONG_PTR Arg7,
  1145. ULONG_PTR Arg8
  1146. );
  1147. LONG
  1148. WINAPI
  1149. CallSP9(
  1150. TSPIPROC pfn,
  1151. LPCSTR lpszFuncName,
  1152. DWORD dwFlags,
  1153. ULONG_PTR Arg1,
  1154. ULONG_PTR Arg2,
  1155. ULONG_PTR Arg3,
  1156. ULONG_PTR Arg4,
  1157. ULONG_PTR Arg5,
  1158. ULONG_PTR Arg6,
  1159. ULONG_PTR Arg7,
  1160. ULONG_PTR Arg8,
  1161. ULONG_PTR Arg9
  1162. );
  1163. LONG
  1164. WINAPI
  1165. CallSP12(
  1166. TSPIPROC pfn,
  1167. LPCSTR lpszFuncName,
  1168. DWORD dwFlags,
  1169. ULONG_PTR Arg1,
  1170. ULONG_PTR Arg2,
  1171. ULONG_PTR Arg3,
  1172. ULONG_PTR Arg4,
  1173. ULONG_PTR Arg5,
  1174. ULONG_PTR Arg6,
  1175. ULONG_PTR Arg7,
  1176. ULONG_PTR Arg8,
  1177. ULONG_PTR Arg9,
  1178. ULONG_PTR Arg10,
  1179. ULONG_PTR Arg11,
  1180. ULONG_PTR Arg12
  1181. );
  1182. #else
  1183. #define CallSP1(pfn,nm,fl,a1) ((*pfn)(a1))
  1184. #define CallSP2(pfn,nm,fl,a1,a2) ((*pfn)(a1,a2))
  1185. #define CallSP3(pfn,nm,fl,a1,a2,a3) ((*pfn)(a1,a2,a3))
  1186. #define CallSP4(pfn,nm,fl,a1,a2,a3,a4) ((*pfn)(a1,a2,a3,a4))
  1187. #define CallSP5(pfn,nm,fl,a1,a2,a3,a4,a5) ((*pfn)(a1,a2,a3,a4,a5))
  1188. #define CallSP6(pfn,nm,fl,a1,a2,a3,a4,a5,a6) ((*pfn)(a1,a2,a3,a4,a5,a6))
  1189. #define CallSP7(pfn,nm,fl,a1,a2,a3,a4,a5,a6,a7) ((*pfn)(a1,a2,a3,a4,a5,a6,a7))
  1190. #define CallSP8(pfn,nm,fl,a1,a2,a3,a4,a5,a6,a7,a8) \
  1191. ((*pfn)(a1,a2,a3,a4,a5,a6,a7,a8))
  1192. #define CallSP9(pfn,nm,fl,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
  1193. ((*pfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9))
  1194. #define CallSP12(pfn,nm,fl,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) \
  1195. ((*pfn)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12))
  1196. #endif
  1197. #if DBG
  1198. BOOL
  1199. IsBadSizeOffset(
  1200. DWORD dwTotalSize,
  1201. DWORD dwFixedSize,
  1202. DWORD dwXxxSize,
  1203. DWORD dwXxxOffset,
  1204. DWORD dwAlignMask,
  1205. char *pszCallingFunc,
  1206. char *pszFieldName
  1207. );
  1208. #define ISBADSIZEOFFSET(a1,a2,a3,a4,a5,a6,a7) IsBadSizeOffset(a1,a2,a3,a4,a5,a6,a7)
  1209. #else
  1210. BOOL
  1211. IsBadSizeOffset(
  1212. DWORD dwTotalSize,
  1213. DWORD dwFixedSize,
  1214. DWORD dwXxxSize,
  1215. DWORD dwXxxOffset,
  1216. DWORD dwAlignMask
  1217. );
  1218. #define ISBADSIZEOFFSET(a1,a2,a3,a4,a5,a6,a7) IsBadSizeOffset(a1,a2,a3,a4,a5)
  1219. #endif
  1220. BOOL
  1221. IsBadStringParam(
  1222. DWORD dwParamsBufferSize,
  1223. LPBYTE pDataBuf,
  1224. DWORD dwStringOffset
  1225. );
  1226. #define MAP_HANDLE_TO_SP_EVENT_QUEUE_ID(h) (h % gdwNumSPEventHandlerThreads)
  1227. #if DBG
  1228. #define DWORD_CAST(v,f,l) (((v)>MAXDWORD)?(DbgPrt(0,"DWORD_CAST: information will be lost during cast from %p in file %s, line %d",(v),(f),(l)), DebugBreak(),((DWORD)(v))):((DWORD)(v)))
  1229. #else
  1230. #define DWORD_CAST(v,f,l) (DWORD)(v)
  1231. #endif //DBG
  1232. #ifdef __cplusplus
  1233. }
  1234. #endif