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.

4509 lines
85 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1995-1997 Microsoft Corporation
  3. Module Name:
  4. thunk.c
  5. Abstract:
  6. This module contains
  7. Author:
  8. Dan Knudson (DanKn) dd-Mmm-1995
  9. Revision History:
  10. --*/
  11. #define NOGDI GDI APIs and definitions
  12. #define NOSOUND Sound APIs and definitions
  13. #define NODRIVERS Installable driver APIs and definitions
  14. #define NOIMT Installable messge thunk APIs and definitions
  15. #define NOMINMAX min() and max() macros
  16. #define NOLOGERROR LogError() and related definitions
  17. #define NOPROFILER Profiler APIs
  18. #define NOLFILEIO _l* file I/O routines
  19. #define NOOPENFILE OpenFile and related definitions
  20. #define NORESOURCE Resource management
  21. #define NOATOM Atom management
  22. #define NOLANGUAGE Character test routines
  23. #define NOLSTRING lstr* string management routines
  24. #define NODBCS Double-byte character set routines
  25. #define NOKEYBOARDINFO Keyboard driver routines
  26. #define NOGDICAPMASKS GDI device capability constants
  27. #define NOCOLOR COLOR_* color values
  28. #define NOGDIOBJ GDI pens, brushes, fonts
  29. #define NODRAWTEXT DrawText() and related definitions
  30. #define NOTEXTMETRIC TEXTMETRIC and related APIs
  31. #define NOSCALABLEFONT Truetype scalable font support
  32. #define NOBITMAP Bitmap support
  33. #define NORASTEROPS GDI Raster operation definitions
  34. #define NOMETAFILE Metafile support
  35. #define NOSYSTEMPARAMSINFO SystemParametersInfo() and SPI_* definitions
  36. #define NOSHOWWINDOW ShowWindow and related definitions
  37. #define NODEFERWINDOWPOS DeferWindowPos and related definitions
  38. #define NOVIRTUALKEYCODES VK_* virtual key codes
  39. #define NOKEYSTATES MK_* message key state flags
  40. #define NOWH SetWindowsHook and related WH_* definitions
  41. #define NOMENUS Menu APIs
  42. #define NOSCROLL Scrolling APIs and scroll bar control
  43. #define NOCLIPBOARD Clipboard APIs and definitions
  44. #define NOICONS IDI_* icon IDs
  45. #define NOMB MessageBox and related definitions
  46. #define NOSYSCOMMANDS WM_SYSCOMMAND SC_* definitions
  47. #define NOMDI MDI support
  48. //#define NOCTLMGR Control management and controls
  49. #define NOWINMESSAGES WM_* window messages
  50. #include "windows.h"
  51. #include <stdlib.h>
  52. //#include <malloc.h>
  53. #include <string.h>
  54. #define TAPI_CURRENT_VERSION 0x00010004
  55. #ifndef ULONG_PTR
  56. #define ULONG_PTR DWORD
  57. #endif
  58. #ifndef DWORD_PTR
  59. #define DWORD_PTR DWORD
  60. #endif
  61. //#include "..\inc\tapi.h"
  62. #include <tapi.h>
  63. #include "thunk.h"
  64. DWORD FAR CDECL CallProcEx32W( DWORD, DWORD, DWORD, ... );
  65. const char gszWndClass[] = "TapiClient16Class";
  66. const char gszTapi32[] = "TAPI32.DLL";
  67. BOOL gfShutdownDone = FALSE;
  68. BOOL gfOpenDone = FALSE;
  69. HLINE ghLine = NULL;
  70. HICON ghIcon = NULL;
  71. #if DBG
  72. DWORD gdwDebugLevel;
  73. #define DBGOUT OutputDebugString
  74. #else
  75. #define DBGOUT //
  76. #endif
  77. #ifdef MEMPHIS
  78. void LoadTAPI32IfNecessary()
  79. {
  80. DWORD dw;
  81. DWORD pfn = 0;
  82. DWORD hLib = 0;
  83. hLib = LoadLibraryEx32W ("kernel32.dll", NULL, 0);
  84. pfn = (DWORD)GetProcAddress32W (hLib, "GetModuleHandleA");
  85. if ( pfn )
  86. {
  87. // CallProc32W(
  88. // arg1, // TAPI proc args
  89. // ...,
  90. // argN,
  91. //
  92. // pfnTapi32, // Pointer to the function in tapi32.dll
  93. //
  94. // 0x???, // Bit mask indicating which args are pointers
  95. // // that need to be mapped from a 16:16 address
  96. // // to a 0:32 address. The least significant
  97. // // bit corresponds to argN, and the Nth bit
  98. // // corresponds to arg1.
  99. // //
  100. // // For example, if arg1 & arg2 are pointers, and
  101. // // arg3 is a DWORD, the the mask would be 0x6
  102. // // (110 in binary, indicating arg1 & arg2 need to
  103. // // be mapped)
  104. //
  105. // N // Number of TAPI proc args
  106. // );
  107. GlobalWire (GlobalHandle (HIWORD(gszTapi32)));
  108. dw = CallProc32W ((DWORD)gszTapi32, pfn, 1, 1);
  109. GlobalUnWire (GlobalHandle (HIWORD(gszTapi32)));
  110. //
  111. // Is TAPI32.DLL already loaded in this process space?
  112. // (on Memphis, each 16 bit app is a separate process, but all 16bit
  113. // apps get loaded into shared memory...)
  114. //
  115. if ( 0 == dw )
  116. {
  117. // No, TAPI32.DLL is no in this process context. Load it.
  118. //
  119. //NOTE: Probable 16bit bug:
  120. // Since we've already loaded the address table, mightn't this
  121. // cause a problem if this instance of TAPI32 in this process has to
  122. // get relocated on load (because of conflict)?
  123. //
  124. ghLib = LoadLibraryEx32W (gszTapi32, NULL, 0);
  125. }
  126. }
  127. FreeLibrary32W( hLib );
  128. }
  129. #endif
  130. //*******************************************************************************
  131. //*******************************************************************************
  132. //*******************************************************************************
  133. void DoFullLoad( void )
  134. {
  135. int i;
  136. //
  137. // Only do it once
  138. //
  139. // if ( 0 == ghLib )
  140. {
  141. //
  142. // Load tapi32.dll & Get all the proc pointers
  143. //
  144. ghLib = LoadLibraryEx32W (gszTapi32, NULL, 0);
  145. for (i = 0; i < NUM_TAPI32_PROCS; i++)
  146. {
  147. gaProcs[i] = (MYPROC) GetProcAddress32W(
  148. ghLib,
  149. (LPCSTR)gaFuncNames[i]
  150. );
  151. }
  152. #ifndef MEMPHIS
  153. // set the error mode.
  154. // this has no effect on x86 platforms
  155. // on RISC platforms, NT will fix
  156. // alignment faults (at a cost of time)
  157. {
  158. #define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
  159. DWORD dwModule;
  160. DWORD dwFunc;
  161. if ((dwModule = LoadLibraryEx32W ("kernel32.dll", NULL,0)) == NULL)
  162. {
  163. DBGOUT("LoadLibraryEx32W on kernel32.dll failed\n");
  164. }
  165. else
  166. {
  167. if ((dwFunc = GetProcAddress32W(dwModule,
  168. "SetErrorMode")) == NULL)
  169. {
  170. DBGOUT("GetProcAddress32W on SetErrorMode failed\n");
  171. }
  172. else
  173. {
  174. DBGOUT("Calling CallProcEx32W\n");
  175. CallProcEx32W(
  176. 1,
  177. 0,
  178. dwFunc,
  179. (DWORD) SEM_NOALIGNMENTFAULTEXCEPT
  180. );
  181. }
  182. FreeLibrary32W(dwModule);
  183. }
  184. }
  185. #endif
  186. }
  187. }
  188. //*******************************************************************************
  189. //*******************************************************************************
  190. //*******************************************************************************
  191. int
  192. FAR
  193. PASCAL
  194. LibMain(
  195. HINSTANCE hInst,
  196. WORD wDataSeg,
  197. WORD cbHeapSize,
  198. LPSTR lpszCmdLine
  199. )
  200. {
  201. WNDCLASS wc;
  202. DBGOUT ("TAPI.DLL: Libmain entered\n");
  203. //
  204. //
  205. //
  206. #if DBG
  207. gdwDebugLevel = (DWORD) GetPrivateProfileInt(
  208. "Debug",
  209. "TapiDebugLevel",
  210. 0x0,
  211. "Telephon.ini"
  212. );
  213. #endif
  214. //
  215. // Save the hInst in a global
  216. //
  217. ghInst = hInst;
  218. //
  219. // Register a window class for windows used for signaling async
  220. // completions & unsolicited events
  221. //
  222. wc.style = 0;
  223. wc.lpfnWndProc = (WNDPROC) Tapi16HiddenWndProc;
  224. wc.cbClsExtra = 0;
  225. wc.cbWndExtra = 2 * sizeof(DWORD);
  226. wc.hInstance = hInst;
  227. wc.hIcon = NULL;
  228. wc.hCursor = NULL;
  229. wc.hbrBackground = NULL;
  230. wc.lpszMenuName = NULL;
  231. wc.lpszClassName = gszWndClass;
  232. if (!RegisterClass (&wc))
  233. {
  234. DBGOUT ("RegisterClass() failed\n");
  235. }
  236. #ifndef MEMPHIS
  237. DoFullLoad();
  238. #endif
  239. return TRUE;
  240. }
  241. int
  242. FAR
  243. PASCAL
  244. WEP(
  245. int nParam
  246. )
  247. {
  248. if ( ghLib )
  249. FreeLibrary32W (ghLib);
  250. return TRUE;
  251. }
  252. LRESULT
  253. CALLBACK
  254. Tapi16HiddenWndProc(
  255. HWND hwnd,
  256. UINT msg,
  257. WPARAM wParam,
  258. LPARAM lParam
  259. )
  260. {
  261. switch (msg)
  262. {
  263. #ifdef B16APPS_CANT_SPIN_THREADS
  264. case WM_USER:
  265. {
  266. #ifdef MEMPHIS
  267. //
  268. // Check the magic cookies for KC and me
  269. //
  270. if ( (0x4b44 == wParam) )
  271. {
  272. DBGOUT ("TAPI.DLL: Open is done\r\n");
  273. gfOpenDone = TRUE;
  274. ghLine = (HLINE)lParam;
  275. break;
  276. }
  277. if ( (0x4b45 == wParam) )
  278. {
  279. DBGOUT ("TAPI.DLL: shut is done\r\n");
  280. gfShutdownDone = TRUE;
  281. break;
  282. }
  283. #endif
  284. //
  285. // Check the magic cookies for KC and me
  286. //
  287. if ( (0x4b43 == wParam) && (lParam == 0x00424a4d) )
  288. {
  289. DWORD pfn;
  290. DBGOUT ("TAPI.DLL: Got Event!!\r\n");
  291. pfn = (DWORD)GetProcAddress32W(
  292. ghLib,
  293. "NonAsyncEventThread"
  294. );
  295. if ( pfn )
  296. {
  297. CallProcEx32W( 0,
  298. 0,
  299. pfn
  300. );
  301. }
  302. }
  303. }
  304. break;
  305. #endif
  306. case WM_ASYNCEVENT:
  307. {
  308. //
  309. // This msg gets posted to us by tapi32.dll to alert us that
  310. // there's a new callback msg available for the app instance
  311. // associated with this window. "lParam" is an app instance
  312. // context tapi32.dll-space.
  313. //
  314. LPTAPI_APP_DATA pAppData = (LPTAPI_APP_DATA)
  315. GetWindowLong (hwnd, GWL_APPDATA);
  316. TAPI16_CALLBACKMSG msg;
  317. pAppData->bPendingAsyncEventMsg = FALSE;
  318. while ((*pfnCallProc2)(
  319. (DWORD) lParam,
  320. (DWORD) ((LPVOID)&msg),
  321. (LPVOID)gaProcs[GetTapi16CallbkMsg],
  322. 0x1,
  323. 2
  324. ))
  325. {
  326. if (pAppData->bPendingAsyncEventMsg == FALSE)
  327. {
  328. pAppData->bPendingAsyncEventMsg = TRUE;
  329. PostMessage (hwnd, WM_ASYNCEVENT, wParam, lParam);
  330. // NOTE: Tapi16HiddenWndProc: need to verify pAppData in case app calls
  331. // shutdown from callback?
  332. }
  333. (*(pAppData->lpfnCallback))(
  334. msg.hDevice,
  335. msg.dwMsg,
  336. msg.dwCallbackInstance,
  337. msg.dwParam1,
  338. msg.dwParam2,
  339. msg.dwParam3
  340. );
  341. }
  342. break;
  343. }
  344. default:
  345. {
  346. return (DefWindowProc (hwnd, msg, wParam, lParam));
  347. }
  348. } // switch
  349. return 0;
  350. }
  351. //
  352. // The following are the routines to thunk TAPI calls from 16-bit apps to
  353. // the 32-bit tapi32.dll. In general, this is done as follows:
  354. //
  355. // CallProc32W(
  356. // arg1, // TAPI proc args
  357. // ...,
  358. // argN,
  359. //
  360. // pfnTapi32, // Pointer to the function in tapi32.dll
  361. //
  362. // 0x???, // Bit mask indicating which args are pointers
  363. // // that need to be mapped from a 16:16 address
  364. // // to a 0:32 address. The least significant
  365. // // bit corresponds to argN, and the Nth bit
  366. // // corresponds to arg1.
  367. // //
  368. // // For example, if arg1 & arg2 are pointers, and
  369. // // arg3 is a DWORD, the the mask would be 0x6
  370. // // (110 in binary, indicating arg1 & arg2 need to
  371. // // be mapped)
  372. //
  373. // N // Number of TAPI proc args
  374. // );
  375. //
  376. //
  377. // Since callbacks to 16-bit procs cannot be done directly by a 32-bit
  378. // module, we create a hidden window for each successful call to
  379. // lineInitialize and phoneInitialize, and tapi32.dll posts msgs to this
  380. // window when LINE_XXX & PHONE_XXX msgs become available for the client
  381. // process. The window then retrieves all the msgs parameters and calls
  382. // the 16-bit proc's callback function.
  383. //
  384. // Note that we swap the hLineApp & hPhoneApp returned by tapi32.dll with
  385. // the hidden window handle on the client proc side, and substitute the
  386. // window handle for the pointer to the callback function on the tapi32.dll
  387. // side. The former is done to make it easier to reference which window
  388. // belongs to which hLine/PhoneApp, and the latter is done to provide
  389. // tapi32.dll with a means of alerting us of callback msgs. (Tapi32.dll
  390. // distinguishes whether the lpfnCallback it is passed in
  391. // line/phoneInitialize is a pointer to a function of a window handle by
  392. // checking the high WORD- if it is 0xffff then it assumes lpfnCallback
  393. // is really a 16-bit proc's window handle.
  394. //
  395. #if DBG
  396. void
  397. LineResult(
  398. char *pszFuncName,
  399. LONG lResult
  400. )
  401. {
  402. #if DBG
  403. if (gdwDebugLevel > 3)
  404. {
  405. char buf[100];
  406. wsprintf (buf, "TAPI: line%s result=x%lx\n", pszFuncName, lResult);
  407. DBGOUT (buf);
  408. }
  409. #endif
  410. }
  411. void
  412. PhoneResult(
  413. char *pszFuncName,
  414. LONG lResult
  415. )
  416. {
  417. #if DBG
  418. if (gdwDebugLevel > 3)
  419. {
  420. char buf[100];
  421. wsprintf (buf, "TAPI: phone%s result=x%lx\n", pszFuncName, lResult);
  422. DBGOUT (buf);
  423. }
  424. #endif
  425. }
  426. void
  427. TapiResult(
  428. char *pszFuncName,
  429. LONG lResult
  430. )
  431. {
  432. #if DBG
  433. if (gdwDebugLevel > 3)
  434. {
  435. char buf[100];
  436. wsprintf (buf, "TAPI: tapi%s result=x%lx\n", pszFuncName, lResult);
  437. DBGOUT (buf);
  438. }
  439. #endif
  440. }
  441. #else
  442. #define LineResult(arg1,arg2)
  443. #define PhoneResult(arg1,arg2)
  444. #define TapiResult(arg1,arg2)
  445. #endif
  446. VOID
  447. MyCreateIcon(
  448. )
  449. {
  450. BYTE FAR *pBlank;
  451. int xSize, ySize ;
  452. xSize = GetSystemMetrics( SM_CXICON );
  453. ySize = GetSystemMetrics( SM_CYICON );
  454. pBlank = (BYTE FAR *) GlobalAllocPtr (GPTR, ((xSize * ySize) + 7 )/ 8);
  455. ghIcon = CreateIcon (ghInst, xSize, ySize, 1, 1, pBlank, pBlank);
  456. GlobalFreePtr (pBlank);
  457. }
  458. LONG
  459. WINAPI
  460. xxxInitialize(
  461. BOOL bLine,
  462. LPHLINEAPP lphXxxApp,
  463. HINSTANCE hInstance,
  464. LINECALLBACK lpfnCallback,
  465. LPCSTR lpszAppName,
  466. LPDWORD lpdwNumDevs
  467. )
  468. {
  469. HWND hwnd = NULL;
  470. LONG lResult;
  471. DWORD dwAppNameLen;
  472. char far *lpszModuleNamePath = NULL;
  473. char far *lpszModuleName;
  474. char far *lpszFriendlyAndModuleName = NULL;
  475. LPTAPI_APP_DATA pAppData = (LPTAPI_APP_DATA) NULL;
  476. #if DBG
  477. if (bLine)
  478. {
  479. DBGOUT ("lineInitialize: enter\n");
  480. }
  481. else
  482. {
  483. DBGOUT ("phoneInitialize: enter\n");
  484. }
  485. #endif
  486. //
  487. // Verify the ptrs
  488. //
  489. if (IsBadWritePtr ((LPVOID)lphXxxApp, sizeof(HLINEAPP)) ||
  490. IsBadCodePtr ((FARPROC) lpfnCallback) ||
  491. (lpszAppName && IsBadStringPtr (lpszAppName, (UINT) -1)))
  492. {
  493. lResult = (bLine ? LINEERR_INVALPOINTER : PHONEERR_INVALPOINTER);
  494. goto xxxInitialize_showResult;
  495. }
  496. //
  497. // Verify hInstance
  498. //
  499. if ((HINSTANCE)-1 == hInstance)
  500. {
  501. lResult = (bLine ? LINEERR_OPERATIONFAILED : PHONEERR_OPERATIONFAILED);
  502. goto xxxInitialize_showResult;
  503. }
  504. dwAppNameLen = (lpszAppName ? strlen (lpszAppName) + 1 : 0);
  505. #ifdef MEMPHIS
  506. DoFullLoad();
  507. #endif
  508. //
  509. // Create a string that looks like: "<friendly name>\0<module name>\0"
  510. // (because i don't know if i can work with a 16-bit hInstance in tapi32)
  511. //
  512. if ((lpszModuleNamePath = (char far *) malloc (260)))
  513. {
  514. if (GetModuleFileName (hInstance, lpszModuleNamePath, 260))
  515. {
  516. lpszModuleName = 1 + _fstrrchr (lpszModuleNamePath, '\\');
  517. if ((lpszFriendlyAndModuleName = (char far *) malloc((unsigned)
  518. (260 + (dwAppNameLen ? dwAppNameLen : 32))
  519. )))
  520. {
  521. int length;
  522. strcpy(
  523. lpszFriendlyAndModuleName,
  524. (lpszAppName ? lpszAppName : lpszModuleName)
  525. );
  526. length = strlen (lpszFriendlyAndModuleName);
  527. strcpy(
  528. lpszFriendlyAndModuleName + length + 1,
  529. lpszModuleName
  530. );
  531. }
  532. else
  533. {
  534. lResult = (bLine ? LINEERR_NOMEM : PHONEERR_NOMEM);
  535. goto xxxInitialize_done;
  536. }
  537. }
  538. else
  539. {
  540. DBGOUT ("GetModuleFileName() failed\n");
  541. lResult =
  542. (bLine ? LINEERR_OPERATIONFAILED : PHONEERR_OPERATIONFAILED);
  543. goto xxxInitialize_done;
  544. }
  545. }
  546. else
  547. {
  548. lResult = (bLine ? LINEERR_NOMEM : PHONEERR_NOMEM);
  549. goto xxxInitialize_done;
  550. }
  551. //
  552. // Create a window that we can use for signaling async completions
  553. // & unsolicited events
  554. //
  555. if (!(hwnd = CreateWindow(
  556. gszWndClass,
  557. "",
  558. WS_POPUP,
  559. CW_USEDEFAULT,
  560. CW_USEDEFAULT,
  561. CW_USEDEFAULT,
  562. CW_USEDEFAULT,
  563. NULL,
  564. NULL,
  565. ghInst,
  566. NULL
  567. )))
  568. {
  569. lResult = (bLine ? LINEERR_OPERATIONFAILED : PHONEERR_OPERATIONFAILED);
  570. DBGOUT ("CreateWindow failed\n");
  571. goto xxxInitialize_done;
  572. }
  573. //
  574. //
  575. //
  576. if (!(pAppData = (LPTAPI_APP_DATA) malloc (sizeof (TAPI_APP_DATA))))
  577. {
  578. lResult = (bLine ? LINEERR_NOMEM : PHONEERR_NOMEM);
  579. DBGOUT ("malloc failed\n");
  580. goto xxxInitialize_done;
  581. }
  582. pAppData->dwKey = TAPI_APP_DATA_KEY;
  583. pAppData->hwnd = hwnd;
  584. pAppData->bPendingAsyncEventMsg = FALSE;
  585. pAppData->lpfnCallback = lpfnCallback;
  586. SetWindowLong (hwnd, GWL_APPDATA, (LONG) pAppData);
  587. //
  588. // Call tapi32.dll
  589. //
  590. // GlobalWire( GlobalHandle(HIWORD(lpdwNumDevs)));
  591. // GlobalWire( GlobalHandle(HIWORD(lpszFriendlyAndModuleName)));
  592. lResult = (LONG) (*pfnCallProc5)(
  593. (DWORD) ((LPVOID)&pAppData->hXxxApp),
  594. (DWORD) hInstance,
  595. (DWORD) (0xffff0000 | hwnd), // lpfnCallback
  596. (DWORD) lpszFriendlyAndModuleName,
  597. (DWORD) lpdwNumDevs,
  598. (LPVOID)gaProcs[(bLine ? lInitialize : pInitialize)],
  599. 0x13,
  600. 5
  601. );
  602. // GlobalUnWire( GlobalHandle(HIWORD(lpdwNumDevs)));
  603. // GlobalUnWire( GlobalHandle(HIWORD(lpszFriendlyAndModuleName)));
  604. xxxInitialize_done:
  605. if (lpszModuleNamePath)
  606. {
  607. free (lpszModuleNamePath);
  608. if (lpszFriendlyAndModuleName)
  609. {
  610. free (lpszFriendlyAndModuleName);
  611. }
  612. }
  613. if (lResult == 0)
  614. {
  615. //
  616. // Set the app's hLineApp to be the hwnd rather than the real
  617. // hLineApp, making it easier to locate the window
  618. //
  619. *lphXxxApp = (HLINEAPP) pAppData;
  620. }
  621. else if (hwnd)
  622. {
  623. DestroyWindow (hwnd);
  624. if (pAppData)
  625. {
  626. free (pAppData);
  627. }
  628. }
  629. xxxInitialize_showResult:
  630. #if DBG
  631. if (bLine)
  632. {
  633. LineResult ("Initialize", lResult);
  634. }
  635. else
  636. {
  637. PhoneResult ("Initialize", lResult);
  638. }
  639. #endif
  640. return lResult;
  641. }
  642. LPTAPI_APP_DATA
  643. FAR
  644. PASCAL
  645. IsValidXxxApp(
  646. HLINEAPP hXxxApp
  647. )
  648. {
  649. if (IsBadReadPtr ((LPVOID) hXxxApp, sizeof (TAPI_APP_DATA)) ||
  650. ((LPTAPI_APP_DATA) hXxxApp)->dwKey != TAPI_APP_DATA_KEY)
  651. {
  652. return (LPTAPI_APP_DATA) NULL;
  653. }
  654. return (LPTAPI_APP_DATA) hXxxApp;
  655. }
  656. LONG
  657. WINAPI
  658. lineAccept(
  659. HCALL hCall,
  660. LPCSTR lpsUserUserInfo,
  661. DWORD dwSize
  662. )
  663. {
  664. LONG lResult = (*pfnCallProc3)(
  665. (DWORD) hCall,
  666. (DWORD) lpsUserUserInfo,
  667. (DWORD) dwSize,
  668. (LPVOID)gaProcs[lAccept],
  669. 0x2,
  670. 3
  671. );
  672. LineResult ("Accept", lResult);
  673. return lResult;
  674. }
  675. LONG
  676. WINAPI
  677. lineAddProvider(
  678. LPCSTR lpszProviderFilename,
  679. HWND hwndOwner,
  680. LPDWORD lpdwPermanentProviderID
  681. )
  682. {
  683. LONG lResult;
  684. #ifdef MEMPHIS
  685. DoFullLoad();
  686. LoadTAPI32IfNecessary();
  687. #endif
  688. lResult = (*pfnCallProc3)(
  689. (DWORD) lpszProviderFilename,
  690. (DWORD) (0xffff0000 | hwndOwner),
  691. (DWORD) lpdwPermanentProviderID,
  692. (LPVOID)gaProcs[lAddProvider],
  693. 0x5,
  694. 3
  695. );
  696. LineResult ("AddProvider", lResult);
  697. return lResult;
  698. }
  699. LONG
  700. WINAPI
  701. lineAddToConference(
  702. HCALL hConfCall,
  703. HCALL hConsultCall
  704. )
  705. {
  706. LONG lResult = (*pfnCallProc2)(
  707. (DWORD) hConfCall,
  708. (DWORD) hConsultCall,
  709. (LPVOID)gaProcs[lAddToConference],
  710. 0x0,
  711. 2
  712. );
  713. LineResult ("AddToConference", lResult);
  714. return lResult;
  715. }
  716. LONG
  717. WINAPI
  718. lineAnswer(
  719. HCALL hCall,
  720. LPCSTR lpsUserUserInfo,
  721. DWORD dwSize
  722. )
  723. {
  724. LONG lResult = (*pfnCallProc3)(
  725. (DWORD) hCall,
  726. (DWORD) lpsUserUserInfo,
  727. (DWORD) dwSize,
  728. (LPVOID)gaProcs[lAnswer],
  729. 0x2,
  730. 3
  731. );
  732. LineResult ("Answer", lResult);
  733. return lResult;
  734. }
  735. LONG
  736. WINAPI
  737. lineBlindTransfer(
  738. HCALL hCall,
  739. LPCSTR lpszDestAddress,
  740. DWORD dwCountryCode
  741. )
  742. {
  743. LONG lResult = (*pfnCallProc3)(
  744. (DWORD) hCall,
  745. (DWORD) lpszDestAddress,
  746. (DWORD) dwCountryCode,
  747. (LPVOID)gaProcs[lBlindTransfer],
  748. 0x2,
  749. 3
  750. );
  751. LineResult ("BlindTransfer", lResult);
  752. return lResult;
  753. }
  754. LONG
  755. WINAPI
  756. lineClose(
  757. HLINE hLine
  758. )
  759. {
  760. LONG lResult = (*pfnCallProc1)(
  761. (DWORD) hLine,
  762. (LPVOID)gaProcs[lClose],
  763. 0x0,
  764. 1
  765. );
  766. LineResult ("Close", lResult);
  767. return lResult;
  768. }
  769. LONG
  770. WINAPI
  771. lineCompleteCall(
  772. HCALL hCall,
  773. LPDWORD lpdwCompletionID,
  774. DWORD dwCompletionMode,
  775. DWORD dwMessageID
  776. )
  777. {
  778. LONG lResult;
  779. if (IsBadWritePtr (lpdwCompletionID, sizeof (DWORD)))
  780. {
  781. lResult = LINEERR_INVALPOINTER;
  782. }
  783. else
  784. {
  785. lResult = (*pfnCallProc4)(
  786. (DWORD) hCall,
  787. (DWORD) lpdwCompletionID, // let tapi32.dll map this
  788. (DWORD) dwCompletionMode,
  789. (DWORD) dwMessageID,
  790. (LPVOID)gaProcs[lCompleteCall],
  791. 0x0,
  792. 4
  793. );
  794. }
  795. LineResult ("CompleteCall", lResult);
  796. return lResult;
  797. }
  798. LONG
  799. WINAPI
  800. lineCompleteTransfer(
  801. HCALL hCall,
  802. HCALL hConsultCall,
  803. LPHCALL lphConfCall,
  804. DWORD dwTransferMode
  805. )
  806. {
  807. //
  808. // Tapi32.dll will take care of mapping lphConfCall if/when the
  809. // request completes successfully, so we don't set the mapping
  810. // bit down below; do check to see if pointer is valid though.
  811. //
  812. LONG lResult;
  813. if (
  814. ( dwTransferMode & LINETRANSFERMODE_CONFERENCE )
  815. &&
  816. IsBadWritePtr ((void FAR *) lphConfCall, sizeof(HCALL))
  817. )
  818. {
  819. DBGOUT ("Bad lphConfCall with TRANSFERMODE_CONFERENCE\n");
  820. lResult = LINEERR_INVALPOINTER;
  821. goto CompleteTransfer_cleanup;
  822. }
  823. lResult = (*pfnCallProc4)(
  824. (DWORD) hCall,
  825. (DWORD) hConsultCall,
  826. (DWORD) lphConfCall,
  827. (DWORD) dwTransferMode,
  828. (LPVOID)gaProcs[lCompleteTransfer],
  829. 0x0,
  830. 4
  831. );
  832. CompleteTransfer_cleanup:
  833. LineResult ("CompleteTransfer", lResult);
  834. return lResult;
  835. }
  836. LONG
  837. WINAPI
  838. lineConfigDialog(
  839. DWORD dwDeviceID,
  840. HWND hwndOwner,
  841. LPCSTR lpszDeviceClass
  842. )
  843. {
  844. LONG lResult;
  845. #ifdef MEMPHIS
  846. DoFullLoad();
  847. LoadTAPI32IfNecessary();
  848. #endif
  849. lResult = (*pfnCallProc3)(
  850. (DWORD) dwDeviceID,
  851. (DWORD) (0xffff0000 | hwndOwner),
  852. (DWORD) lpszDeviceClass,
  853. (LPVOID)gaProcs[lConfigDialog],
  854. 0x1,
  855. 3
  856. );
  857. LineResult ("ConfigDialog", lResult);
  858. return lResult;
  859. }
  860. LONG
  861. WINAPI
  862. lineConfigDialogEdit(
  863. DWORD dwDeviceID,
  864. HWND hwndOwner,
  865. LPCSTR lpszDeviceClass,
  866. LPVOID lpDeviceConfigIn,
  867. DWORD dwSize,
  868. LPVARSTRING lpDeviceConfigOut
  869. )
  870. {
  871. LONG lResult;
  872. #ifdef MEMPHIS
  873. DoFullLoad();
  874. LoadTAPI32IfNecessary();
  875. #endif
  876. lResult = (*pfnCallProc6)(
  877. (DWORD) dwDeviceID,
  878. (DWORD) (0xffff0000 | hwndOwner),
  879. (DWORD) lpszDeviceClass,
  880. (DWORD) lpDeviceConfigIn,
  881. (DWORD) dwSize,
  882. (DWORD) lpDeviceConfigOut,
  883. (LPVOID)gaProcs[lConfigDialogEdit],
  884. 0xd,
  885. 6
  886. );
  887. LineResult ("ConfigDialogEdit", lResult);
  888. return lResult;
  889. }
  890. LONG
  891. WINAPI
  892. lineConfigProvider(
  893. HWND hwndOwner,
  894. DWORD dwPermanentProviderID
  895. )
  896. {
  897. LONG lResult;
  898. #ifdef MEMPHIS
  899. DoFullLoad();
  900. LoadTAPI32IfNecessary();
  901. #endif
  902. lResult = (*pfnCallProc2)(
  903. (DWORD) (0xffff0000 | hwndOwner),
  904. (DWORD) dwPermanentProviderID,
  905. (LPVOID)gaProcs[lConfigProvider],
  906. 0x0,
  907. 2
  908. );
  909. LineResult ("ConfigProvider", lResult);
  910. return lResult;
  911. }
  912. LONG
  913. WINAPI
  914. lineDeallocateCall(
  915. HCALL hCall
  916. )
  917. {
  918. LONG lResult = (*pfnCallProc1)(
  919. (DWORD) hCall,
  920. (LPVOID)gaProcs[lDeallocateCall],
  921. 0x0,
  922. 1
  923. );
  924. LineResult ("DeallocateCall", lResult);
  925. return lResult;
  926. }
  927. LONG
  928. WINAPI
  929. lineDevSpecific(
  930. HLINE hLine,
  931. DWORD dwAddressID,
  932. HCALL hCall,
  933. LPVOID lpParams,
  934. DWORD dwSize
  935. )
  936. {
  937. LONG lResult;
  938. if (IsBadWritePtr (lpParams, (UINT) dwSize))
  939. {
  940. lResult = LINEERR_INVALPOINTER;
  941. }
  942. else
  943. {
  944. lResult = (*pfnCallProc5)(
  945. (DWORD) hLine,
  946. (DWORD) dwAddressID,
  947. (DWORD) hCall,
  948. (DWORD) lpParams, // let tapi32.dll map this
  949. (DWORD) dwSize,
  950. (LPVOID)gaProcs[lDevSpecific],
  951. 0x0,
  952. 5
  953. );
  954. }
  955. LineResult ("DevSpecific", lResult);
  956. return lResult;
  957. }
  958. LONG
  959. WINAPI
  960. lineDevSpecificFeature(
  961. HLINE hLine,
  962. DWORD dwFeature,
  963. LPVOID lpParams,
  964. DWORD dwSize
  965. )
  966. {
  967. LONG lResult;
  968. if (IsBadWritePtr (lpParams, (UINT) dwSize))
  969. {
  970. lResult = LINEERR_INVALPOINTER;
  971. }
  972. else
  973. {
  974. lResult = (*pfnCallProc4)(
  975. (DWORD) hLine,
  976. (DWORD) dwFeature,
  977. (DWORD) lpParams, // let tapi32.dll map this
  978. (DWORD) dwSize,
  979. (LPVOID)gaProcs[lDevSpecificFeature],
  980. 0x0,
  981. 4
  982. );
  983. }
  984. LineResult ("DevSpecificFeature", lResult);
  985. return lResult;
  986. }
  987. LONG
  988. WINAPI
  989. lineDial(
  990. HCALL hCall,
  991. LPCSTR lpszDestAddress,
  992. DWORD dwCountryCode
  993. )
  994. {
  995. LONG lResult = (*pfnCallProc3)(
  996. (DWORD) hCall,
  997. (DWORD) lpszDestAddress,
  998. (DWORD) dwCountryCode,
  999. (LPVOID)gaProcs[lDial],
  1000. 0x2,
  1001. 3
  1002. );
  1003. LineResult ("Dial", lResult);
  1004. return lResult;
  1005. }
  1006. LONG
  1007. WINAPI
  1008. lineDrop(
  1009. HCALL hCall,
  1010. LPCSTR lpsUserUserInfo,
  1011. DWORD dwSize
  1012. )
  1013. {
  1014. LONG lResult = (*pfnCallProc3)(
  1015. (DWORD) hCall,
  1016. (DWORD) lpsUserUserInfo,
  1017. (DWORD) dwSize,
  1018. (LPVOID)gaProcs[lDrop],
  1019. 0x2,
  1020. 3
  1021. );
  1022. LineResult ("Drop", lResult);
  1023. return lResult;
  1024. }
  1025. LONG
  1026. WINAPI
  1027. lineForward(
  1028. HLINE hLine,
  1029. DWORD bAllAddresses,
  1030. DWORD dwAddressID,
  1031. LPLINEFORWARDLIST const lpForwardList,
  1032. DWORD dwNumRingsNoAnswer,
  1033. LPHCALL lphConsultCall,
  1034. LPLINECALLPARAMS const lpCallParams
  1035. )
  1036. {
  1037. //
  1038. // Tapi32.dll will take care of mapping lphConsultCall if/when the
  1039. // request completes successfully, so we don't set the mapping
  1040. // bit down below; do check to see if pointer is valid though.
  1041. //
  1042. LONG lResult;
  1043. if (IsBadWritePtr ((void FAR *) lphConsultCall, sizeof(HCALL)))
  1044. {
  1045. lResult = LINEERR_INVALPOINTER;
  1046. }
  1047. else
  1048. {
  1049. lResult = (*pfnCallProc7)(
  1050. (DWORD) hLine,
  1051. (DWORD) bAllAddresses,
  1052. (DWORD) dwAddressID,
  1053. (DWORD) lpForwardList,
  1054. (DWORD) dwNumRingsNoAnswer,
  1055. (DWORD) lphConsultCall,
  1056. (DWORD) lpCallParams,
  1057. (LPVOID)gaProcs[lForward],
  1058. 0x9,
  1059. 7
  1060. );
  1061. }
  1062. LineResult ("Forward", lResult);
  1063. return lResult;
  1064. }
  1065. LONG
  1066. WINAPI
  1067. lineGatherDigits(
  1068. HCALL hCall,
  1069. DWORD dwDigitModes,
  1070. LPSTR lpsDigits,
  1071. DWORD dwNumDigits,
  1072. LPCSTR lpszTerminationDigits,
  1073. DWORD dwFirstDigitTimeout,
  1074. DWORD dwInterDigitTimeout
  1075. )
  1076. {
  1077. LONG lResult;
  1078. if (lpsDigits && IsBadWritePtr (lpsDigits, (UINT)dwNumDigits))
  1079. {
  1080. lResult = LINEERR_INVALPOINTER;
  1081. }
  1082. else
  1083. {
  1084. lResult = (*pfnCallProc7)(
  1085. (DWORD) hCall,
  1086. (DWORD) dwDigitModes,
  1087. (DWORD) lpsDigits, // let tapi32.dll map this
  1088. (DWORD) dwNumDigits,
  1089. (DWORD) lpszTerminationDigits,
  1090. (DWORD) dwFirstDigitTimeout,
  1091. (DWORD) dwInterDigitTimeout,
  1092. (LPVOID)gaProcs[lGatherDigits],
  1093. 0x4,
  1094. 7
  1095. );
  1096. }
  1097. LineResult ("GatherDigits", lResult);
  1098. return lResult;
  1099. }
  1100. LONG
  1101. WINAPI
  1102. lineGenerateDigits(
  1103. HCALL hCall,
  1104. DWORD dwDigitMode,
  1105. LPCSTR lpsDigits,
  1106. DWORD dwDuration
  1107. )
  1108. {
  1109. LONG lResult = (*pfnCallProc4)(
  1110. (DWORD) hCall,
  1111. (DWORD) dwDigitMode,
  1112. (DWORD) lpsDigits,
  1113. (DWORD) dwDuration,
  1114. (LPVOID)gaProcs[lGenerateDigits],
  1115. 0x2,
  1116. 4
  1117. );
  1118. LineResult ("GenerateDigits", lResult);
  1119. return lResult;
  1120. }
  1121. LONG
  1122. WINAPI
  1123. lineGenerateTone(
  1124. HCALL hCall,
  1125. DWORD dwToneMode,
  1126. DWORD dwDuration,
  1127. DWORD dwNumTones,
  1128. LPLINEGENERATETONE const lpTones
  1129. )
  1130. {
  1131. LONG lResult = (*pfnCallProc5)(
  1132. (DWORD) hCall,
  1133. (DWORD) dwToneMode,
  1134. (DWORD) dwDuration,
  1135. (DWORD) dwNumTones,
  1136. (DWORD) lpTones,
  1137. (LPVOID)gaProcs[lGenerateTone],
  1138. 0x1,
  1139. 5
  1140. );
  1141. LineResult ("GenerateTone", lResult);
  1142. return lResult;
  1143. }
  1144. LONG
  1145. WINAPI
  1146. lineGetAddressCaps(
  1147. HLINEAPP hLineApp,
  1148. DWORD dwDeviceID,
  1149. DWORD dwAddressID,
  1150. DWORD dwAPIVersion,
  1151. DWORD dwExtVersion,
  1152. LPLINEADDRESSCAPS lpAddressCaps
  1153. )
  1154. {
  1155. LONG lResult;
  1156. LPTAPI_APP_DATA pAppData;
  1157. if ((pAppData = IsValidXxxApp (hLineApp)))
  1158. {
  1159. lResult = (*pfnCallProc6)(
  1160. (DWORD) pAppData->hXxxApp,
  1161. (DWORD) dwDeviceID,
  1162. (DWORD) dwAddressID,
  1163. (DWORD) dwAPIVersion,
  1164. (DWORD) dwExtVersion,
  1165. (DWORD) lpAddressCaps,
  1166. (LPVOID)gaProcs[lGetAddressCaps],
  1167. 0x1,
  1168. 6
  1169. );
  1170. }
  1171. else
  1172. {
  1173. lResult = LINEERR_INVALAPPHANDLE;
  1174. }
  1175. LineResult ("GetAddressCaps", lResult);
  1176. return lResult;
  1177. }
  1178. LONG
  1179. WINAPI
  1180. lineGetAddressID(
  1181. HLINE hLine,
  1182. LPDWORD lpdwAddressID,
  1183. DWORD dwAddressMode,
  1184. LPCSTR lpsAddress,
  1185. DWORD dwSize
  1186. )
  1187. {
  1188. LONG lResult = (*pfnCallProc5)(
  1189. (DWORD) hLine,
  1190. (DWORD) lpdwAddressID,
  1191. (DWORD) dwAddressMode,
  1192. (DWORD) lpsAddress,
  1193. (DWORD) dwSize,
  1194. (LPVOID)gaProcs[lGetAddressID],
  1195. 0xa,
  1196. 5
  1197. );
  1198. LineResult ("GetAddressID", lResult);
  1199. return lResult;
  1200. }
  1201. LONG
  1202. WINAPI
  1203. lineGetAddressStatus(
  1204. HLINE hLine,
  1205. DWORD dwAddressID,
  1206. LPLINEADDRESSSTATUS lpAddressStatus
  1207. )
  1208. {
  1209. LONG lResult = (*pfnCallProc3)(
  1210. (DWORD) hLine,
  1211. (DWORD) dwAddressID,
  1212. (DWORD) lpAddressStatus,
  1213. (LPVOID)gaProcs[lGetAddressStatus],
  1214. 0x1,
  1215. 3
  1216. );
  1217. LineResult ("GetAddressStatus", lResult);
  1218. return lResult;
  1219. }
  1220. LONG
  1221. WINAPI
  1222. lineGetAppPriority(
  1223. LPCSTR lpszAppName,
  1224. DWORD dwMediaMode,
  1225. LPLINEEXTENSIONID lpExtensionID,
  1226. DWORD dwRequestMode,
  1227. LPVARSTRING lpExtensionName,
  1228. LPDWORD lpdwPriority
  1229. )
  1230. {
  1231. LONG lResult;
  1232. #ifdef MEMPHIS
  1233. DoFullLoad();
  1234. LoadTAPI32IfNecessary();
  1235. #endif
  1236. // GlobalWire( GlobalHandle(HIWORD(lpExtensionName)) );
  1237. // GlobalWire( GlobalHandle(HIWORD(lpdwPriority)) );
  1238. // GlobalWire( GlobalHandle(HIWORD(lpExtensionID)) );
  1239. // GlobalWire( GlobalHandle(HIWORD(lpszAppName)) );
  1240. lResult = (*pfnCallProc6)(
  1241. (DWORD) lpszAppName,
  1242. (DWORD) dwMediaMode,
  1243. (DWORD) lpExtensionID,
  1244. (DWORD) dwRequestMode,
  1245. (DWORD) lpExtensionName,
  1246. (DWORD) lpdwPriority,
  1247. (LPVOID)gaProcs[lGetAppPriority],
  1248. 0x2b,
  1249. 6
  1250. );
  1251. // GlobalUnWire( GlobalHandle(HIWORD(lpExtensionName)) );
  1252. // GlobalUnWire( GlobalHandle(HIWORD(lpdwPriority)) );
  1253. // GlobalUnWire( GlobalHandle(HIWORD(lpExtensionID)) );
  1254. // GlobalUnWire( GlobalHandle(HIWORD(lpszAppName)) );
  1255. LineResult ("GetAppPriority", lResult);
  1256. return lResult;
  1257. }
  1258. LONG
  1259. WINAPI
  1260. lineGetCallInfo(
  1261. HCALL hCall,
  1262. LPLINECALLINFO lpCallInfo
  1263. )
  1264. {
  1265. LONG lResult;
  1266. // GlobalWire( GlobalHandle(HIWORD(lpCallInfo)) );
  1267. lResult = (*pfnCallProc2)(
  1268. (DWORD) hCall,
  1269. (DWORD) lpCallInfo,
  1270. (LPVOID)gaProcs[lGetCallInfo],
  1271. 0x1,
  1272. 2
  1273. );
  1274. // GlobalUnWire( GlobalHandle(HIWORD(lpCallInfo)) );
  1275. LineResult ("GetCallInfo", lResult);
  1276. return lResult;
  1277. }
  1278. LONG
  1279. WINAPI
  1280. lineGetCallStatus(
  1281. HCALL hCall,
  1282. LPLINECALLSTATUS lpCallStatus
  1283. )
  1284. {
  1285. LONG lResult = (*pfnCallProc2)(
  1286. (DWORD) hCall,
  1287. (DWORD) lpCallStatus,
  1288. (LPVOID)gaProcs[lGetCallStatus],
  1289. 0x1,
  1290. 2
  1291. );
  1292. LineResult ("GetCallStatus", lResult);
  1293. return lResult;
  1294. }
  1295. LONG
  1296. WINAPI
  1297. lineGetConfRelatedCalls(
  1298. HCALL hCall,
  1299. LPLINECALLLIST lpCallList
  1300. )
  1301. {
  1302. LONG lResult = (*pfnCallProc2)(
  1303. (DWORD) hCall,
  1304. (DWORD) lpCallList,
  1305. (LPVOID)gaProcs[lGetConfRelatedCalls],
  1306. 0x1,
  1307. 2
  1308. );
  1309. LineResult ("GetConfRelatedCalls", lResult);
  1310. return lResult;
  1311. }
  1312. LONG
  1313. WINAPI
  1314. lineGetCountry(
  1315. DWORD dwCountryID,
  1316. DWORD dwAPIVersion,
  1317. LPLINECOUNTRYLIST lpLineCountryList
  1318. )
  1319. {
  1320. LONG lResult;
  1321. #ifdef MEMPHIS
  1322. DoFullLoad();
  1323. LoadTAPI32IfNecessary();
  1324. #endif
  1325. lResult = (*pfnCallProc3)(
  1326. dwCountryID,
  1327. dwAPIVersion,
  1328. (DWORD) lpLineCountryList,
  1329. (LPVOID)gaProcs[lGetCountry],
  1330. 0x1,
  1331. 3
  1332. );
  1333. LineResult ("GetCountry", lResult);
  1334. return lResult;
  1335. }
  1336. LONG
  1337. WINAPI
  1338. lineGetDevCaps(
  1339. HLINEAPP hLineApp,
  1340. DWORD dwDeviceID,
  1341. DWORD dwAPIVersion,
  1342. DWORD dwExtVersion,
  1343. LPLINEDEVCAPS lpLineDevCaps
  1344. )
  1345. {
  1346. LONG lResult;
  1347. LPTAPI_APP_DATA pAppData;
  1348. if ((pAppData = IsValidXxxApp (hLineApp)))
  1349. {
  1350. lResult = (*pfnCallProc5)(
  1351. (DWORD) pAppData->hXxxApp,
  1352. (DWORD) dwDeviceID,
  1353. (DWORD) dwAPIVersion,
  1354. (DWORD) dwExtVersion,
  1355. (DWORD) lpLineDevCaps,
  1356. (LPVOID)gaProcs[lGetDevCaps],
  1357. 0x1,
  1358. 5
  1359. );
  1360. }
  1361. else
  1362. {
  1363. lResult = LINEERR_INVALAPPHANDLE;
  1364. }
  1365. LineResult ("GetDevCaps", lResult);
  1366. return lResult;
  1367. }
  1368. LONG
  1369. WINAPI
  1370. lineGetDevConfig(
  1371. DWORD dwDeviceID,
  1372. LPVARSTRING lpDeviceConfig,
  1373. LPCSTR lpszDeviceClass
  1374. )
  1375. {
  1376. LONG lResult;
  1377. #ifdef MEMPHIS
  1378. DoFullLoad();
  1379. LoadTAPI32IfNecessary();
  1380. #endif
  1381. lResult = (*pfnCallProc3)(
  1382. (DWORD) dwDeviceID,
  1383. (DWORD) lpDeviceConfig,
  1384. (DWORD) lpszDeviceClass,
  1385. (LPVOID)gaProcs[lGetDevConfig],
  1386. 0x3,
  1387. 3
  1388. );
  1389. LineResult ("GetDevConfig", lResult);
  1390. return lResult;
  1391. }
  1392. LONG
  1393. WINAPI
  1394. lineGetIcon(
  1395. DWORD dwDeviceID,
  1396. LPCSTR lpszDeviceClass,
  1397. LPHICON lphIcon
  1398. )
  1399. {
  1400. LONG lResult;
  1401. DWORD hIcon32;
  1402. if (!IsBadWritePtr (lphIcon, sizeof (*lphIcon)))
  1403. {
  1404. #ifdef MEMPHIS
  1405. DoFullLoad();
  1406. LoadTAPI32IfNecessary();
  1407. #endif
  1408. lResult = (*pfnCallProc3)(
  1409. (DWORD) dwDeviceID,
  1410. (DWORD) lpszDeviceClass,
  1411. (DWORD) &hIcon32,
  1412. (LPVOID) gaProcs[lGetIcon],
  1413. 0x3,
  1414. 3
  1415. );
  1416. if (lResult == 0)
  1417. {
  1418. if (!ghIcon)
  1419. {
  1420. MyCreateIcon ();
  1421. }
  1422. *lphIcon = ghIcon;
  1423. }
  1424. }
  1425. else
  1426. {
  1427. lResult = LINEERR_INVALPOINTER;
  1428. }
  1429. LineResult ("GetIcon", lResult);
  1430. return lResult;
  1431. }
  1432. LONG
  1433. WINAPI
  1434. lineGetID(
  1435. HLINE hLine,
  1436. DWORD dwAddressID,
  1437. HCALL hCall,
  1438. DWORD dwSelect,
  1439. LPVARSTRING lpDeviceID,
  1440. LPCSTR lpszDeviceClass
  1441. )
  1442. {
  1443. LONG lResult;
  1444. // GlobalWire( GlobalHandle(HIWORD(lpszDeviceClass)) );
  1445. // GlobalWire( GlobalHandle(HIWORD(lpDeviceID)) );
  1446. lResult = (*pfnCallProc6)(
  1447. (DWORD) hLine,
  1448. (DWORD) dwAddressID,
  1449. (DWORD) hCall,
  1450. (DWORD) dwSelect,
  1451. (DWORD) lpDeviceID,
  1452. (DWORD) lpszDeviceClass,
  1453. (LPVOID)gaProcs[lGetID],
  1454. 0x3,
  1455. 6
  1456. );
  1457. LineResult ("GetID", lResult);
  1458. // GlobalUnWire( GlobalHandle(HIWORD(lpszDeviceClass)) );
  1459. // GlobalUnWire( GlobalHandle(HIWORD(lpDeviceID)) );
  1460. return lResult;
  1461. }
  1462. LONG
  1463. WINAPI
  1464. lineGetLineDevStatus(
  1465. HLINE hLine,
  1466. LPLINEDEVSTATUS lpLineDevStatus
  1467. )
  1468. {
  1469. LONG lResult = (*pfnCallProc2)(
  1470. (DWORD) hLine,
  1471. (DWORD) lpLineDevStatus,
  1472. (LPVOID)gaProcs[lGetLineDevStatus],
  1473. 0x1,
  1474. 2
  1475. );
  1476. LineResult ("GetLineDevStatus", lResult);
  1477. return lResult;
  1478. }
  1479. LONG
  1480. WINAPI
  1481. lineGetNewCalls(
  1482. HLINE hLine,
  1483. DWORD dwAddressID,
  1484. DWORD dwSelect,
  1485. LPLINECALLLIST lpCallList
  1486. )
  1487. {
  1488. LONG lResult = (*pfnCallProc4)(
  1489. (DWORD) hLine,
  1490. (DWORD) dwAddressID,
  1491. (DWORD) dwSelect,
  1492. (DWORD) lpCallList,
  1493. (LPVOID)gaProcs[lGetNewCalls],
  1494. 0x1,
  1495. 4
  1496. );
  1497. LineResult ("GetNewCalls", lResult);
  1498. return lResult;
  1499. }
  1500. LONG
  1501. WINAPI
  1502. lineGetNumRings(
  1503. HLINE hLine,
  1504. DWORD dwAddressID,
  1505. LPDWORD lpdwNumRings
  1506. )
  1507. {
  1508. LONG lResult = (*pfnCallProc3)(
  1509. (DWORD) hLine,
  1510. (DWORD) dwAddressID,
  1511. (DWORD) lpdwNumRings,
  1512. (LPVOID)gaProcs[lGetNumRings],
  1513. 0x1,
  1514. 3
  1515. );
  1516. LineResult ("GetNumRings", lResult);
  1517. return lResult;
  1518. }
  1519. LONG
  1520. WINAPI
  1521. lineGetProviderList(
  1522. DWORD dwAPIVersion,
  1523. LPLINEPROVIDERLIST lpProviderList
  1524. )
  1525. {
  1526. LONG lResult;
  1527. #ifdef MEMPHIS
  1528. DoFullLoad();
  1529. LoadTAPI32IfNecessary();
  1530. #endif
  1531. lResult = (*pfnCallProc2)(
  1532. dwAPIVersion,
  1533. (DWORD) lpProviderList,
  1534. (LPVOID)gaProcs[lGetProviderList],
  1535. 0x1,
  1536. 2
  1537. );
  1538. LineResult ("GetProviderList", lResult);
  1539. return lResult;
  1540. }
  1541. LONG
  1542. WINAPI
  1543. lineGetRequest(
  1544. HLINEAPP hLineApp,
  1545. DWORD dwRequestMode,
  1546. LPVOID lpRequestBuffer
  1547. )
  1548. {
  1549. LONG lResult;
  1550. LPTAPI_APP_DATA pAppData;
  1551. if ((pAppData = IsValidXxxApp (hLineApp)))
  1552. {
  1553. lResult = (*pfnCallProc3)(
  1554. (DWORD) pAppData->hXxxApp,
  1555. (DWORD) dwRequestMode,
  1556. (DWORD) lpRequestBuffer,
  1557. (LPVOID)gaProcs[lGetRequest],
  1558. 0x1,
  1559. 3
  1560. );
  1561. }
  1562. else
  1563. {
  1564. lResult = LINEERR_INVALAPPHANDLE;
  1565. }
  1566. LineResult ("GetRequest", lResult);
  1567. return lResult;
  1568. }
  1569. LONG
  1570. WINAPI
  1571. lineGetStatusMessages(
  1572. HLINE hLine,
  1573. LPDWORD lpdwLineStates,
  1574. LPDWORD lpdwAddressStates
  1575. )
  1576. {
  1577. LONG lResult = (*pfnCallProc3)(
  1578. (DWORD) hLine,
  1579. (DWORD) lpdwLineStates,
  1580. (DWORD) lpdwAddressStates,
  1581. (LPVOID)gaProcs[lGetStatusMessages],
  1582. 0x3,
  1583. 3
  1584. );
  1585. LineResult ("GetStatusMessages", lResult);
  1586. return lResult;
  1587. }
  1588. LONG
  1589. WINAPI
  1590. lineGetTranslateCaps(
  1591. HLINEAPP hLineApp,
  1592. DWORD dwAPIVersion,
  1593. LPLINETRANSLATECAPS lpTranslateCaps
  1594. )
  1595. {
  1596. LPTAPI_APP_DATA pAppData;
  1597. LONG lResult;
  1598. #ifdef MEMPHIS
  1599. DoFullLoad();
  1600. LoadTAPI32IfNecessary();
  1601. #endif
  1602. if (hLineApp == NULL || (pAppData = IsValidXxxApp (hLineApp)))
  1603. {
  1604. // GlobalWire( GlobalHandle(HIWORD(lpTranslateCaps)) );
  1605. lResult = (*pfnCallProc3)(
  1606. (hLineApp == NULL ? (DWORD) 0 : pAppData->hXxxApp),
  1607. (DWORD) dwAPIVersion,
  1608. (DWORD) lpTranslateCaps,
  1609. (LPVOID)gaProcs[lGetTranslateCaps],
  1610. 0x1,
  1611. 3
  1612. );
  1613. // GlobalUnWire( GlobalHandle(HIWORD(lpTranslateCaps)) );
  1614. }
  1615. else
  1616. {
  1617. lResult = LINEERR_INVALAPPHANDLE;
  1618. }
  1619. LineResult ("GetTranslateCaps", lResult);
  1620. return lResult;
  1621. }
  1622. LONG
  1623. WINAPI
  1624. lineHandoff(
  1625. HCALL hCall,
  1626. LPCSTR lpszFileName,
  1627. DWORD dwMediaMode
  1628. )
  1629. {
  1630. LONG lResult;
  1631. // GlobalWire( GlobalHandle(HIWORD(lpszFileName)) );
  1632. lResult = (*pfnCallProc3)(
  1633. (DWORD) hCall,
  1634. (DWORD) lpszFileName,
  1635. (DWORD) dwMediaMode,
  1636. (LPVOID)gaProcs[lHandoff],
  1637. 0x2,
  1638. 3
  1639. );
  1640. LineResult ("Handoff", lResult);
  1641. // GlobalUnWire( GlobalHandle(HIWORD(lpszFileName)) );
  1642. return lResult;
  1643. }
  1644. LONG
  1645. WINAPI
  1646. lineHold(
  1647. HCALL hCall
  1648. )
  1649. {
  1650. LONG lResult = (*pfnCallProc1)(
  1651. (DWORD) hCall,
  1652. (LPVOID)gaProcs[lHold],
  1653. 0x0,
  1654. 1
  1655. );
  1656. LineResult ("Hold", lResult);
  1657. return lResult;
  1658. }
  1659. LONG
  1660. WINAPI
  1661. lineInitialize(
  1662. LPHLINEAPP lphLineApp,
  1663. HINSTANCE hInstance,
  1664. LINECALLBACK lpfnCallback,
  1665. LPCSTR lpszAppName,
  1666. LPDWORD lpdwNumDevs
  1667. )
  1668. {
  1669. return (xxxInitialize(
  1670. TRUE,
  1671. lphLineApp,
  1672. hInstance,
  1673. lpfnCallback,
  1674. lpszAppName,
  1675. lpdwNumDevs
  1676. ));
  1677. }
  1678. LONG
  1679. WINAPI
  1680. lineMakeCall(
  1681. HLINE hLine,
  1682. LPHCALL lphCall,
  1683. LPCSTR lpszDestAddress,
  1684. DWORD dwCountryCode,
  1685. LPLINECALLPARAMS const lpCallParams
  1686. )
  1687. {
  1688. //
  1689. // Tapi32.dll will take care of mapping lphCall if/when the
  1690. // request completes successfully, so we don't set the mapping
  1691. // bit down below; do check to see if pointer is valid though.
  1692. //
  1693. LONG lResult;
  1694. if (IsBadWritePtr ((void FAR *) lphCall, sizeof(HCALL)))
  1695. {
  1696. lResult = LINEERR_INVALPOINTER;
  1697. }
  1698. else
  1699. {
  1700. // GlobalWire( GlobalHandle(HIWORD(lpCallParams)) );
  1701. // GlobalWire( GlobalHandle(HIWORD(lpszDestAddress)) );
  1702. lResult = (*pfnCallProc5)(
  1703. (DWORD) hLine,
  1704. (DWORD) lphCall,
  1705. (DWORD) lpszDestAddress,
  1706. (DWORD) dwCountryCode,
  1707. (DWORD) lpCallParams,
  1708. (LPVOID)gaProcs[lMakeCall],
  1709. 0x5,
  1710. 5
  1711. );
  1712. // GlobalUnWire( GlobalHandle(HIWORD(lpCallParams)) );
  1713. // GlobalUnWire( GlobalHandle(HIWORD(lpszDestAddress)) );
  1714. }
  1715. LineResult ("MakeCall", lResult);
  1716. return lResult;
  1717. }
  1718. LONG
  1719. WINAPI
  1720. lineMonitorDigits(
  1721. HCALL hCall,
  1722. DWORD dwDigitModes
  1723. )
  1724. {
  1725. LONG lResult = (*pfnCallProc2)(
  1726. (DWORD) hCall,
  1727. (DWORD) dwDigitModes,
  1728. (LPVOID)gaProcs[lMonitorDigits],
  1729. 0x0,
  1730. 2
  1731. );
  1732. LineResult ("MonitorDigits", lResult);
  1733. return lResult;
  1734. }
  1735. LONG
  1736. WINAPI
  1737. lineMonitorMedia(
  1738. HCALL hCall,
  1739. DWORD dwMediaModes
  1740. )
  1741. {
  1742. LONG lResult = (*pfnCallProc2)(
  1743. (DWORD) hCall,
  1744. (DWORD) dwMediaModes,
  1745. (LPVOID)gaProcs[lMonitorMedia],
  1746. 0x0,
  1747. 2
  1748. );
  1749. LineResult ("MonitorMedia", lResult);
  1750. return lResult;
  1751. }
  1752. LONG
  1753. WINAPI
  1754. lineMonitorTones(
  1755. HCALL hCall,
  1756. LPLINEMONITORTONE const lpToneList,
  1757. DWORD dwNumEntries
  1758. )
  1759. {
  1760. LONG lResult = (*pfnCallProc3)(
  1761. (DWORD) hCall,
  1762. (DWORD) lpToneList,
  1763. (DWORD) dwNumEntries,
  1764. (LPVOID)gaProcs[lMonitorTones],
  1765. 0x2,
  1766. 3
  1767. );
  1768. LineResult ("MonitorTones", lResult);
  1769. return lResult;
  1770. }
  1771. LONG
  1772. WINAPI
  1773. lineNegotiateAPIVersion(
  1774. HLINEAPP hLineApp,
  1775. DWORD dwDeviceID,
  1776. DWORD dwAPILowVersion,
  1777. DWORD dwAPIHighVersion,
  1778. LPDWORD lpdwAPIVersion,
  1779. LPLINEEXTENSIONID lpExtensionID
  1780. )
  1781. {
  1782. LONG lResult;
  1783. LPTAPI_APP_DATA pAppData;
  1784. if ((pAppData = IsValidXxxApp (hLineApp)))
  1785. {
  1786. lResult = (*pfnCallProc6)(
  1787. (DWORD) pAppData->hXxxApp,
  1788. (DWORD) dwDeviceID,
  1789. (DWORD) dwAPILowVersion,
  1790. (DWORD) dwAPIHighVersion,
  1791. (DWORD) lpdwAPIVersion,
  1792. (DWORD) lpExtensionID,
  1793. (LPVOID)gaProcs[lNegotiateAPIVersion],
  1794. 0x3,
  1795. 6
  1796. );
  1797. }
  1798. else
  1799. {
  1800. lResult = LINEERR_INVALAPPHANDLE;
  1801. }
  1802. LineResult ("NegotiateAPIVersion", lResult);
  1803. return lResult;
  1804. }
  1805. LONG
  1806. WINAPI
  1807. lineNegotiateExtVersion(
  1808. HLINEAPP hLineApp,
  1809. DWORD dwDeviceID,
  1810. DWORD dwAPIVersion,
  1811. DWORD dwExtLowVersion,
  1812. DWORD dwExtHighVersion,
  1813. LPDWORD lpdwExtVersion
  1814. )
  1815. {
  1816. LONG lResult;
  1817. LPTAPI_APP_DATA pAppData;
  1818. if ((pAppData = IsValidXxxApp (hLineApp)))
  1819. {
  1820. lResult = (*pfnCallProc6)(
  1821. (DWORD) pAppData->hXxxApp,
  1822. (DWORD) dwDeviceID,
  1823. (DWORD) dwAPIVersion,
  1824. (DWORD) dwExtLowVersion,
  1825. (DWORD) dwExtHighVersion,
  1826. (DWORD) lpdwExtVersion,
  1827. (LPVOID)gaProcs[lNegotiateExtVersion],
  1828. 0x1,
  1829. 6
  1830. );
  1831. }
  1832. else
  1833. {
  1834. lResult = LINEERR_INVALAPPHANDLE;
  1835. }
  1836. LineResult ("NegotiateExtVersion", lResult);
  1837. return lResult;
  1838. }
  1839. LONG
  1840. WINAPI
  1841. lineOpen(
  1842. HLINEAPP hLineApp,
  1843. DWORD dwDeviceID,
  1844. LPHLINE lphLine,
  1845. DWORD dwAPIVersion,
  1846. DWORD dwExtVersion,
  1847. DWORD dwCallbackInstance,
  1848. DWORD dwPrivileges,
  1849. DWORD dwMediaModes,
  1850. LPLINECALLPARAMS const lpCallParams
  1851. )
  1852. {
  1853. LONG lResult;
  1854. LPTAPI_APP_DATA pAppData;
  1855. //OutputDebugString("open16");
  1856. //DebugBreak();
  1857. if ((pAppData = IsValidXxxApp (hLineApp)))
  1858. {
  1859. #ifdef MEMPHIS
  1860. gfOpenDone = FALSE;
  1861. ghLine = NULL;
  1862. lResult = (*pfnCallProc10)(
  1863. (DWORD) pAppData->hXxxApp,
  1864. (DWORD) dwDeviceID,
  1865. (DWORD) lphLine,
  1866. (DWORD) dwAPIVersion,
  1867. (DWORD) dwExtVersion,
  1868. (DWORD) dwCallbackInstance,
  1869. (DWORD) dwPrivileges,
  1870. (DWORD) dwMediaModes,
  1871. (DWORD) lpCallParams,
  1872. (DWORD) pAppData->hwnd,
  1873. (LPVOID)gaProcs[lOpenInt],
  1874. 0x82,
  1875. 10
  1876. );
  1877. if ( 0 == lResult )
  1878. {
  1879. MSG msg;
  1880. //
  1881. // Now wait to hear back from TAPISRV
  1882. //
  1883. DBGOUT((2, "Starting message loop in open16"));
  1884. //TODO NOW: Timeout?? (would need to change from GetMessage to PeekMessage)
  1885. while ( !gfOpenDone && GetMessage(&msg, 0, 0, 0) != 0)
  1886. {
  1887. TranslateMessage(&msg);
  1888. DispatchMessage(&msg);
  1889. }
  1890. DBGOUT((2, "Done message loop in open16\r\n"));
  1891. //
  1892. // Was it actually an error?
  1893. //
  1894. if ( (DWORD)ghLine >= 0x80000000 && (DWORD)ghLine <= 0x80000055 )
  1895. {
  1896. lResult = (DWORD)ghLine;
  1897. }
  1898. else
  1899. {
  1900. lResult = 0;
  1901. *lphLine = ghLine;
  1902. }
  1903. }
  1904. #else
  1905. lResult = (*pfnCallProc9)(
  1906. (DWORD) pAppData->hXxxApp,
  1907. (DWORD) dwDeviceID,
  1908. (DWORD) lphLine,
  1909. (DWORD) dwAPIVersion,
  1910. (DWORD) dwExtVersion,
  1911. (DWORD) dwCallbackInstance,
  1912. (DWORD) dwPrivileges,
  1913. (DWORD) dwMediaModes,
  1914. (DWORD) lpCallParams,
  1915. (LPVOID)gaProcs[lOpen],
  1916. 0x41,
  1917. 9
  1918. );
  1919. #endif
  1920. }
  1921. else
  1922. {
  1923. lResult = LINEERR_INVALAPPHANDLE;
  1924. }
  1925. LineResult ("Open", lResult);
  1926. return lResult;
  1927. }
  1928. LONG
  1929. WINAPI
  1930. linePark(
  1931. HCALL hCall,
  1932. DWORD dwParkMode,
  1933. LPCSTR lpszDirAddress,
  1934. LPVARSTRING lpNonDirAddress
  1935. )
  1936. {
  1937. LONG lResult;
  1938. // GlobalWire( GlobalHandle(HIWORD(lpszDirAddress)) );
  1939. lResult = (*pfnCallProc4)(
  1940. (DWORD) hCall,
  1941. (DWORD) dwParkMode,
  1942. (DWORD) lpszDirAddress,
  1943. (DWORD) lpNonDirAddress, // let tapi32.dll map this
  1944. (LPVOID)gaProcs[lPark],
  1945. 0x2,
  1946. 4
  1947. );
  1948. LineResult ("Park", lResult);
  1949. // GlobalUnWire( GlobalHandle(HIWORD(lpszDirAddress)) );
  1950. return lResult;
  1951. }
  1952. LONG
  1953. WINAPI
  1954. linePickup(
  1955. HLINE hLine,
  1956. DWORD dwAddressID,
  1957. LPHCALL lphCall,
  1958. LPCSTR lpszDestAddress,
  1959. LPCSTR lpszGroupID
  1960. )
  1961. {
  1962. //
  1963. // Tapi32.dll will take care of mapping lphCall if/when the
  1964. // request completes successfully, so we don't set the mapping
  1965. // bit down below; do check to see if pointer is valid though.
  1966. //
  1967. LONG lResult;
  1968. if (IsBadWritePtr ((void FAR *) lphCall, sizeof(HCALL)))
  1969. {
  1970. lResult = LINEERR_INVALPOINTER;
  1971. }
  1972. else
  1973. {
  1974. lResult = (*pfnCallProc5)(
  1975. (DWORD) hLine,
  1976. (DWORD) dwAddressID,
  1977. (DWORD) lphCall,
  1978. (DWORD) lpszDestAddress,
  1979. (DWORD) lpszGroupID,
  1980. (LPVOID)gaProcs[lPickup],
  1981. 0x3,
  1982. 5
  1983. );
  1984. }
  1985. LineResult ("Pickup", lResult);
  1986. return lResult;
  1987. }
  1988. LONG
  1989. WINAPI
  1990. linePrepareAddToConference(
  1991. HCALL hConfCall,
  1992. LPHCALL lphConsultCall,
  1993. LPLINECALLPARAMS const lpCallParams
  1994. )
  1995. {
  1996. //
  1997. // Tapi32.dll will take care of mapping lphConsultCall if/when the
  1998. // request completes successfully, so we don't set the mapping
  1999. // bit down below; do check to see if pointer is valid though.
  2000. //
  2001. LONG lResult;
  2002. if (IsBadWritePtr ((void FAR *) lphConsultCall, sizeof(HCALL)))
  2003. {
  2004. lResult = LINEERR_INVALPOINTER;
  2005. }
  2006. else
  2007. {
  2008. lResult = (*pfnCallProc3)(
  2009. (DWORD) hConfCall,
  2010. (DWORD) lphConsultCall,
  2011. (DWORD) lpCallParams,
  2012. (LPVOID)gaProcs[lPrepareAddToConference],
  2013. 0x1,
  2014. 3
  2015. );
  2016. }
  2017. LineResult ("PrepareAddToConference", lResult);
  2018. return lResult;
  2019. }
  2020. LONG
  2021. WINAPI
  2022. lineRedirect(
  2023. HCALL hCall,
  2024. LPCSTR lpszDestAddress,
  2025. DWORD dwCountryCode
  2026. )
  2027. {
  2028. LONG lResult = (*pfnCallProc3)(
  2029. (DWORD) hCall,
  2030. (DWORD) lpszDestAddress,
  2031. (DWORD) dwCountryCode,
  2032. (LPVOID)gaProcs[lRedirect],
  2033. 0x2,
  2034. 3
  2035. );
  2036. LineResult ("Redirect", lResult);
  2037. return lResult;
  2038. }
  2039. LONG
  2040. WINAPI
  2041. lineRegisterRequestRecipient(
  2042. HLINEAPP hLineApp,
  2043. DWORD dwRegistrationInstance,
  2044. DWORD dwRequestMode,
  2045. DWORD bEnable
  2046. )
  2047. {
  2048. LPTAPI_APP_DATA pAppData;
  2049. LONG lResult;
  2050. #ifdef MEMPHIS
  2051. DoFullLoad();
  2052. LoadTAPI32IfNecessary();
  2053. #endif
  2054. if ((pAppData = IsValidXxxApp (hLineApp)))
  2055. {
  2056. lResult = (*pfnCallProc4)(
  2057. (DWORD) pAppData->hXxxApp,
  2058. (DWORD) dwRegistrationInstance,
  2059. (DWORD) dwRequestMode,
  2060. (DWORD) bEnable,
  2061. (LPVOID)gaProcs[lRegisterRequestRecipient],
  2062. 0x0,
  2063. 4
  2064. );
  2065. }
  2066. else
  2067. {
  2068. lResult = LINEERR_INVALAPPHANDLE;
  2069. }
  2070. LineResult ("RegisterRequestRecipient", lResult);
  2071. return lResult;
  2072. }
  2073. LONG
  2074. WINAPI
  2075. lineReleaseUserUserInfo(
  2076. HCALL hCall
  2077. )
  2078. {
  2079. LONG lResult = (*pfnCallProc1)(
  2080. (DWORD) hCall,
  2081. (LPVOID)gaProcs[lReleaseUserUserInfo],
  2082. 0x0,
  2083. 1
  2084. );
  2085. LineResult ("ReleaseUserUserInfo", lResult);
  2086. return lResult;
  2087. }
  2088. LONG
  2089. WINAPI
  2090. lineRemoveFromConference(
  2091. HCALL hCall
  2092. )
  2093. {
  2094. LONG lResult = (*pfnCallProc1)(
  2095. (DWORD) hCall,
  2096. (LPVOID)gaProcs[lRemoveFromConference],
  2097. 0x0,
  2098. 1
  2099. );
  2100. LineResult ("RemoveFromConference", lResult);
  2101. return lResult;
  2102. }
  2103. LONG
  2104. WINAPI
  2105. lineRemoveProvider(
  2106. DWORD dwPermanentProviderID,
  2107. HWND hwndOwner
  2108. )
  2109. {
  2110. LONG lResult;
  2111. #ifdef MEMPHIS
  2112. DoFullLoad();
  2113. LoadTAPI32IfNecessary();
  2114. #endif
  2115. lResult = (*pfnCallProc2)(
  2116. (DWORD) dwPermanentProviderID,
  2117. (DWORD) (0xffff0000 | hwndOwner),
  2118. (LPVOID)gaProcs[lRemoveProvider],
  2119. 0x0,
  2120. 2
  2121. );
  2122. LineResult ("RemoveProvider", lResult);
  2123. return lResult;
  2124. }
  2125. LONG
  2126. WINAPI
  2127. lineSecureCall(
  2128. HCALL hCall
  2129. )
  2130. {
  2131. LONG lResult = (*pfnCallProc1)(
  2132. (DWORD) hCall,
  2133. (LPVOID)gaProcs[lSecureCall],
  2134. 0x0,
  2135. 1
  2136. );
  2137. LineResult ("SecureCall", lResult);
  2138. return lResult;
  2139. }
  2140. LONG
  2141. WINAPI
  2142. lineSendUserUserInfo(
  2143. HCALL hCall,
  2144. LPCSTR lpsUserUserInfo,
  2145. DWORD dwSize
  2146. )
  2147. {
  2148. LONG lResult = (*pfnCallProc3)(
  2149. (DWORD) hCall,
  2150. (DWORD) lpsUserUserInfo,
  2151. (DWORD) dwSize,
  2152. (LPVOID)gaProcs[lSendUserUserInfo],
  2153. 0x2,
  2154. 3
  2155. );
  2156. LineResult ("SendUserUserInfo", lResult);
  2157. return lResult;
  2158. }
  2159. LONG
  2160. WINAPI
  2161. lineSetAppPriority(
  2162. LPCSTR lpszAppName,
  2163. DWORD dwMediaMode,
  2164. LPLINEEXTENSIONID lpExtensionID,
  2165. DWORD dwRequestMode,
  2166. LPCSTR lpszExtensionName,
  2167. DWORD dwPriority
  2168. )
  2169. {
  2170. LONG lResult;
  2171. #ifdef MEMPHIS
  2172. DoFullLoad();
  2173. LoadTAPI32IfNecessary();
  2174. #endif
  2175. // GlobalWire( GlobalHandle(HIWORD(lpszExtensionName)) );
  2176. // GlobalWire( GlobalHandle(HIWORD(lpExtensionID)) );
  2177. // GlobalWire( GlobalHandle(HIWORD(lpszAppName)) );
  2178. lResult = (*pfnCallProc6)(
  2179. (DWORD) lpszAppName,
  2180. (DWORD) dwMediaMode,
  2181. (DWORD) lpExtensionID,
  2182. (DWORD) dwRequestMode,
  2183. (DWORD) lpszExtensionName,
  2184. (DWORD) dwPriority,
  2185. (LPVOID)gaProcs[lSetAppPriority],
  2186. 0x2a,
  2187. 6
  2188. );
  2189. // GlobalUnWire( GlobalHandle(HIWORD(lpszExtensionName)) );
  2190. // GlobalUnWire( GlobalHandle(HIWORD(lpExtensionID)) );
  2191. // GlobalUnWire( GlobalHandle(HIWORD(lpszAppName)) );
  2192. LineResult ("SetAppPriority", lResult);
  2193. return lResult;
  2194. }
  2195. LONG
  2196. WINAPI
  2197. lineSetAppSpecific(
  2198. HCALL hCall,
  2199. DWORD dwAppSpecific
  2200. )
  2201. {
  2202. LONG lResult = (*pfnCallProc2)(
  2203. (DWORD) hCall,
  2204. (DWORD) dwAppSpecific,
  2205. (LPVOID)gaProcs[lSetAppSpecific],
  2206. 0x0,
  2207. 2
  2208. );
  2209. LineResult ("SetAppSpecific", lResult);
  2210. return lResult;
  2211. }
  2212. LONG
  2213. WINAPI
  2214. lineSetCallParams(
  2215. HCALL hCall,
  2216. DWORD dwBearerMode,
  2217. DWORD dwMinRate,
  2218. DWORD dwMaxRate,
  2219. LPLINEDIALPARAMS const lpDialParams
  2220. )
  2221. {
  2222. LONG lResult = (*pfnCallProc5)(
  2223. (DWORD) hCall,
  2224. (DWORD) dwBearerMode,
  2225. (DWORD) dwMinRate,
  2226. (DWORD) dwMaxRate,
  2227. (DWORD) lpDialParams,
  2228. (LPVOID)gaProcs[lSetCallParams],
  2229. 0x1,
  2230. 5
  2231. );
  2232. LineResult ("SetCallParams", lResult);
  2233. return lResult;
  2234. }
  2235. LONG
  2236. WINAPI
  2237. lineSetCallPrivilege(
  2238. HCALL hCall,
  2239. DWORD dwCallPrivilege
  2240. )
  2241. {
  2242. LONG lResult = (*pfnCallProc2)(
  2243. (DWORD) hCall,
  2244. (DWORD) dwCallPrivilege,
  2245. (LPVOID)gaProcs[lSetCallPrivilege],
  2246. 0x0,
  2247. 2
  2248. );
  2249. LineResult ("SetCallPrivilege", lResult);
  2250. return lResult;
  2251. }
  2252. LONG
  2253. WINAPI
  2254. lineSetCurrentLocation(
  2255. HLINEAPP hLineApp,
  2256. DWORD dwLocation
  2257. )
  2258. {
  2259. LPTAPI_APP_DATA pAppData;
  2260. LONG lResult;
  2261. #ifdef MEMPHIS
  2262. DoFullLoad();
  2263. LoadTAPI32IfNecessary();
  2264. #endif
  2265. if ((pAppData = IsValidXxxApp (hLineApp)))
  2266. {
  2267. lResult = (*pfnCallProc2)(
  2268. (DWORD) pAppData->hXxxApp,
  2269. (DWORD) dwLocation,
  2270. (LPVOID)gaProcs[lSetCurrentLocation],
  2271. 0x0,
  2272. 2
  2273. );
  2274. }
  2275. else
  2276. {
  2277. lResult = LINEERR_INVALAPPHANDLE;
  2278. }
  2279. LineResult ("SetCurrentLocation", lResult);
  2280. return lResult;
  2281. }
  2282. LONG
  2283. WINAPI
  2284. lineSetDevConfig(
  2285. DWORD dwDeviceID,
  2286. LPVOID const lpDeviceConfig,
  2287. DWORD dwSize,
  2288. LPCSTR lpszDeviceClass
  2289. )
  2290. {
  2291. LONG lResult;
  2292. #ifdef MEMPHIS
  2293. DoFullLoad();
  2294. LoadTAPI32IfNecessary();
  2295. #endif
  2296. lResult = (*pfnCallProc4)(
  2297. (DWORD) dwDeviceID,
  2298. (DWORD) lpDeviceConfig,
  2299. (DWORD) dwSize,
  2300. (DWORD) lpszDeviceClass,
  2301. (LPVOID)gaProcs[lSetDevConfig],
  2302. 0x5,
  2303. 4
  2304. );
  2305. LineResult ("SetDevConfig", lResult);
  2306. return lResult;
  2307. }
  2308. LONG
  2309. WINAPI
  2310. lineSetMediaControl(
  2311. HLINE hLine,
  2312. DWORD dwAddressID,
  2313. HCALL hCall,
  2314. DWORD dwSelect,
  2315. LPLINEMEDIACONTROLDIGIT const lpDigitList,
  2316. DWORD dwDigitNumEntries,
  2317. LPLINEMEDIACONTROLMEDIA const lpMediaList,
  2318. DWORD dwMediaNumEntries,
  2319. LPLINEMEDIACONTROLTONE const lpToneList,
  2320. DWORD dwToneNumEntries,
  2321. LPLINEMEDIACONTROLCALLSTATE const lpCallStateList,
  2322. DWORD dwCallStateNumEntries
  2323. )
  2324. {
  2325. LONG lResult = (*pfnCallProc12)(
  2326. (DWORD) hLine,
  2327. (DWORD) dwAddressID,
  2328. (DWORD) hCall,
  2329. (DWORD) dwSelect,
  2330. (DWORD) lpDigitList,
  2331. (DWORD) dwDigitNumEntries,
  2332. (DWORD) lpMediaList,
  2333. (DWORD) dwMediaNumEntries,
  2334. (DWORD) lpToneList,
  2335. (DWORD) dwToneNumEntries,
  2336. (DWORD) lpCallStateList,
  2337. (DWORD) dwCallStateNumEntries,
  2338. (LPVOID)gaProcs[lSetMediaControl],
  2339. 0xaa,
  2340. 12
  2341. );
  2342. LineResult ("SetMediaControl", lResult);
  2343. return lResult;
  2344. }
  2345. LONG
  2346. WINAPI
  2347. lineSetMediaMode(
  2348. HCALL hCall,
  2349. DWORD dwMediaModes
  2350. )
  2351. {
  2352. LONG lResult = (*pfnCallProc2)(
  2353. (DWORD) hCall,
  2354. (DWORD) dwMediaModes,
  2355. (LPVOID)gaProcs[lSetMediaMode],
  2356. 0x0,
  2357. 2
  2358. );
  2359. LineResult ("lineSetMediaMode", lResult);
  2360. return lResult;
  2361. }
  2362. LONG
  2363. WINAPI
  2364. lineSetNumRings(
  2365. HLINE hLine,
  2366. DWORD dwAddressID,
  2367. DWORD dwNumRings
  2368. )
  2369. {
  2370. LONG lResult = (*pfnCallProc3)(
  2371. (DWORD) hLine,
  2372. (DWORD) dwAddressID,
  2373. (DWORD) dwNumRings,
  2374. (LPVOID)gaProcs[lSetNumRings],
  2375. 0x0,
  2376. 3
  2377. );
  2378. LineResult ("SetNumRings", lResult);
  2379. return lResult;
  2380. }
  2381. LONG
  2382. WINAPI
  2383. lineSetStatusMessages(
  2384. HLINE hLine,
  2385. DWORD dwLineStates,
  2386. DWORD dwAddressStates
  2387. )
  2388. {
  2389. LONG lResult = (*pfnCallProc3)(
  2390. (DWORD) hLine,
  2391. (DWORD) dwLineStates,
  2392. (DWORD) dwAddressStates,
  2393. (LPVOID)gaProcs[lSetStatusMessages],
  2394. 0x0,
  2395. 3
  2396. );
  2397. LineResult ("SetStatusMessages", lResult);
  2398. return lResult;
  2399. }
  2400. LONG
  2401. WINAPI
  2402. lineSetTerminal(
  2403. HLINE hLine,
  2404. DWORD dwAddressID,
  2405. HCALL hCall,
  2406. DWORD dwSelect,
  2407. DWORD dwTerminalModes,
  2408. DWORD dwTerminalID,
  2409. DWORD bEnable
  2410. )
  2411. {
  2412. LONG lResult = (*pfnCallProc7)(
  2413. (DWORD) hLine,
  2414. (DWORD) dwAddressID,
  2415. (DWORD) hCall,
  2416. (DWORD) dwSelect,
  2417. (DWORD) dwTerminalModes,
  2418. (DWORD) dwTerminalID,
  2419. (DWORD) bEnable,
  2420. (LPVOID)gaProcs[lSetTerminal],
  2421. 0x0,
  2422. 7
  2423. );
  2424. LineResult ("SetTerminal", lResult);
  2425. return lResult;
  2426. }
  2427. LONG
  2428. WINAPI
  2429. lineSetTollList(
  2430. HLINEAPP hLineApp,
  2431. DWORD dwDeviceID,
  2432. LPCSTR lpszAddressIn,
  2433. DWORD dwTollListOption
  2434. )
  2435. {
  2436. LPTAPI_APP_DATA pAppData;
  2437. LONG lResult;
  2438. #ifdef MEMPHIS
  2439. DoFullLoad();
  2440. LoadTAPI32IfNecessary();
  2441. #endif
  2442. if ((pAppData = IsValidXxxApp (hLineApp)))
  2443. {
  2444. lResult = (*pfnCallProc4)(
  2445. (DWORD) pAppData->hXxxApp,
  2446. (DWORD) dwDeviceID,
  2447. (DWORD) lpszAddressIn,
  2448. (DWORD) dwTollListOption,
  2449. (LPVOID)gaProcs[lSetTollList],
  2450. 0x2,
  2451. 4
  2452. );
  2453. }
  2454. else
  2455. {
  2456. lResult = LINEERR_INVALAPPHANDLE;
  2457. }
  2458. LineResult ("SetTollList", lResult);
  2459. return lResult;
  2460. }
  2461. LONG
  2462. WINAPI
  2463. lineSetupConference(
  2464. HCALL hCall,
  2465. HLINE hLine,
  2466. LPHCALL lphConfCall,
  2467. LPHCALL lphConsultCall,
  2468. DWORD dwNumParties,
  2469. LPLINECALLPARAMS const lpCallParams
  2470. )
  2471. {
  2472. //
  2473. // Tapi32.dll will take care of mapping lphXxxCall's if/when the
  2474. // request completes successfully, so we don't set the mapping
  2475. // bit down below; do check to see if pointer is valid though.
  2476. //
  2477. LONG lResult;
  2478. if (IsBadWritePtr ((void FAR *) lphConfCall, sizeof(HCALL)) ||
  2479. IsBadWritePtr ((void FAR *) lphConsultCall, sizeof(HCALL)))
  2480. {
  2481. lResult = LINEERR_INVALPOINTER;
  2482. }
  2483. else
  2484. {
  2485. lResult = (*pfnCallProc6)(
  2486. (DWORD) hCall,
  2487. (DWORD) hLine,
  2488. (DWORD) lphConfCall,
  2489. (DWORD) lphConsultCall,
  2490. (DWORD) dwNumParties,
  2491. (DWORD) lpCallParams,
  2492. (LPVOID)gaProcs[lSetupConference],
  2493. 0x1,
  2494. 6
  2495. );
  2496. }
  2497. LineResult ("SetupConference", lResult);
  2498. return lResult;
  2499. }
  2500. LONG
  2501. WINAPI
  2502. lineSetupTransfer(
  2503. HCALL hCall,
  2504. LPHCALL lphConsultCall,
  2505. LPLINECALLPARAMS const lpCallParams
  2506. )
  2507. {
  2508. //
  2509. // Tapi32.dll will take care of mapping lphConsultCall if/when the
  2510. // request completes successfully, so we don't set the mapping
  2511. // bit down below; do check to see if pointer is valid though.
  2512. //
  2513. LONG lResult;
  2514. if (IsBadWritePtr ((void FAR *) lphConsultCall, sizeof(HCALL)))
  2515. {
  2516. lResult = LINEERR_INVALPOINTER;
  2517. }
  2518. else
  2519. {
  2520. lResult = (*pfnCallProc3)(
  2521. (DWORD) hCall,
  2522. (DWORD) lphConsultCall,
  2523. (DWORD) lpCallParams,
  2524. (LPVOID)gaProcs[lSetupTransfer],
  2525. 0x1,
  2526. 3
  2527. );
  2528. }
  2529. LineResult ("SetupTransfer", lResult);
  2530. return lResult;
  2531. }
  2532. LONG
  2533. WINAPI
  2534. lineShutdown(
  2535. HLINEAPP hLineApp
  2536. )
  2537. {
  2538. LONG lResult;
  2539. LPTAPI_APP_DATA pAppData;
  2540. if ((pAppData = IsValidXxxApp (hLineApp)))
  2541. {
  2542. #ifdef MEMPHIS
  2543. //DBGOUT((1, "Now in ls"));
  2544. //DebugBreak();
  2545. gfShutdownDone = FALSE;
  2546. lResult = (LONG) (*pfnCallProc2)(
  2547. (DWORD) pAppData->hXxxApp,
  2548. (DWORD) pAppData->hwnd,
  2549. (LPVOID)gaProcs[lShutdownInt],
  2550. 0x0,
  2551. 2
  2552. );
  2553. if ( 0 == lResult )
  2554. {
  2555. MSG msg;
  2556. //
  2557. // Now wait to hear back from TAPISRV
  2558. //
  2559. DBGOUT((2, "Starting message loop in shut16\r\n"));
  2560. //TODO NOW: Timeout?? (would need to change from GetMessage to PeekMessage)
  2561. while ( !gfShutdownDone && GetMessage(&msg, 0, 0, 0) != 0)
  2562. {
  2563. TranslateMessage(&msg);
  2564. DispatchMessage(&msg);
  2565. }
  2566. DBGOUT((2, "Done message loop in shut16\r\n"));
  2567. //
  2568. // Was it actually an error?
  2569. //
  2570. if ( (DWORD)ghLine >= 0x80000000 && (DWORD)ghLine <= 0x80000055 )
  2571. {
  2572. lResult = (DWORD)ghLine;
  2573. }
  2574. else
  2575. {
  2576. lResult = 0;
  2577. }
  2578. }
  2579. #else
  2580. lResult = (LONG) (*pfnCallProc1)(
  2581. (DWORD) pAppData->hXxxApp,
  2582. (LPVOID)gaProcs[lShutdown],
  2583. 0x0,
  2584. 1
  2585. );
  2586. #endif
  2587. if ( lResult == 0 )
  2588. {
  2589. //
  2590. // Destroy the associated window & free the app data instance
  2591. //
  2592. DestroyWindow (pAppData->hwnd);
  2593. pAppData->dwKey = 0xefefefef;
  2594. free (pAppData);
  2595. }
  2596. }
  2597. else
  2598. {
  2599. lResult = LINEERR_INVALAPPHANDLE;
  2600. }
  2601. LineResult ("Shutdown", lResult);
  2602. return lResult;
  2603. }
  2604. LONG
  2605. WINAPI
  2606. lineSwapHold(
  2607. HCALL hActiveCall,
  2608. HCALL hHeldCall
  2609. )
  2610. {
  2611. LONG lResult = (*pfnCallProc2)(
  2612. (DWORD) hActiveCall,
  2613. (DWORD) hHeldCall,
  2614. (LPVOID)gaProcs[lSwapHold],
  2615. 0x0,
  2616. 2
  2617. );
  2618. LineResult ("SwapHold", lResult);
  2619. return lResult;
  2620. }
  2621. LONG
  2622. WINAPI
  2623. lineTranslateAddress(
  2624. HLINEAPP hLineApp,
  2625. DWORD dwDeviceID,
  2626. DWORD dwAPIVersion,
  2627. LPCSTR lpszAddressIn,
  2628. DWORD dwCard,
  2629. DWORD dwTranslateOptions,
  2630. LPLINETRANSLATEOUTPUT lpTranslateOutput
  2631. )
  2632. {
  2633. LPTAPI_APP_DATA pAppData;
  2634. LONG lResult;
  2635. #ifdef MEMPHIS
  2636. DoFullLoad();
  2637. LoadTAPI32IfNecessary();
  2638. #endif
  2639. if ((pAppData = IsValidXxxApp (hLineApp)))
  2640. {
  2641. lResult = (*pfnCallProc7)(
  2642. (DWORD) pAppData->hXxxApp,
  2643. (DWORD) dwDeviceID,
  2644. (DWORD) dwAPIVersion,
  2645. (DWORD) lpszAddressIn,
  2646. (DWORD) dwCard,
  2647. (DWORD) dwTranslateOptions,
  2648. (DWORD) lpTranslateOutput,
  2649. (LPVOID)gaProcs[lTranslateAddress],
  2650. 0x9,
  2651. 7
  2652. );
  2653. }
  2654. else
  2655. {
  2656. lResult = LINEERR_INVALAPPHANDLE;
  2657. }
  2658. LineResult ("TranslateAddress", lResult);
  2659. return lResult;
  2660. }
  2661. LONG
  2662. WINAPI
  2663. lineTranslateDialog(
  2664. HLINEAPP hLineApp,
  2665. DWORD dwDeviceID,
  2666. DWORD dwAPIVersion,
  2667. HWND hwndOwner,
  2668. LPCSTR lpszAddressIn
  2669. )
  2670. {
  2671. LPTAPI_APP_DATA pAppData;
  2672. LONG lResult;
  2673. #ifdef MEMPHIS
  2674. DoFullLoad();
  2675. LoadTAPI32IfNecessary();
  2676. #endif
  2677. if ((pAppData = IsValidXxxApp (hLineApp)))
  2678. {
  2679. lResult = (*pfnCallProc5)(
  2680. (DWORD) pAppData->hXxxApp,
  2681. (DWORD) dwDeviceID,
  2682. (DWORD) dwAPIVersion,
  2683. (DWORD) (0xffff0000 | hwndOwner),
  2684. (DWORD) lpszAddressIn,
  2685. (LPVOID)gaProcs[lTranslateDialog],
  2686. 0x1,
  2687. 5
  2688. );
  2689. }
  2690. else
  2691. {
  2692. lResult = LINEERR_INVALAPPHANDLE;
  2693. }
  2694. LineResult ("TranslateDialog", lResult);
  2695. return lResult;
  2696. }
  2697. LONG
  2698. WINAPI
  2699. lineUncompleteCall(
  2700. HLINE hLine,
  2701. DWORD dwCompletionID
  2702. )
  2703. {
  2704. LONG lResult = (*pfnCallProc2)(
  2705. (DWORD) hLine,
  2706. (DWORD) dwCompletionID,
  2707. (LPVOID)gaProcs[lUncompleteCall],
  2708. 0x0,
  2709. 2
  2710. );
  2711. LineResult ("UncompleteCall", lResult);
  2712. return lResult;
  2713. }
  2714. LONG
  2715. WINAPI
  2716. lineUnhold(
  2717. HCALL hCall
  2718. )
  2719. {
  2720. LONG lResult = (*pfnCallProc1)(
  2721. (DWORD) hCall,
  2722. (LPVOID)gaProcs[lUnhold],
  2723. 0x0,
  2724. 1
  2725. );
  2726. LineResult ("Unhold", lResult);
  2727. return lResult;
  2728. }
  2729. LONG
  2730. WINAPI
  2731. lineUnpark(
  2732. HLINE hLine,
  2733. DWORD dwAddressID,
  2734. LPHCALL lphCall,
  2735. LPCSTR lpszDestAddress
  2736. )
  2737. {
  2738. //
  2739. // Tapi32.dll will take care of mapping lphCall if/when the
  2740. // request completes successfully, so we don't set the mapping
  2741. // bit down below; do check to see if pointer is valid though.
  2742. //
  2743. LONG lResult;
  2744. if (IsBadWritePtr ((void FAR *) lphCall, sizeof(HCALL)))
  2745. {
  2746. lResult = LINEERR_INVALPOINTER;
  2747. }
  2748. else
  2749. {
  2750. lResult = (*pfnCallProc4)(
  2751. (DWORD) hLine,
  2752. (DWORD) dwAddressID,
  2753. (DWORD) lphCall,
  2754. (DWORD) lpszDestAddress,
  2755. (LPVOID)gaProcs[lUnpark],
  2756. 0x1,
  2757. 4
  2758. );
  2759. }
  2760. LineResult ("Unpark", lResult);
  2761. return lResult;
  2762. }
  2763. LONG
  2764. WINAPI
  2765. phoneClose(
  2766. HPHONE hPhone
  2767. )
  2768. {
  2769. LONG lResult = (*pfnCallProc1)(
  2770. (DWORD) hPhone,
  2771. (LPVOID)gaProcs[pClose],
  2772. 0x0,
  2773. 1
  2774. );
  2775. PhoneResult ("Close", lResult);
  2776. return lResult;
  2777. }
  2778. LONG
  2779. WINAPI
  2780. phoneConfigDialog(
  2781. DWORD dwDeviceID,
  2782. HWND hwndOwner,
  2783. LPCSTR lpszDeviceClass
  2784. )
  2785. {
  2786. LONG lResult;
  2787. #ifdef MEMPHIS
  2788. DoFullLoad();
  2789. LoadTAPI32IfNecessary();
  2790. #endif
  2791. lResult = (*pfnCallProc3)(
  2792. (DWORD) dwDeviceID,
  2793. (DWORD) (0xffff0000 | hwndOwner),
  2794. (DWORD) lpszDeviceClass,
  2795. (LPVOID)gaProcs[pConfigDialog],
  2796. 0x1,
  2797. 3
  2798. );
  2799. PhoneResult ("ConfigDialog", lResult);
  2800. return lResult;
  2801. }
  2802. LONG
  2803. WINAPI
  2804. phoneDevSpecific(
  2805. HPHONE hPhone,
  2806. LPVOID lpParams,
  2807. DWORD dwSize
  2808. )
  2809. {
  2810. LONG lResult;
  2811. if (IsBadWritePtr (lpParams, (UINT) dwSize))
  2812. {
  2813. lResult = PHONEERR_INVALPOINTER;
  2814. }
  2815. else
  2816. {
  2817. lResult = (*pfnCallProc3)(
  2818. (DWORD) hPhone,
  2819. (DWORD) lpParams, // let tapi32.dll map this
  2820. (DWORD) dwSize,
  2821. (LPVOID)gaProcs[pDevSpecific],
  2822. 0x0,
  2823. 3
  2824. );
  2825. }
  2826. PhoneResult ("DevSpecific", lResult);
  2827. return lResult;
  2828. }
  2829. LONG
  2830. WINAPI
  2831. phoneGetButtonInfo(
  2832. HPHONE hPhone,
  2833. DWORD dwButtonLampID,
  2834. LPPHONEBUTTONINFO lpButtonInfo
  2835. )
  2836. {
  2837. LONG lResult = (*pfnCallProc3)(
  2838. (DWORD) hPhone,
  2839. (DWORD) dwButtonLampID,
  2840. (DWORD) lpButtonInfo,
  2841. (LPVOID)gaProcs[pGetButtonInfo],
  2842. 0x1,
  2843. 3
  2844. );
  2845. PhoneResult ("GetButtonInfo", lResult);
  2846. return lResult;
  2847. }
  2848. LONG
  2849. WINAPI
  2850. phoneGetData(
  2851. HPHONE hPhone,
  2852. DWORD dwDataID,
  2853. LPVOID lpData,
  2854. DWORD dwSize
  2855. )
  2856. {
  2857. LONG lResult = (*pfnCallProc4)(
  2858. (DWORD) hPhone,
  2859. (DWORD) dwDataID,
  2860. (DWORD) lpData,
  2861. (DWORD) dwSize,
  2862. (LPVOID)gaProcs[pGetData],
  2863. 0x2,
  2864. 4
  2865. );
  2866. PhoneResult ("GetData", lResult);
  2867. return lResult;
  2868. }
  2869. LONG
  2870. WINAPI
  2871. phoneGetDevCaps(
  2872. HPHONEAPP hPhoneApp,
  2873. DWORD dwDeviceID,
  2874. DWORD dwAPIVersion,
  2875. DWORD dwExtVersion,
  2876. LPPHONECAPS lpPhoneCaps
  2877. )
  2878. {
  2879. LONG lResult;
  2880. LPTAPI_APP_DATA pAppData;
  2881. if ((pAppData = IsValidXxxApp ((HLINEAPP) hPhoneApp)))
  2882. {
  2883. lResult = (*pfnCallProc5)(
  2884. (DWORD) pAppData->hXxxApp,
  2885. (DWORD) dwDeviceID,
  2886. (DWORD) dwAPIVersion,
  2887. (DWORD) dwExtVersion,
  2888. (DWORD) lpPhoneCaps,
  2889. (LPVOID)gaProcs[pGetDevCaps],
  2890. 0x1,
  2891. 5
  2892. );
  2893. }
  2894. else
  2895. {
  2896. lResult = PHONEERR_INVALAPPHANDLE;
  2897. }
  2898. PhoneResult ("GetDevCaps", lResult);
  2899. return lResult;
  2900. }
  2901. LONG
  2902. WINAPI
  2903. phoneGetDisplay(
  2904. HPHONE hPhone,
  2905. LPVARSTRING lpDisplay
  2906. )
  2907. {
  2908. LONG lResult = (*pfnCallProc2)(
  2909. (DWORD) hPhone,
  2910. (DWORD) lpDisplay,
  2911. (LPVOID)gaProcs[pGetDisplay],
  2912. 0x1,
  2913. 2
  2914. );
  2915. PhoneResult ("GetDisplay", lResult);
  2916. return lResult;
  2917. }
  2918. LONG
  2919. WINAPI
  2920. phoneGetGain(
  2921. HPHONE hPhone,
  2922. DWORD dwHookSwitchDev,
  2923. LPDWORD lpdwGain
  2924. )
  2925. {
  2926. LONG lResult = (*pfnCallProc3)(
  2927. (DWORD) hPhone,
  2928. (DWORD) dwHookSwitchDev,
  2929. (DWORD) lpdwGain,
  2930. (LPVOID)gaProcs[pGetGain],
  2931. 0x1,
  2932. 3
  2933. );
  2934. PhoneResult ("GetGain", lResult);
  2935. return lResult;
  2936. }
  2937. LONG
  2938. WINAPI
  2939. phoneGetHookSwitch(
  2940. HPHONE hPhone,
  2941. LPDWORD lpdwHookSwitchDevs
  2942. )
  2943. {
  2944. LONG lResult = (*pfnCallProc2)(
  2945. (DWORD) hPhone,
  2946. (DWORD) lpdwHookSwitchDevs,
  2947. (LPVOID)gaProcs[pGetHookSwitch],
  2948. 0x1,
  2949. 2
  2950. );
  2951. PhoneResult ("GetHookSwitch", lResult);
  2952. return lResult;
  2953. }
  2954. LONG
  2955. WINAPI
  2956. phoneGetIcon(
  2957. DWORD dwDeviceID,
  2958. LPCSTR lpszDeviceClass,
  2959. LPHICON lphIcon
  2960. )
  2961. {
  2962. LONG lResult;
  2963. DWORD hIcon32;
  2964. if (!IsBadWritePtr (lphIcon, sizeof (*lphIcon)))
  2965. {
  2966. #ifdef MEMPHIS
  2967. DoFullLoad();
  2968. LoadTAPI32IfNecessary();
  2969. #endif
  2970. lResult = (*pfnCallProc3)(
  2971. (DWORD) dwDeviceID,
  2972. (DWORD) lpszDeviceClass,
  2973. (DWORD) &hIcon32,
  2974. (LPVOID) gaProcs[pGetIcon],
  2975. 0x3,
  2976. 3
  2977. );
  2978. if (lResult == 0)
  2979. {
  2980. if (!ghIcon)
  2981. {
  2982. MyCreateIcon ();
  2983. }
  2984. *lphIcon = ghIcon;
  2985. }
  2986. }
  2987. else
  2988. {
  2989. lResult = PHONEERR_INVALPOINTER;
  2990. }
  2991. PhoneResult ("GetIcon", lResult);
  2992. return lResult;
  2993. }
  2994. LONG
  2995. WINAPI
  2996. phoneGetID(
  2997. HPHONE hPhone,
  2998. LPVARSTRING lpDeviceID,
  2999. LPCSTR lpszDeviceClass
  3000. )
  3001. {
  3002. LONG lResult = (*pfnCallProc3)(
  3003. (DWORD) hPhone,
  3004. (DWORD) lpDeviceID,
  3005. (DWORD) lpszDeviceClass,
  3006. (LPVOID)gaProcs[pGetID],
  3007. 0x3,
  3008. 3
  3009. );
  3010. PhoneResult ("GetID", lResult);
  3011. return lResult;
  3012. }
  3013. LONG
  3014. WINAPI
  3015. phoneGetLamp(
  3016. HPHONE hPhone,
  3017. DWORD dwButtonLampID,
  3018. LPDWORD lpdwLampMode
  3019. )
  3020. {
  3021. LONG lResult = (*pfnCallProc3)(
  3022. (DWORD) hPhone,
  3023. (DWORD) dwButtonLampID,
  3024. (DWORD) lpdwLampMode,
  3025. (LPVOID)gaProcs[pGetLamp],
  3026. 0x1,
  3027. 3
  3028. );
  3029. PhoneResult ("GetLamp", lResult);
  3030. return lResult;
  3031. }
  3032. LONG
  3033. WINAPI
  3034. phoneGetRing(
  3035. HPHONE hPhone,
  3036. LPDWORD lpdwRingMode,
  3037. LPDWORD lpdwVolume
  3038. )
  3039. {
  3040. LONG lResult = (*pfnCallProc3)(
  3041. (DWORD) hPhone,
  3042. (DWORD) lpdwRingMode,
  3043. (DWORD) lpdwVolume,
  3044. (LPVOID)gaProcs[pGetRing],
  3045. 0x3,
  3046. 3
  3047. );
  3048. PhoneResult ("GetRing", lResult);
  3049. return lResult;
  3050. }
  3051. LONG
  3052. WINAPI
  3053. phoneGetStatus(
  3054. HPHONE hPhone,
  3055. LPPHONESTATUS lpPhoneStatus
  3056. )
  3057. {
  3058. LONG lResult = (*pfnCallProc2)(
  3059. (DWORD) hPhone,
  3060. (DWORD) lpPhoneStatus,
  3061. (LPVOID)gaProcs[pGetStatus],
  3062. 0x1,
  3063. 2
  3064. );
  3065. PhoneResult ("GetStatus", lResult);
  3066. return lResult;
  3067. }
  3068. LONG
  3069. WINAPI
  3070. phoneGetStatusMessages(
  3071. HPHONE hPhone,
  3072. LPDWORD lpdwPhoneStates,
  3073. LPDWORD lpdwButtonModes,
  3074. LPDWORD lpdwButtonStates
  3075. )
  3076. {
  3077. LONG lResult = (*pfnCallProc4)(
  3078. (DWORD) hPhone,
  3079. (DWORD) lpdwPhoneStates,
  3080. (DWORD) lpdwButtonModes,
  3081. (DWORD) lpdwButtonStates,
  3082. (LPVOID)gaProcs[pGetStatusMessages],
  3083. 0x7,
  3084. 4
  3085. );
  3086. PhoneResult ("GetStatusMessages", lResult);
  3087. return lResult;
  3088. }
  3089. LONG
  3090. WINAPI
  3091. phoneGetVolume(
  3092. HPHONE hPhone,
  3093. DWORD dwHookSwitchDev,
  3094. LPDWORD lpdwVolume
  3095. )
  3096. {
  3097. LONG lResult = (*pfnCallProc3)(
  3098. (DWORD) hPhone,
  3099. (DWORD) dwHookSwitchDev,
  3100. (DWORD) lpdwVolume,
  3101. (LPVOID)gaProcs[pGetVolume],
  3102. 0x1,
  3103. 3
  3104. );
  3105. PhoneResult ("GetVolume", lResult);
  3106. return lResult;
  3107. }
  3108. LONG
  3109. WINAPI
  3110. phoneInitialize(
  3111. LPHPHONEAPP lphPhoneApp,
  3112. HINSTANCE hInstance,
  3113. PHONECALLBACK lpfnCallback,
  3114. LPCSTR lpszAppName,
  3115. LPDWORD lpdwNumDevs
  3116. )
  3117. {
  3118. return (xxxInitialize(
  3119. FALSE,
  3120. (LPHLINEAPP) lphPhoneApp,
  3121. hInstance,
  3122. lpfnCallback,
  3123. lpszAppName,
  3124. lpdwNumDevs
  3125. ));
  3126. }
  3127. LONG
  3128. WINAPI
  3129. phoneNegotiateAPIVersion(
  3130. HPHONEAPP hPhoneApp,
  3131. DWORD dwDeviceID,
  3132. DWORD dwAPILowVersion,
  3133. DWORD dwAPIHighVersion,
  3134. LPDWORD lpdwAPIVersion,
  3135. LPPHONEEXTENSIONID lpExtensionID
  3136. )
  3137. {
  3138. LONG lResult;
  3139. LPTAPI_APP_DATA pAppData;
  3140. if ((pAppData = IsValidXxxApp ((HLINEAPP) hPhoneApp)))
  3141. {
  3142. lResult = (*pfnCallProc6)(
  3143. (DWORD) pAppData->hXxxApp,
  3144. (DWORD) dwDeviceID,
  3145. (DWORD) dwAPILowVersion,
  3146. (DWORD) dwAPIHighVersion,
  3147. (DWORD) lpdwAPIVersion,
  3148. (DWORD) lpExtensionID,
  3149. (LPVOID)gaProcs[pNegotiateAPIVersion],
  3150. 0x3,
  3151. 6
  3152. );
  3153. }
  3154. else
  3155. {
  3156. lResult = PHONEERR_INVALAPPHANDLE;
  3157. }
  3158. PhoneResult ("NegotiateAPIVersion", lResult);
  3159. return lResult;
  3160. }
  3161. LONG
  3162. WINAPI
  3163. phoneNegotiateExtVersion(
  3164. HPHONEAPP hPhoneApp,
  3165. DWORD dwDeviceID,
  3166. DWORD dwAPIVersion,
  3167. DWORD dwExtLowVersion,
  3168. DWORD dwExtHighVersion,
  3169. LPDWORD lpdwExtVersion
  3170. )
  3171. {
  3172. LONG lResult;
  3173. LPTAPI_APP_DATA pAppData;
  3174. if ((pAppData = IsValidXxxApp ((HLINEAPP) hPhoneApp)))
  3175. {
  3176. lResult = (*pfnCallProc6)(
  3177. (DWORD) pAppData->hXxxApp,
  3178. (DWORD) dwDeviceID,
  3179. (DWORD) dwAPIVersion,
  3180. (DWORD) dwExtLowVersion,
  3181. (DWORD) dwExtHighVersion,
  3182. (DWORD) lpdwExtVersion,
  3183. (LPVOID)gaProcs[pNegotiateExtVersion],
  3184. 0x1,
  3185. 6
  3186. );
  3187. }
  3188. else
  3189. {
  3190. lResult = PHONEERR_INVALAPPHANDLE;
  3191. }
  3192. PhoneResult ("NegotiateExtVersion", lResult);
  3193. return lResult;
  3194. }
  3195. LONG
  3196. WINAPI
  3197. phoneOpen(
  3198. HPHONEAPP hPhoneApp,
  3199. DWORD dwDeviceID,
  3200. LPHPHONE lphPhone,
  3201. DWORD dwAPIVersion,
  3202. DWORD dwExtVersion,
  3203. DWORD dwCallbackInstance,
  3204. DWORD dwPrivilege
  3205. )
  3206. {
  3207. LONG lResult;
  3208. LPTAPI_APP_DATA pAppData;
  3209. if ((pAppData = IsValidXxxApp ((HLINEAPP) hPhoneApp)))
  3210. {
  3211. lResult = (*pfnCallProc7)(
  3212. (DWORD) pAppData->hXxxApp,
  3213. (DWORD) dwDeviceID,
  3214. (DWORD) lphPhone,
  3215. (DWORD) dwAPIVersion,
  3216. (DWORD) dwExtVersion,
  3217. (DWORD) dwCallbackInstance,
  3218. (DWORD) dwPrivilege,
  3219. (LPVOID)gaProcs[pOpen],
  3220. 0x10,
  3221. 7
  3222. );
  3223. }
  3224. else
  3225. {
  3226. lResult = PHONEERR_INVALAPPHANDLE;
  3227. }
  3228. PhoneResult ("Open", lResult);
  3229. return lResult;
  3230. }
  3231. LONG
  3232. WINAPI
  3233. phoneSetButtonInfo(
  3234. HPHONE hPhone,
  3235. DWORD dwButtonLampID,
  3236. LPPHONEBUTTONINFO const lpButtonInfo
  3237. )
  3238. {
  3239. LONG lResult = (*pfnCallProc3)(
  3240. (DWORD) hPhone,
  3241. (DWORD) dwButtonLampID,
  3242. (DWORD) lpButtonInfo,
  3243. (LPVOID)gaProcs[pSetButtonInfo],
  3244. 0x1,
  3245. 3
  3246. );
  3247. PhoneResult ("SetButtonInfo", lResult);
  3248. return lResult;
  3249. }
  3250. LONG
  3251. WINAPI
  3252. phoneSetData(
  3253. HPHONE hPhone,
  3254. DWORD dwDataID,
  3255. LPVOID const lpData,
  3256. DWORD dwSize
  3257. )
  3258. {
  3259. LONG lResult = (*pfnCallProc4)(
  3260. (DWORD) hPhone,
  3261. (DWORD) dwDataID,
  3262. (DWORD) lpData,
  3263. (DWORD) dwSize,
  3264. (LPVOID)gaProcs[pSetData],
  3265. 0x2,
  3266. 4
  3267. );
  3268. PhoneResult ("SetData", lResult);
  3269. return lResult;
  3270. }
  3271. LONG
  3272. WINAPI
  3273. phoneSetDisplay(
  3274. HPHONE hPhone,
  3275. DWORD dwRow,
  3276. DWORD dwColumn,
  3277. LPCSTR lpsDisplay,
  3278. DWORD dwSize
  3279. )
  3280. {
  3281. LONG lResult = (*pfnCallProc5)(
  3282. (DWORD) hPhone,
  3283. (DWORD) dwRow,
  3284. (DWORD) dwColumn,
  3285. (DWORD) lpsDisplay,
  3286. (DWORD) dwSize,
  3287. (LPVOID)gaProcs[pSetDisplay],
  3288. 0x2,
  3289. 5
  3290. );
  3291. PhoneResult ("SetDisplay", lResult);
  3292. return lResult;
  3293. }
  3294. LONG
  3295. WINAPI
  3296. phoneSetGain(
  3297. HPHONE hPhone,
  3298. DWORD dwHookSwitchDev,
  3299. DWORD dwGain
  3300. )
  3301. {
  3302. LONG lResult = (*pfnCallProc3)(
  3303. (DWORD) hPhone,
  3304. (DWORD) dwHookSwitchDev,
  3305. (DWORD) dwGain,
  3306. (LPVOID)gaProcs[pSetGain],
  3307. 0x0,
  3308. 3
  3309. );
  3310. PhoneResult ("SetGain", lResult);
  3311. return lResult;
  3312. }
  3313. LONG
  3314. WINAPI
  3315. phoneSetHookSwitch(
  3316. HPHONE hPhone,
  3317. DWORD dwHookSwitchDevs,
  3318. DWORD dwHookSwitchMode
  3319. )
  3320. {
  3321. LONG lResult = (*pfnCallProc3)(
  3322. (DWORD) hPhone,
  3323. (DWORD) dwHookSwitchDevs,
  3324. (DWORD) dwHookSwitchMode,
  3325. (LPVOID)gaProcs[pSetHookSwitch],
  3326. 0x0,
  3327. 3
  3328. );
  3329. PhoneResult ("SetHookSwitch", lResult);
  3330. return lResult;
  3331. }
  3332. LONG
  3333. WINAPI
  3334. phoneSetLamp(
  3335. HPHONE hPhone,
  3336. DWORD dwButtonLampID,
  3337. DWORD dwLampMode
  3338. )
  3339. {
  3340. LONG lResult = (*pfnCallProc3)(
  3341. (DWORD) hPhone,
  3342. (DWORD) dwButtonLampID,
  3343. (DWORD) dwLampMode,
  3344. (LPVOID)gaProcs[pSetLamp],
  3345. 0x0,
  3346. 3
  3347. );
  3348. PhoneResult ("SetLamp", lResult);
  3349. return lResult;
  3350. }
  3351. LONG
  3352. WINAPI
  3353. phoneSetRing(
  3354. HPHONE hPhone,
  3355. DWORD dwRingMode,
  3356. DWORD dwVolume
  3357. )
  3358. {
  3359. LONG lResult = (*pfnCallProc3)(
  3360. (DWORD) hPhone,
  3361. (DWORD) dwRingMode,
  3362. (DWORD) dwVolume,
  3363. (LPVOID)gaProcs[pSetRing],
  3364. 0x0,
  3365. 3
  3366. );
  3367. PhoneResult ("SetRing", lResult);
  3368. return lResult;
  3369. }
  3370. LONG
  3371. WINAPI
  3372. phoneSetStatusMessages(
  3373. HPHONE hPhone,
  3374. DWORD dwPhoneStates,
  3375. DWORD dwButtonModes,
  3376. DWORD dwButtonStates
  3377. )
  3378. {
  3379. LONG lResult = (*pfnCallProc4)(
  3380. (DWORD) hPhone,
  3381. (DWORD) dwPhoneStates,
  3382. (DWORD) dwButtonModes,
  3383. (DWORD) dwButtonStates,
  3384. (LPVOID)gaProcs[pSetStatusMessages],
  3385. 0x0,
  3386. 4
  3387. );
  3388. PhoneResult ("SetStatusMessages", lResult);
  3389. return lResult;
  3390. }
  3391. LONG
  3392. WINAPI
  3393. phoneSetVolume(
  3394. HPHONE hPhone,
  3395. DWORD dwHookSwitchDev,
  3396. DWORD dwVolume
  3397. )
  3398. {
  3399. LONG lResult = (*pfnCallProc3)(
  3400. (DWORD) hPhone,
  3401. (DWORD) dwHookSwitchDev,
  3402. (DWORD) dwVolume,
  3403. (LPVOID)gaProcs[pSetVolume],
  3404. 0x0,
  3405. 3
  3406. );
  3407. PhoneResult ("SetVolume", lResult);
  3408. return lResult;
  3409. }
  3410. LONG
  3411. WINAPI
  3412. phoneShutdown(
  3413. HPHONEAPP hPhoneApp
  3414. )
  3415. {
  3416. LONG lResult;
  3417. LPTAPI_APP_DATA pAppData;
  3418. if ((pAppData = IsValidXxxApp ((HLINEAPP) hPhoneApp)))
  3419. {
  3420. if ((lResult = (*pfnCallProc1)(
  3421. (DWORD) pAppData->hXxxApp,
  3422. (LPVOID)gaProcs[pShutdown],
  3423. 0x0,
  3424. 1
  3425. )) == 0)
  3426. {
  3427. //
  3428. // Destroy the associated window & free the app data instance
  3429. //
  3430. DestroyWindow (pAppData->hwnd);
  3431. pAppData->dwKey = 0xefefefef;
  3432. free (pAppData);
  3433. }
  3434. }
  3435. else
  3436. {
  3437. lResult = PHONEERR_INVALAPPHANDLE;
  3438. }
  3439. PhoneResult ("Shutdown", lResult);
  3440. return lResult;
  3441. }
  3442. LONG
  3443. WINAPI
  3444. tapiRequestMakeCall(
  3445. LPCSTR lpszDestAddress,
  3446. LPCSTR lpszAppName,
  3447. LPCSTR lpszCalledParty,
  3448. LPCSTR lpszComment
  3449. )
  3450. {
  3451. LONG lResult;
  3452. #ifdef MEMPHIS
  3453. DoFullLoad();
  3454. LoadTAPI32IfNecessary();
  3455. #endif
  3456. lResult = (*pfnCallProc4)(
  3457. (DWORD) lpszDestAddress,
  3458. (DWORD) lpszAppName,
  3459. (DWORD) lpszCalledParty,
  3460. (DWORD) lpszComment,
  3461. (LPVOID)gaProcs[tRequestMakeCall],
  3462. 0xf,
  3463. 4
  3464. );
  3465. TapiResult ("RequestMakeCall", lResult);
  3466. return lResult;
  3467. }
  3468. LONG
  3469. WINAPI
  3470. tapiRequestMediaCall(
  3471. HWND hWnd,
  3472. WPARAM wRequestID,
  3473. LPCSTR lpszDeviceClass,
  3474. LPCSTR lpDeviceID,
  3475. DWORD dwSize,
  3476. DWORD dwSecure,
  3477. LPCSTR lpszDestAddress,
  3478. LPCSTR lpszAppName,
  3479. LPCSTR lpszCalledParty,
  3480. LPCSTR lpszComment
  3481. )
  3482. {
  3483. LONG lResult;
  3484. #ifdef MEMPHIS
  3485. DoFullLoad();
  3486. LoadTAPI32IfNecessary();
  3487. #endif
  3488. lResult = (*pfnCallProc10)(
  3489. (DWORD) hWnd,
  3490. (DWORD) wRequestID,
  3491. (DWORD) lpszDeviceClass,
  3492. (DWORD) lpDeviceID,
  3493. (DWORD) dwSize,
  3494. (DWORD) dwSecure,
  3495. (DWORD) lpszDestAddress,
  3496. (DWORD) lpszAppName,
  3497. (DWORD) lpszCalledParty,
  3498. (DWORD) lpszComment,
  3499. (LPVOID)gaProcs[tRequestMediaCall],
  3500. 0xcf,
  3501. 10
  3502. );
  3503. TapiResult ("RequestMediaCall", lResult);
  3504. return lResult;
  3505. }
  3506. LONG
  3507. WINAPI
  3508. tapiRequestDrop(
  3509. HWND hWnd,
  3510. WPARAM wRequestID
  3511. )
  3512. {
  3513. LONG lResult;
  3514. #ifdef MEMPHIS
  3515. DoFullLoad();
  3516. LoadTAPI32IfNecessary();
  3517. #endif
  3518. lResult = (*pfnCallProc2)(
  3519. (DWORD) hWnd,
  3520. (DWORD) wRequestID,
  3521. (LPVOID)gaProcs[tRequestDrop],
  3522. 0x0,
  3523. 2
  3524. );
  3525. TapiResult ("Drop", lResult);
  3526. return lResult;
  3527. }
  3528. LONG
  3529. WINAPI
  3530. tapiGetLocationInfo(
  3531. LPSTR lpszCountryCode,
  3532. LPSTR lpszCityCode
  3533. )
  3534. {
  3535. LONG lResult;
  3536. #ifdef MEMPHIS
  3537. DoFullLoad();
  3538. LoadTAPI32IfNecessary();
  3539. #endif
  3540. lResult = (*pfnCallProc2)(
  3541. (DWORD) lpszCountryCode,
  3542. (DWORD) lpszCityCode,
  3543. (LPVOID)gaProcs[tGetLocationInfo],
  3544. 0x3,
  3545. 2
  3546. );
  3547. TapiResult ("GetLocationInfo", lResult);
  3548. return lResult;
  3549. }
  3550. //*******************************************************************************
  3551. //*******************************************************************************
  3552. //*******************************************************************************
  3553. LONG
  3554. WINAPI
  3555. LAddrParamsInited(
  3556. LPDWORD lpdwInited
  3557. )
  3558. {
  3559. LONG lResult;
  3560. #ifdef MEMPHIS
  3561. DoFullLoad();
  3562. LoadTAPI32IfNecessary();
  3563. #endif
  3564. lResult = (*pfnCallProc1)(
  3565. (DWORD)lpdwInited,
  3566. (LPVOID)gaProcs[LAddrParamsInitedVAL],
  3567. 0x1,
  3568. 1
  3569. );
  3570. LineResult ("LAddrParamsInited", lResult);
  3571. return lResult;
  3572. }
  3573. //*******************************************************************************
  3574. //*******************************************************************************
  3575. //*******************************************************************************
  3576. LONG
  3577. WINAPI
  3578. LOpenDialAsst(
  3579. HWND hwnd,
  3580. LPCSTR lpszAddressIn,
  3581. BOOL fSimple,
  3582. BOOL fSilentInstall)
  3583. {
  3584. LONG lResult;
  3585. #ifdef MEMPHIS
  3586. DoFullLoad();
  3587. LoadTAPI32IfNecessary();
  3588. #endif
  3589. lResult = (*pfnCallProc4)(
  3590. hwnd,
  3591. (DWORD)lpszAddressIn,
  3592. fSimple,
  3593. fSilentInstall,
  3594. (LPVOID)gaProcs[LOpenDialAsstVAL],
  3595. 0x4,
  3596. 4
  3597. );
  3598. LineResult ("LOpenDialAsst", lResult);
  3599. return lResult;
  3600. }
  3601. //*******************************************************************************
  3602. //*******************************************************************************
  3603. //*******************************************************************************
  3604. //BOOL CALLBACK EXPORT __loadds LocWizardDlgProc(
  3605. //BOOL CALLBACK LocWizardDlgProc(
  3606. BOOL CALLBACK _loadds LocWizardDlgProc(
  3607. HWND hWnd,
  3608. UINT uMessage,
  3609. WPARAM wParam,
  3610. LPARAM lParam)
  3611. {
  3612. DWORD dwMapFlags = 0;
  3613. DWORD dwNewwParam = wParam;
  3614. LPARAM dwNewlParam = lParam;
  3615. LONG Newnmhdr[3];
  3616. #ifdef MEMPHIS
  3617. DoFullLoad();
  3618. LoadTAPI32IfNecessary();
  3619. #endif
  3620. if (
  3621. ( WM_HELP == uMessage ) ||
  3622. ( WM_NOTIFY == uMessage )
  3623. )
  3624. {
  3625. //
  3626. // For these messages, lParam is a pointer. Let's tell the thunk thing
  3627. // to map it.
  3628. //
  3629. dwMapFlags = 0x1;
  3630. if ( WM_NOTIFY == uMessage )
  3631. {
  3632. //
  3633. // Rebuild for 32bit
  3634. //
  3635. Newnmhdr[0] = (DWORD)(((NMHDR *)lParam)->hwndFrom);
  3636. Newnmhdr[1] = (LONG)((int)((NMHDR *)lParam)->idFrom);
  3637. Newnmhdr[2] = (LONG)((int)((NMHDR *)lParam)->code);
  3638. dwNewlParam = (LPARAM)&Newnmhdr;
  3639. }
  3640. }
  3641. else
  3642. {
  3643. if ( WM_COMMAND == uMessage )
  3644. {
  3645. if (
  3646. (EN_CHANGE == HIWORD(lParam)) ||
  3647. (CBN_SELCHANGE == HIWORD(lParam))
  3648. )
  3649. {
  3650. //
  3651. // Move the command to the new Win32 place, and zero out the old command place
  3652. //
  3653. dwNewwParam |= ( ((DWORD)HIWORD(lParam)) << 16 );
  3654. dwNewlParam &= 0x0000ffff;
  3655. }
  3656. }
  3657. }
  3658. return (BOOL)(*pfnCallProc4)(
  3659. hWnd,
  3660. uMessage,
  3661. dwNewwParam,
  3662. dwNewlParam,
  3663. (LPVOID)gaProcs[LocWizardDlgProc32],
  3664. dwMapFlags,
  3665. 4
  3666. );
  3667. }