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.

416 lines
13 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1995-1998 Microsoft Corporation
  3. Module Name:
  4. espexe.h
  5. Abstract:
  6. Author:
  7. Dan Knudson (DanKn) 15-Sep-1995
  8. Revision History:
  9. --*/
  10. #include "windows.h"
  11. #include "tapi.h"
  12. #include "tspi.h"
  13. #include "..\tsp\intrface.h"
  14. #include "resource.h"
  15. #include "espidl.h"
  16. #define MAX_STRING_PARAM_SIZE 32
  17. #define PT_DWORD 1
  18. #define PT_FLAGS 2
  19. #define PT_STRING 3
  20. #define PT_ORDINAL 4
  21. typedef struct _MYWIDGET
  22. {
  23. DWORD dwWidgetID;
  24. DWORD dwWidgetType;
  25. ULONG_PTR hdXxx;
  26. ULONG_PTR htXxx;
  27. DWORD dwCallState;
  28. DWORD dwCallAddressID;
  29. struct _MYWIDGET *pPrev;
  30. struct _MYWIDGET *pNext;
  31. } MYWIDGET, *PMYWIDGET;
  32. typedef struct _LOOKUP
  33. {
  34. DWORD dwVal;
  35. char far *pszVal;
  36. } LOOKUP, *PLOOKUP;
  37. typedef struct _PBXSETTING
  38. {
  39. DWORD dwNumber;
  40. LPCSTR pszEvent;
  41. DWORD dwTime;
  42. } PBXSETTING, *PPBXSETTING;
  43. typedef struct _EVENT_PARAM
  44. {
  45. char far *szName;
  46. DWORD dwType;
  47. ULONG_PTR dwValue;
  48. union
  49. {
  50. PLOOKUP pLookup;
  51. char far *buf;
  52. LPVOID ptr;
  53. ULONG_PTR dwDefValue;
  54. };
  55. } EVENT_PARAM, far *PEVENT_PARAM;
  56. typedef struct _EVENT_PARAM_HEADER
  57. {
  58. DWORD dwNumParams;
  59. LPSTR pszDlgTitle;
  60. DWORD dwEventType;
  61. PEVENT_PARAM aParams;
  62. } EVENT_PARAM_HEADER, far *PEVENT_PARAM_HEADER;
  63. LOOKUP aPBXNumbers[] =
  64. {
  65. { 0, "0" },
  66. { 1, "1" },
  67. { 2, "2" },
  68. { 5, "5" },
  69. { 10, "10" },
  70. { 20, "20" },
  71. { 50, "50" },
  72. { 100, "100" },
  73. { 200, "200" },
  74. { 500, "500" },
  75. { 1000, "1000" },
  76. { 0, NULL }
  77. };
  78. LOOKUP aPBXTimes[] =
  79. {
  80. { 1000, "second" },
  81. { 60000, "minute" },
  82. { 3600000, "hour" },
  83. { 86400000, "day" },
  84. { 604800000, "week" },
  85. { 0, NULL }
  86. };
  87. #define NUM_PBXSETTINGS 2
  88. PBXSETTING gPBXSettings[NUM_PBXSETTINGS] =
  89. {
  90. { 0, "incoming calls", 0 },
  91. { 0, "disconnections", 0 }
  92. };
  93. LOOKUP aCallStates[] =
  94. {
  95. { LINECALLSTATE_IDLE ,"IDLE" },
  96. { LINECALLSTATE_OFFERING ,"OFFERING" },
  97. { LINECALLSTATE_ACCEPTED ,"ACCEPTED" },
  98. { LINECALLSTATE_DIALTONE ,"DIALTONE" },
  99. { LINECALLSTATE_DIALING ,"DIALING" },
  100. { LINECALLSTATE_RINGBACK ,"RINGBACK" },
  101. { LINECALLSTATE_BUSY ,"BUSY" },
  102. { LINECALLSTATE_SPECIALINFO ,"SPECIALINFO" },
  103. { LINECALLSTATE_CONNECTED ,"CONNECTED" },
  104. { LINECALLSTATE_PROCEEDING ,"PROCEEDING" },
  105. { LINECALLSTATE_ONHOLD ,"ONHOLD" },
  106. { LINECALLSTATE_CONFERENCED ,"CONFERENCED" },
  107. { LINECALLSTATE_ONHOLDPENDCONF ,"ONHOLDPENDCONF" },
  108. { LINECALLSTATE_ONHOLDPENDTRANSFER ,"ONHOLDPENDTRANSFER" },
  109. { LINECALLSTATE_DISCONNECTED ,"DISCONNECTED" },
  110. { LINECALLSTATE_UNKNOWN ,"UNKNOWN" },
  111. { 0xffffffff ,"" }
  112. };
  113. LOOKUP aLineErrs[] =
  114. {
  115. { 0 ,"<SUCCESS>" },
  116. { LINEERR_ALLOCATED ,"ALLOCATED" },
  117. { LINEERR_BADDEVICEID ,"BADDEVICEID" },
  118. { LINEERR_BEARERMODEUNAVAIL ,"BEARERMODEUNAVAIL" },
  119. { LINEERR_CALLUNAVAIL ,"CALLUNAVAIL" },
  120. { LINEERR_COMPLETIONOVERRUN ,"COMPLETIONOVERRUN" },
  121. { LINEERR_CONFERENCEFULL ,"CONFERENCEFULL" },
  122. { LINEERR_DIALBILLING ,"DIALBILLING" },
  123. { LINEERR_DIALDIALTONE ,"DIALDIALTONE" },
  124. { LINEERR_DIALPROMPT ,"DIALPROMPT" },
  125. { LINEERR_DIALQUIET ,"DIALQUIET" },
  126. { LINEERR_INCOMPATIBLEAPIVERSION ,"INCOMPATIBLEAPIVERSION" },
  127. { LINEERR_INCOMPATIBLEEXTVERSION ,"INCOMPATIBLEEXTVERSION" },
  128. { LINEERR_INIFILECORRUPT ,"INIFILECORRUPT" },
  129. { LINEERR_INUSE ,"INUSE" },
  130. { LINEERR_INVALADDRESS ,"INVALADDRESS" },
  131. { LINEERR_INVALADDRESSID ,"INVALADDRESSID" },
  132. { LINEERR_INVALADDRESSMODE ,"INVALADDRESSMODE" },
  133. { LINEERR_INVALADDRESSSTATE ,"INVALADDRESSSTATE" },
  134. { LINEERR_INVALAPPHANDLE ,"INVALAPPHANDLE" },
  135. { LINEERR_INVALAPPNAME ,"INVALAPPNAME" },
  136. { LINEERR_INVALBEARERMODE ,"INVALBEARERMODE" },
  137. { LINEERR_INVALCALLCOMPLMODE ,"INVALCALLCOMPLMODE" },
  138. { LINEERR_INVALCALLHANDLE ,"INVALCALLHANDLE" },
  139. { LINEERR_INVALCALLPARAMS ,"INVALCALLPARAMS" },
  140. { LINEERR_INVALCALLPRIVILEGE ,"INVALCALLPRIVILEGE" },
  141. { LINEERR_INVALCALLSELECT ,"INVALCALLSELECT" },
  142. { LINEERR_INVALCALLSTATE ,"INVALCALLSTATE" },
  143. { LINEERR_INVALCALLSTATELIST ,"INVALCALLSTATELIST" },
  144. { LINEERR_INVALCARD ,"INVALCARD" },
  145. { LINEERR_INVALCOMPLETIONID ,"INVALCOMPLETIONID" },
  146. { LINEERR_INVALCONFCALLHANDLE ,"INVALCONFCALLHANDLE" },
  147. { LINEERR_INVALCONSULTCALLHANDLE ,"INVALCONSULTCALLHANDLE" },
  148. { LINEERR_INVALCOUNTRYCODE ,"INVALCOUNTRYCODE" },
  149. { LINEERR_INVALDEVICECLASS ,"INVALDEVICECLASS" },
  150. { LINEERR_INVALDEVICEHANDLE ,"INVALDEVICEHANDLE" },
  151. { LINEERR_INVALDIALPARAMS ,"INVALDIALPARAMS" },
  152. { LINEERR_INVALDIGITLIST ,"INVALDIGITLIST" },
  153. { LINEERR_INVALDIGITMODE ,"INVALDIGITMODE" },
  154. { LINEERR_INVALDIGITS ,"INVALDIGITS" },
  155. { LINEERR_INVALEXTVERSION ,"INVALEXTVERSION" },
  156. { LINEERR_INVALGROUPID ,"INVALGROUPID" },
  157. { LINEERR_INVALLINEHANDLE ,"INVALLINEHANDLE" },
  158. { LINEERR_INVALLINESTATE ,"INVALLINESTATE" },
  159. { LINEERR_INVALLOCATION ,"INVALLOCATION" },
  160. { LINEERR_INVALMEDIALIST ,"INVALMEDIALIST" },
  161. { LINEERR_INVALMEDIAMODE ,"INVALMEDIAMODE" },
  162. { LINEERR_INVALMESSAGEID ,"INVALMESSAGEID" },
  163. { LINEERR_INVALPARAM ,"INVALPARAM" },
  164. { LINEERR_INVALPARKID ,"INVALPARKID" },
  165. { LINEERR_INVALPARKMODE ,"INVALPARKMODE" },
  166. { LINEERR_INVALPOINTER ,"INVALPOINTER" },
  167. { LINEERR_INVALPRIVSELECT ,"INVALPRIVSELECT" },
  168. { LINEERR_INVALRATE ,"INVALRATE" },
  169. { LINEERR_INVALREQUESTMODE ,"INVALREQUESTMODE" },
  170. { LINEERR_INVALTERMINALID ,"INVALTERMINALID" },
  171. { LINEERR_INVALTERMINALMODE ,"INVALTERMINALMODE" },
  172. { LINEERR_INVALTIMEOUT ,"INVALTIMEOUT" },
  173. { LINEERR_INVALTONE ,"INVALTONE" },
  174. { LINEERR_INVALTONELIST ,"INVALTONELIST" },
  175. { LINEERR_INVALTONEMODE ,"INVALTONEMODE" },
  176. { LINEERR_INVALTRANSFERMODE ,"INVALTRANSFERMODE" },
  177. { LINEERR_LINEMAPPERFAILED ,"LINEMAPPERFAILED" },
  178. { LINEERR_NOCONFERENCE ,"NOCONFERENCE" },
  179. { LINEERR_NODEVICE ,"NODEVICE" },
  180. { LINEERR_NODRIVER ,"NODRIVER" },
  181. { LINEERR_NOMEM ,"NOMEM" },
  182. { LINEERR_NOREQUEST ,"NOREQUEST" },
  183. { LINEERR_NOTOWNER ,"NOTOWNER" },
  184. { LINEERR_NOTREGISTERED ,"NOTREGISTERED" },
  185. { LINEERR_OPERATIONFAILED ,"OPERATIONFAILED" },
  186. { LINEERR_OPERATIONUNAVAIL ,"OPERATIONUNAVAIL" },
  187. { LINEERR_RATEUNAVAIL ,"RATEUNAVAIL" },
  188. { LINEERR_RESOURCEUNAVAIL ,"RESOURCEUNAVAIL" },
  189. { LINEERR_REQUESTOVERRUN ,"REQUESTOVERRUN" },
  190. { LINEERR_STRUCTURETOOSMALL ,"STRUCTURETOOSMALL" },
  191. { LINEERR_TARGETNOTFOUND ,"TARGETNOTFOUND" },
  192. { LINEERR_TARGETSELF ,"TARGETSELF" },
  193. { LINEERR_UNINITIALIZED ,"UNINITIALIZED" },
  194. { LINEERR_USERUSERINFOTOOBIG ,"USERUSERINFOTOOBIG" },
  195. { LINEERR_REINIT ,"REINIT" },
  196. { LINEERR_ADDRESSBLOCKED ,"ADDRESSBLOCKED" },
  197. { LINEERR_BILLINGREJECTED ,"BILLINGREJECTED" },
  198. { LINEERR_INVALFEATURE ,"INVALFEATURE" },
  199. { LINEERR_NOMULTIPLEINSTANCE ,"NOMULTIPLEINSTANCE" },
  200. { 0xffffffff ,"" }
  201. };
  202. LOOKUP aLineMsgs[] =
  203. {
  204. { LINE_ADDRESSSTATE ,"ADDRESSSTATE" },
  205. { LINE_CALLDEVSPECIFIC ,"CALLDEVSPECIFIC" },
  206. { LINE_CALLDEVSPECIFICFEATURE ,"CALLDEVSPECIFICFEATURE" },
  207. { LINE_CREATEDIALOGINSTANCE ,"CREATEDIALOGINSTANCE" },
  208. { LINE_CLOSE ,"CLOSE" },
  209. { LINE_DEVSPECIFIC ,"DEVSPECIFIC" },
  210. { LINE_DEVSPECIFICFEATURE ,"DEVSPECIFICFEATURE" },
  211. { LINE_GATHERDIGITS ,"GATHERDIGITS" },
  212. { LINE_GENERATE ,"GENERATE" },
  213. { LINE_LINEDEVSTATE ,"LINEDEVSTATE" },
  214. { LINE_MONITORDIGITS ,"MONITORDIGITS" },
  215. { LINE_MONITORMEDIA ,"MONITORMEDIA" },
  216. { LINE_MONITORTONE ,"MONITORTONE" },
  217. { LINE_CREATE ,"CREATE" },
  218. { LINE_REMOVE ,"REMOVE" },
  219. { LINE_SENDDIALOGINSTANCEDATA ,"SENDDIALOGINSTANCEDATA" },
  220. { 0xffffffff ,"" }
  221. };
  222. LOOKUP aPhoneMsgs[] =
  223. {
  224. { PHONE_BUTTON ,"BUTTON" },
  225. { PHONE_CLOSE ,"CLOSE" },
  226. { PHONE_DEVSPECIFIC ,"DEVSPECIFIC" },
  227. { PHONE_STATE ,"STATE" },
  228. { PHONE_CREATE ,"CREATE" },
  229. { PHONE_REMOVE ,"REMOVE" },
  230. { 0xffffffff ,"" }
  231. };
  232. LOOKUP aVersions[] =
  233. {
  234. { 0x00010003 ,"1.0" },
  235. { 0x00010004 ,"1.4" },
  236. { 0x00020000 ,"2.0" },
  237. { 0x00020001 ,"2.1" },
  238. { 0x00020002 ,"2.2" },
  239. { 0x00030000 ,"3.0" },
  240. { 0x00030001 ,"3.1" },
  241. { 0xffffffff ,"" }
  242. };
  243. BOOL gbESPLoaded = FALSE;
  244. gbPBXThreadRunning,
  245. gbAutoClose,
  246. gbDisableUI;
  247. LONG cxList1,
  248. cxWnd;
  249. HWND ghwndMain,
  250. ghwndList1,
  251. ghwndList2,
  252. ghwndEdit;
  253. DWORD gdwTSPIVersion,
  254. gdwNumLines,
  255. gdwNumAddrsPerLine,
  256. gdwNumCallsPerAddr,
  257. gdwNumPhones,
  258. gdwDebugOptions,
  259. gdwCompletionMode,
  260. gbAutoGatherGenerateMsgs;
  261. HMENU ghMenu;
  262. HINSTANCE ghInstance;
  263. PMYWIDGET gpWidgets;
  264. char szMySection[] = "ESP32";
  265. INT_PTR
  266. CALLBACK
  267. MainWndProc(
  268. HWND hwnd,
  269. UINT msg,
  270. WPARAM wParam,
  271. LPARAM lParam
  272. );
  273. INT_PTR
  274. CALLBACK
  275. PBXConfigDlgProc(
  276. HWND hwnd,
  277. UINT msg,
  278. WPARAM wParam,
  279. LPARAM lParam
  280. );
  281. INT_PTR
  282. CALLBACK
  283. AboutDlgProc(
  284. HWND hwnd,
  285. UINT msg,
  286. WPARAM wParam,
  287. LPARAM lParam
  288. );
  289. INT_PTR
  290. CALLBACK
  291. HelpDlgProc(
  292. HWND hwnd,
  293. UINT msg,
  294. WPARAM wParam,
  295. LPARAM lParam
  296. );
  297. void
  298. ProcessWidgetEvent(
  299. PWIDGETEVENT pEvent
  300. );
  301. void
  302. UpdateESPOptions(
  303. void
  304. );
  305. void
  306. SaveIniFileSettings(
  307. void
  308. );
  309. void
  310. xxxShowStr(
  311. char *psz
  312. );
  313. void
  314. ShowStr(
  315. char *pszFormat,
  316. ...
  317. );
  318. LPVOID
  319. MyAlloc(
  320. size_t numBytes
  321. );
  322. void
  323. MyFree(
  324. LPVOID p
  325. );
  326. INT_PTR
  327. CALLBACK
  328. ValuesDlgProc(
  329. HWND hwnd,
  330. UINT msg,
  331. WPARAM wParam,
  332. LPARAM lParam
  333. );