Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1402 lines
32 KiB

  1. /* File: D:\WACKER\tdll\sesshdl.c (Created: 01-Dec-1993)
  2. *
  3. * Copyright 1994 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 12 $
  7. * $Date: 7/08/02 6:47p $
  8. */
  9. #include <windows.h>
  10. #pragma hdrstop
  11. #include <time.h>
  12. #include "features.h"
  13. #include "stdtyp.h"
  14. #include "mc.h"
  15. #include "assert.h"
  16. #include "session.h"
  17. #include "session.hh"
  18. #include "sf.h"
  19. #include "backscrl.h"
  20. #include "globals.h"
  21. #include "xfer_msc.h"
  22. #include "file_msc.h"
  23. #include "print.h"
  24. #include "capture.h"
  25. #include "timers.h"
  26. #include "com.h"
  27. #include "cloop.h"
  28. #include "errorbox.h"
  29. #include "tdll.h"
  30. #include "htchar.h"
  31. #include <term\res.h>
  32. #include <emu\emu.h>
  33. #include "update.h"
  34. #include "cnct.h"
  35. #include "statusbr.h"
  36. #include "sess_ids.h"
  37. #include "misc.h"
  38. #include "translat.h"
  39. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  40. * FUNCTION:
  41. * CreateSessionHandle
  42. *
  43. * DESCRIPTION:
  44. * Creates a session handle. Note, hwndSession can be 0 if you need
  45. * to create a stand alone session handle.
  46. *
  47. * ARGUMENTS:
  48. * hwndSession - session window handle (can be 0)
  49. *
  50. * RETURNS:
  51. * Session handle or 0.
  52. *
  53. */
  54. HSESSION CreateSessionHandle(const HWND hwndSession)
  55. {
  56. HHSESSION hhSess;
  57. hhSess = (HHSESSION)malloc(sizeof(*hhSess));
  58. if (hhSess == 0)
  59. {
  60. assert(FALSE);
  61. return 0;
  62. }
  63. memset(hhSess, 0, sizeof(*hhSess));
  64. hhSess->lPrefix = PRE_MAGIC;
  65. hhSess->lPostfix = POST_MAGIC;
  66. InitializeCriticalSection(&hhSess->csSess);
  67. InitializeCriticalSection(&hhSess->csTimerMux);
  68. hhSess->hwndSess = hwndSession;
  69. return (HSESSION)hhSess;
  70. }
  71. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72. * FUNCTION:
  73. * InitializeSessionHandle
  74. *
  75. * DESCRIPTION:
  76. * Does all the dirty work of initilizing the session handle
  77. *
  78. * A special case for this code is when it gets called by the stuff in the
  79. * shell extensions for property sheets. This case can be recognised by the
  80. * fact that the session window handle is NULL, as is the pointer to the
  81. * CREATESTRUCT.
  82. *
  83. * ARGUMENTS:
  84. * hSession - session handle
  85. * hwnd - session window handle
  86. * *pcs - pointer to CREATESTRUCT, passed along from CreateWindowEx().
  87. *
  88. * RETURNS:
  89. * BOOL
  90. *
  91. */
  92. BOOL InitializeSessionHandle(const HSESSION hSession, const HWND hwnd,
  93. const CREATESTRUCT *pcs)
  94. {
  95. const HHSESSION hhSess = VerifySessionHandle(hSession);
  96. TCHAR ach[256], achTitle[100], achFormat[100];
  97. /* --- Any session command data is saved for later --- */
  98. if (pcs)
  99. {
  100. if (pcs->lpCreateParams)
  101. {
  102. // Make sure we don't overrun the buffer. REV: 11/10/2000
  103. //
  104. StrCharCopyN(hhSess->achSessCmdLn, (TCHAR*)pcs->lpCreateParams,
  105. sizeof(hhSess->achSessCmdLn)/sizeof(TCHAR) - 1);
  106. // Make sure the array is NULL terminated. REV: 11/10/2000
  107. //
  108. hhSess->achSessCmdLn[sizeof(hhSess->achSessCmdLn)/sizeof(TCHAR) - 1] = TEXT('\0');
  109. }
  110. }
  111. /* --- Create multiplexed timer --- */
  112. if (hwnd)
  113. {
  114. if (TimerMuxCreate(hwnd, 0, &hhSess->hTimerMux, hSession) != TIMER_OK)
  115. {
  116. assert(FALSE);
  117. return FALSE;
  118. }
  119. /* --- Create status window using a common control --- */
  120. hhSess->hwndStatusbar = sbrCreateSessionStatusbar(hSession);
  121. if (!hhSess->hwndStatusbar)
  122. {
  123. assert(FALSE);
  124. return FALSE;
  125. }
  126. sessSetStatusbarVisible(hSession, TRUE);
  127. /* --- Create a session toolbar --- */
  128. hhSess->hwndToolbar = CreateSessionToolbar(hSession, hwnd);
  129. if (!hhSess->hwndToolbar)
  130. {
  131. assert(FALSE);
  132. return FALSE;
  133. }
  134. sessSetToolbarVisible(hSession, TRUE);
  135. hhSess->hwndSidebar = CreateSidebar(hwnd, hSession);
  136. if (!hhSess->hwndSidebar)
  137. {
  138. assert(FALSE);
  139. return FALSE;
  140. }
  141. }
  142. /* --- Create a Backscroll handle --- */
  143. hhSess->hBackscrl = backscrlCreate(hSession, 250*132);
  144. if (!hhSess->hBackscrl)
  145. {
  146. assert(FALSE);
  147. return FALSE;
  148. }
  149. /* --- Create an Update handle --- */
  150. hhSess->hUpdate = updateCreate(hSession);
  151. if (!hhSess->hUpdate)
  152. {
  153. assert(FALSE);
  154. return FALSE;
  155. }
  156. /* -- Create a CLoop handle --- */
  157. hhSess->hCLoop = CLoopCreateHandle(hSession);
  158. if (!hhSess->hCLoop)
  159. {
  160. assert(FALSE);
  161. return FALSE;
  162. }
  163. /* --- Create an Emulator handle --- */
  164. hhSess->hEmu = emuCreateHdl(hSession);
  165. if (!hhSess->hEmu)
  166. {
  167. assert(FALSE);
  168. return FALSE;
  169. }
  170. /* --- Create a terminal window --- */
  171. if (hwnd)
  172. {
  173. hhSess->hwndTerm = CreateTerminalWindow(hwnd);
  174. if (!hhSess->hwndTerm)
  175. {
  176. assert(FALSE);
  177. return FALSE;
  178. }
  179. }
  180. /* -- Create a Com handle --- */
  181. if (ComCreateHandle(hSession, &hhSess->hCom) != COM_OK)
  182. {
  183. assert(FALSE);
  184. return FALSE;
  185. }
  186. /* --- Create a transfer handle --- */
  187. if (hwnd)
  188. {
  189. hhSess->hXferHdl = CreateXferHdl(hSession);
  190. if (!hhSess->hXferHdl)
  191. {
  192. assert(FALSE);
  193. return FALSE;
  194. }
  195. /* --- Create a Files and Directorys handle --- */
  196. hhSess->hFilesHdl = CreateFilesDirsHdl(hSession);
  197. if (!hhSess->hFilesHdl)
  198. {
  199. assert(FALSE);
  200. return FALSE;
  201. }
  202. }
  203. /* --- Create a session data file handle --- */
  204. hhSess->hSysFile = CreateSysFileHdl();
  205. if (hhSess->hSysFile == 0)
  206. {
  207. assert(FALSE);
  208. return FALSE;
  209. }
  210. /* --- Create a connection handle --- */
  211. hhSess->hCnct = cnctCreateHdl(hSession);
  212. if (hhSess->hCnct == 0)
  213. {
  214. assert(FALSE);
  215. return FALSE;
  216. }
  217. /* --- Create a capture file handle --- */
  218. hhSess->hCaptFile = CreateCaptureFileHandle(hSession);
  219. if (hhSess->hCaptFile == 0)
  220. {
  221. assert(FALSE);
  222. return FALSE;
  223. }
  224. /* --- Create a print handle --- */
  225. hhSess->hPrint = printCreateHdl(hSession);
  226. if (hhSess->hPrint == 0)
  227. {
  228. assert(FALSE);
  229. return FALSE;
  230. }
  231. #if defined(CHARACTER_TRANSLATION)
  232. hhSess->hTranslate = CreateTranslateHandle(hSession);
  233. if (hhSess->hTranslate == NULL)
  234. {
  235. assert(FALSE);
  236. return FALSE;
  237. }
  238. #endif
  239. /* --- Initialize the error message timeout value --- */
  240. hhSess->nTimeout = 0;
  241. /* -- Start the engine --- */
  242. if (hwnd && hhSess->hCLoop)
  243. CLoopActivate(hhSess->hCLoop);
  244. // Set default sound setting...
  245. //
  246. hhSess->fSound = FALSE;
  247. // Set default exit setting...
  248. //
  249. hhSess->fExit = FALSE;
  250. // Set the 'Allow host initiated file transfers' feature
  251. //
  252. hhSess->fAllowHostXfers = FALSE;
  253. // Store some default values in the rcSess...
  254. //
  255. hhSess->rcSess.top = hhSess->rcSess.bottom = 0;
  256. hhSess->rcSess.right = hhSess->rcSess.left = 0;
  257. // Load program icon as session icon, load routine can overwrite this
  258. // to user defined icon.
  259. //
  260. sessInitializeIcons((HSESSION)hhSess);
  261. /* --- Process the command line stuff, if any --- */
  262. // Is this a new connection... i.e., hasn't been saved before.
  263. //
  264. hhSess->fIsNewSession = FALSE;
  265. if (hwnd)
  266. {
  267. // if (StrCharGetStrLength(hhSess->achSessCmdLn) > 0)
  268. if (sessCheckAndLoadCmdLn(hSession) == 0)
  269. {
  270. if (sessLoadSessionStuff(hSession) == FALSE)
  271. {
  272. LoadString(glblQueryDllHinst(), IDS_ER_BAD_SESSION,
  273. achFormat, sizeof(achFormat)/sizeof(TCHAR));
  274. // mrw:10/7/96
  275. //
  276. wsprintf(ach, achFormat, ""); // get rid of %s
  277. LoadString(glblQueryDllHinst(), IDS_MB_TITLE_WARN,
  278. achTitle, sizeof(achTitle)/sizeof(TCHAR));
  279. TimedMessageBox(hwnd, ach, achTitle,
  280. MB_OK | MB_ICONEXCLAMATION, hhSess->nTimeout);
  281. if (ReinitializeSessionHandle(hSession, TRUE) == FALSE)
  282. {
  283. LoadString(glblQueryDllHinst(), IDS_ER_REINIT,
  284. ach, sizeof(ach)/sizeof(TCHAR));
  285. LoadString(glblQueryDllHinst(), IDS_MB_TITLE_ERR,
  286. achTitle, sizeof(achTitle)/sizeof(TCHAR));
  287. TimedMessageBox(hwnd, ach, achTitle,
  288. MB_OK | MB_ICONSTOP, hhSess->nTimeout);
  289. PostQuitMessage(1);
  290. return FALSE;
  291. }
  292. }
  293. emuHomeHostCursor(hhSess->hEmu);
  294. emuEraseTerminalScreen(hhSess->hEmu);
  295. }
  296. if (hhSess->achSessName[0] == TEXT('\0'))
  297. {
  298. ach[0] = TEXT('\0');
  299. LoadString(glblQueryDllHinst(), IDS_GNRL_NEW_CNCT, ach,
  300. sizeof(ach) / sizeof(TCHAR));
  301. StrCharCopyN(hhSess->achSessName, ach, FNAME_LEN + 1);
  302. StrCharCopyN(hhSess->achOldSessName, ach, FNAME_LEN + 1);
  303. hhSess->fIsNewSession = TRUE;
  304. }
  305. sessUpdateAppTitle(hSession);
  306. PostMessage(hwnd, WM_SETICON, (WPARAM)TRUE, (LPARAM)hhSess->hIcon);
  307. /* --- Force status line to update --- */
  308. SendMessage(hhSess->hwndStatusbar, SBR_NTFY_INITIALIZE, 0, 0);
  309. }
  310. return TRUE;
  311. }
  312. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  313. * FUNCTION:
  314. * ReinitializeSessionHandle
  315. *
  316. * DESCRIPTION:
  317. * Calls a bunch of functions to set the session handle back to a known,
  318. * blank state, without having to destroy it.
  319. *
  320. * ARGUMENTS:
  321. * hSession - external session handle.
  322. * fUpdateTitle- reset the app window title if this is TRUE
  323. *
  324. * RETURNS:
  325. */
  326. BOOL ReinitializeSessionHandle(const HSESSION hSession, const int fUpdateTitle)
  327. {
  328. int iRet = 0;
  329. const HHSESSION hhSess = VerifySessionHandle(hSession);
  330. /* --- Reinitialize the X(trans)fer handle --- */
  331. if (InitializeXferHdl(hSession,
  332. sessQueryXferHdl(hSession)) != 0)
  333. {
  334. assert(FALSE);
  335. return FALSE;
  336. }
  337. /* --- Reinitialize the Files and Directorys handle --- */
  338. if (InitializeFilesDirsHdl(hSession,
  339. sessQueryFilesDirsHdl(hSession)) != 0)
  340. {
  341. assert(FALSE);
  342. return FALSE;
  343. }
  344. /* --- Reinitialize the Capture File handle --- */
  345. if (InitializeCaptureFileHandle(hSession,
  346. sessQueryCaptureFileHdl(hSession)) != 0)
  347. {
  348. assert(FALSE);
  349. return FALSE;
  350. }
  351. /* --- Init the connection handle --- */
  352. // NOTE: cnctInit() will return -4 if no modem has ever been installed
  353. // (lineInitialize() returns LINEERR_OPERATIONUNAVAIL) rev:08/05/99.
  354. //
  355. iRet = cnctInit(sessQueryCnctHdl(hSession));
  356. if (iRet != 0 && iRet != -4)
  357. {
  358. assert(FALSE);
  359. return FALSE;
  360. }
  361. /* --- Init the com handle --- */
  362. if (ComInitHdl(sessQueryComHdl(hSession)) != COM_OK)
  363. {
  364. assert(FALSE);
  365. return FALSE;
  366. }
  367. /* --- Create a session data file handle --- */
  368. sfReleaseSessionFile(hhSess->hSysFile);
  369. hhSess->hSysFile = CreateSysFileHdl();
  370. if (hhSess->hSysFile == 0)
  371. {
  372. assert(FALSE);
  373. return FALSE;
  374. }
  375. /* --- Init the cloop handle --- */
  376. if (CLoopInitHdl(sessQueryCLoopHdl(hSession)) != 0)
  377. {
  378. assert(FALSE);
  379. return FALSE;
  380. }
  381. /* --- Reinitialize the Emulator handle --- */
  382. if (emuInitializeHdl(sessQueryEmuHdl(hSession)) != 0)
  383. {
  384. assert(FALSE);
  385. return FALSE;
  386. }
  387. // Home the cursor (different than doing set_curpos(0,0) and
  388. // erase the terminal screen.
  389. //
  390. emuHomeHostCursor(hhSess->hEmu);
  391. emuEraseTerminalScreen(hhSess->hEmu);
  392. /* --- Reinitialize the Print handle --- */
  393. if (printInitializeHdl(sessQueryPrintHdl(hSession)) != 0)
  394. {
  395. assert(FALSE);
  396. return FALSE;
  397. }
  398. #if defined(CHARACTER_TRANSLATION)
  399. if (InitTranslateHandle(sessQueryTranslateHdl(hSession), TRUE) != 0)
  400. {
  401. assert(FALSE);
  402. return FALSE;
  403. }
  404. #endif
  405. /* --- Re-Create a Backscroll handle --- */
  406. // No backscrlInitialize() was written so for now do this...
  407. //
  408. backscrlFlush(hhSess->hBackscrl);
  409. /* --- Initialize the error message timeout value --- */
  410. // hhSess->nTimeout = 30; // initialize to 30 seconds
  411. hhSess->nTimeout = 0; // disable in Lower Wacker
  412. // Set default sound setting...
  413. //
  414. hhSess->fSound = FALSE;
  415. // Set default exit setting...
  416. //
  417. hhSess->fExit = FALSE;
  418. // Set the 'Allow remote initiated file transfers' feature
  419. //
  420. hhSess->fAllowHostXfers = FALSE;
  421. // Load program icon as session icon, load routine can overwrite this
  422. // to user defined icon.
  423. //
  424. sessInitializeIcons((HSESSION)hhSess);
  425. // Zap the command line
  426. //
  427. TCHAR_Fill(hhSess->achSessCmdLn,
  428. TEXT('\0'),
  429. sizeof(hhSess->achSessCmdLn) / sizeof(TCHAR));
  430. // Make this a new connection
  431. //
  432. hhSess->fIsNewSession = TRUE;
  433. TCHAR_Fill(hhSess->achSessName,
  434. TEXT('\0'),
  435. sizeof(hhSess->achSessName) / sizeof(TCHAR));
  436. TCHAR_Fill(hhSess->achOldSessName,
  437. TEXT('\0'),
  438. sizeof(hhSess->achOldSessName) / sizeof(TCHAR));
  439. LoadString(glblQueryDllHinst(),
  440. IDS_GNRL_NEW_CNCT,
  441. hhSess->achSessName,
  442. sizeof(hhSess->achSessName) / sizeof(TCHAR));
  443. StrCharCopyN(hhSess->achOldSessName, hhSess->achSessName, FNAME_LEN + 1);
  444. // Update the title - mrw:6/16/95
  445. //
  446. if (fUpdateTitle)
  447. sessUpdateAppTitle(hSession);
  448. /* --- Force status line to update --- */
  449. PostMessage(hhSess->hwndStatusbar, SBR_NTFY_REFRESH,
  450. (WPARAM)SBR_MAX_PARTS, 0);
  451. // Refresh the terminal window - necessary - mrw:6/16/95
  452. //
  453. SendMessage(hhSess->hwndTerm, WM_SIZE, 0, 0);
  454. return TRUE;
  455. }
  456. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  457. * FUNCTION:
  458. * DestroySessionHandle
  459. *
  460. * DESCRIPTION:
  461. * Destroys the session handle created by CreateSessionHandle.
  462. *
  463. * ARGUMENTS:
  464. * hSession - external session handle.
  465. *
  466. * RETURNS:
  467. * void
  468. *
  469. */
  470. void DestroySessionHandle(const HSESSION hSession)
  471. {
  472. const HHSESSION hhSess = VerifySessionHandle(hSession);
  473. if (hhSess == 0)
  474. return;
  475. if (hhSess->hCLoop)
  476. CLoopDestroyHandle(&hhSess->hCLoop);
  477. if (hhSess->hUpdate)
  478. {
  479. updateDestroy(hhSess->hUpdate);
  480. hhSess->hUpdate = NULL; // REV 8/27/98
  481. }
  482. if (hhSess->hEmu)
  483. {
  484. emuDestroyHdl(hhSess->hEmu);
  485. hhSess->hEmu = NULL;
  486. }
  487. if (hhSess->hBackscrl)
  488. {
  489. backscrlDestroy(hhSess->hBackscrl);
  490. hhSess->hBackscrl = NULL;
  491. }
  492. if (hhSess->hXferHdl)
  493. {
  494. DestroyXferHdl((HXFER)hhSess->hXferHdl);
  495. hhSess->hXferHdl = NULL; // REV 8/27/98
  496. }
  497. if (hhSess->hFilesHdl)
  498. {
  499. DestroyFilesDirsHdl(sessQueryFilesDirsHdl(hSession));
  500. hhSess->hFilesHdl = NULL; // REV 8/27/98
  501. }
  502. if (hhSess->hSysFile)
  503. {
  504. sfCloseSessionFile(hhSess->hSysFile);
  505. hhSess->hSysFile = 0;
  506. }
  507. if (hhSess->hCnct)
  508. {
  509. cnctDestroyHdl(hhSess->hCnct);
  510. hhSess->hCnct = NULL;
  511. }
  512. // ComDestroy must follow cnctDestroy since cnctDestroy does
  513. // a port deactivate. - mrw
  514. //
  515. if (hhSess->hCom)
  516. ComDestroyHandle(&hhSess->hCom);
  517. if (hhSess->hCaptFile)
  518. {
  519. DestroyCaptureFileHandle(hhSess->hCaptFile);
  520. hhSess->hCaptFile = NULL;
  521. }
  522. if (hhSess->hPrint)
  523. {
  524. printDestroyHdl(hhSess->hPrint);
  525. hhSess->hPrint = NULL;
  526. }
  527. #if defined(CHARACTER_TRANSLATION)
  528. if (hhSess->hTranslate)
  529. {
  530. DestroyTranslateHandle(hhSess->hTranslate);
  531. hhSess->hTranslate = NULL;
  532. }
  533. #endif
  534. //
  535. // Make sure to get rid of the TimerMux, otherwise
  536. // there is a memory leak. REV: 12/20/2000
  537. //
  538. if (hhSess->hTimerMux)
  539. {
  540. TimerMuxDestroy(&hhSess->hTimerMux, hSession);
  541. hhSess->hTimerMux = NULL;
  542. }
  543. //
  544. // Set the handle to the statusbar to NULL so we don't
  545. // access the destroyed status bar. REV: 12/20/2000
  546. //
  547. if (hhSess->hwndStatusbar)
  548. {
  549. hhSess->hwndStatusbar = NULL;
  550. }
  551. DeleteCriticalSection(&hhSess->csSess);
  552. DeleteCriticalSection(&hhSess->csTimerMux);
  553. free(hhSess);
  554. }
  555. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  556. * FUNCTION:
  557. * VerifySessionHandle
  558. *
  559. * DESCRIPTION:
  560. * Every session function calls here to verify and get the internal handle.
  561. * Saves having to type this chunk of code and takes less space than
  562. * a macro. We may want to add further checks to verify the handle.
  563. *
  564. *
  565. * ARGUMENTS:
  566. * hSession - external session handle
  567. * fSynchronize - if TRUE, we wait for mutex
  568. *
  569. * RETURNS:
  570. * Internal session handle or zero.
  571. *
  572. */
  573. HHSESSION VerifySessionHandle(const HSESSION hSession)
  574. {
  575. const HHSESSION hhSess = (HHSESSION)hSession;
  576. if (hSession == 0)
  577. {
  578. assert(FALSE);
  579. ExitProcess(1);
  580. }
  581. /* Above mentioned further checks, added by DLW */
  582. assert(hhSess->lPrefix == PRE_MAGIC);
  583. assert(hhSess->lPostfix == POST_MAGIC);
  584. return hhSess;
  585. }
  586. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  587. * FUNCTION:
  588. * hLock
  589. *
  590. * DESCRIPTION:
  591. * Use the function to get ownership of the mutex semaphore for
  592. * synchronized access.
  593. *
  594. * ARGUMENTS:
  595. * hhSess - internal session handle.
  596. *
  597. * RETURNS:
  598. * void
  599. *
  600. */
  601. void hLock(const HHSESSION hhSess)
  602. {
  603. if (hhSess == 0)
  604. {
  605. assert(FALSE);
  606. ExitProcess(1);
  607. }
  608. EnterCriticalSection(&hhSess->csSess);
  609. return;
  610. }
  611. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  612. * FUNCTION:
  613. * hUnlock
  614. *
  615. * DESCRIPTION:
  616. * Releases the mutex semaphore
  617. *
  618. * ARGUMENTS:
  619. * hhSess - internal session handle
  620. *
  621. * RETURNS:
  622. * void
  623. *
  624. */
  625. void hUnlock(const HHSESSION hhSess)
  626. {
  627. if (hhSess == 0)
  628. {
  629. assert(FALSE);
  630. ExitProcess(1);
  631. }
  632. LeaveCriticalSection(&hhSess->csSess);
  633. return;
  634. }
  635. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  636. * FUNCTION:
  637. * hLockTimerMux
  638. *
  639. * DESCRIPTION:
  640. * Use the function to get ownership of the mutex semaphore for
  641. * synchronized access.
  642. *
  643. * ARGUMENTS:
  644. * hhSess - internal session handle.
  645. *
  646. * RETURNS:
  647. * void
  648. *
  649. */
  650. static void hLockTimerMux(const HHSESSION hhSess)
  651. {
  652. if (hhSess == 0)
  653. {
  654. assert(FALSE);
  655. ExitProcess(1);
  656. }
  657. EnterCriticalSection(&hhSess->csTimerMux);
  658. return;
  659. }
  660. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  661. * FUNCTION:
  662. * hUnlockTimerMux
  663. *
  664. * DESCRIPTION:
  665. * Releases the mutex semaphore
  666. *
  667. * ARGUMENTS:
  668. * hhSess - internal session handle
  669. *
  670. * RETURNS:
  671. * void
  672. *
  673. */
  674. static void hUnlockTimerMux(const HHSESSION hhSess)
  675. {
  676. if (hhSess == 0)
  677. {
  678. assert(FALSE);
  679. ExitProcess(1);
  680. }
  681. LeaveCriticalSection(&hhSess->csTimerMux);
  682. return;
  683. }
  684. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  685. HWND sessQueryHwnd(const HSESSION hSession)
  686. {
  687. const HHSESSION hhSess = VerifySessionHandle(hSession);
  688. return hhSess->hwndSess;
  689. }
  690. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  691. HWND sessQueryHwndStatusbar(const HSESSION hSession)
  692. {
  693. const HHSESSION hhSess = VerifySessionHandle(hSession);
  694. return hhSess->hwndStatusbar;
  695. }
  696. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  697. HWND sessQueryHwndToolbar(const HSESSION hSession)
  698. {
  699. const HHSESSION hhSess = VerifySessionHandle(hSession);
  700. return hhSess->hwndToolbar;
  701. }
  702. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  703. HWND sessQueryHwndTerminal(const HSESSION hSession)
  704. {
  705. const HHSESSION hhSess = VerifySessionHandle(hSession);
  706. return hhSess->hwndTerm;
  707. }
  708. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  709. HUPDATE sessQueryUpdateHdl(const HSESSION hSession)
  710. {
  711. const HHSESSION hhSess = VerifySessionHandle(hSession);
  712. return hhSess->hUpdate;
  713. }
  714. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  715. HTIMERMUX sessQueryTimerMux(const HSESSION hSession)
  716. {
  717. HTIMERMUX hTimerMux;
  718. const HHSESSION hhSess = VerifySessionHandle(hSession);
  719. hLockTimerMux(hhSess);
  720. hTimerMux = hhSess->hTimerMux;
  721. return hTimerMux;
  722. }
  723. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  724. VOID sessReleaseTimerMux(const HSESSION hSession)
  725. {
  726. const HHSESSION hhSess = VerifySessionHandle(hSession);
  727. hUnlockTimerMux(hhSess);
  728. return;
  729. }
  730. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  731. HCLOOP sessQueryCLoopHdl(const HSESSION hSession)
  732. {
  733. HCLOOP hCLoop;
  734. const HHSESSION hhSess = VerifySessionHandle(hSession);
  735. hLock(hhSess);
  736. hCLoop = hhSess->hCLoop;
  737. hUnlock(hhSess);
  738. return hCLoop;
  739. }
  740. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  741. HCOM sessQueryComHdl(const HSESSION hSession)
  742. {
  743. HCOM hCom;
  744. const HHSESSION hhSess = VerifySessionHandle(hSession);
  745. hLock(hhSess);
  746. hCom = hhSess->hCom;
  747. hUnlock(hhSess);
  748. return hCom;
  749. }
  750. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  751. HEMU sessQueryEmuHdl(const HSESSION hSession)
  752. {
  753. const HHSESSION hhSess = VerifySessionHandle(hSession);
  754. return hhSess->hEmu;
  755. }
  756. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  757. HPRINT sessQueryPrintHdl(const HSESSION hSession)
  758. {
  759. const HHSESSION hhSess = VerifySessionHandle(hSession);
  760. return hhSess->hPrint;
  761. }
  762. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  763. void sessSetSysFileHdl(const HSESSION hSession, const SF_HANDLE hSF)
  764. {
  765. const HHSESSION hhSess = VerifySessionHandle(hSession);
  766. hLock(hhSess);
  767. hhSess->hSysFile = hSF;
  768. hUnlock(hhSess);
  769. return;
  770. }
  771. SF_HANDLE sessQuerySysFileHdl(const HSESSION hSession)
  772. {
  773. const HHSESSION hhSess = VerifySessionHandle(hSession);
  774. return hhSess->hSysFile;
  775. }
  776. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  777. HBACKSCRL sessQueryBackscrlHdl(const HSESSION hSession)
  778. {
  779. const HHSESSION hhSess = VerifySessionHandle(hSession);
  780. return hhSess->hBackscrl;
  781. }
  782. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  783. HXFER sessQueryXferHdl(const HSESSION hSession)
  784. {
  785. const HHSESSION hhSess = VerifySessionHandle(hSession);
  786. return hhSess->hXferHdl;
  787. }
  788. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  789. HFILES sessQueryFilesDirsHdl(const HSESSION hSession)
  790. {
  791. const HHSESSION hhSess = VerifySessionHandle(hSession);
  792. return hhSess->hFilesHdl;
  793. }
  794. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  795. HCAPTUREFILE sessQueryCaptureFileHdl(const HSESSION hSession)
  796. {
  797. const HHSESSION hhSess = VerifySessionHandle(hSession);
  798. return hhSess->hCaptFile;
  799. }
  800. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  801. void sessQueryCmdLn(const HSESSION hSession, LPTSTR pach, const int len)
  802. {
  803. int i;
  804. const HHSESSION hhSess = VerifySessionHandle(hSession);
  805. TCHAR *pachCmdLn = hhSess->achSessCmdLn;
  806. for (i = 0 ; i < len ; ++i)
  807. {
  808. if (*pachCmdLn == (TCHAR)0)
  809. break;
  810. // *pach++ = *pachCmdLn++;
  811. if (IsDBCSLeadByte(*pachCmdLn))
  812. {
  813. *(WORD *)pach = *(WORD *)pachCmdLn;
  814. }
  815. else
  816. {
  817. *pach = *pachCmdLn;
  818. }
  819. pach = StrCharNext(pach);
  820. pachCmdLn = StrCharNext(pachCmdLn);
  821. }
  822. return;
  823. }
  824. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  825. int sessQueryTimeout(const HSESSION hSession)
  826. {
  827. int nTimeout;
  828. const HHSESSION hhSess = VerifySessionHandle(hSession);
  829. hLock(hhSess);
  830. nTimeout = hhSess->nTimeout;
  831. hUnlock(hhSess);
  832. return nTimeout;
  833. }
  834. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  835. void sessSetTimeout(const HSESSION hSession, int nTimeout)
  836. {
  837. const HHSESSION hhSess = VerifySessionHandle(hSession);
  838. hLock(hhSess);
  839. hhSess->nTimeout = nTimeout;
  840. hUnlock(hhSess);
  841. }
  842. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  843. HCNCT sessQueryCnctHdl(const HSESSION hSession)
  844. {
  845. const HHSESSION hhSess = VerifySessionHandle(hSession);
  846. return hhSess->hCnct;
  847. }
  848. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  849. #if defined(INCL_WINSOCK)
  850. int sessQueryTelnetPort(const HSESSION hSession)
  851. {
  852. const HHSESSION hhSess = VerifySessionHandle(hSession);
  853. return hhSess->iTelnetPort;
  854. }
  855. #endif
  856. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  857. void sessQueryOldName(const HSESSION hSession, const LPTSTR pach, unsigned uSize)
  858. {
  859. const HHSESSION hhSess = VerifySessionHandle(hSession);
  860. if (pach == 0)
  861. return;
  862. pach[0] = TEXT('\0');
  863. /* --- uSize is the number of BYTES in the buffer! ---- */
  864. uSize = min(uSize, sizeof(hhSess->achOldSessName));
  865. if (uSize)
  866. MemCopy(pach, hhSess->achOldSessName, uSize);
  867. pach[uSize-1] = TEXT('\0');
  868. return;
  869. }
  870. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  871. void sessSetIconID(const HSESSION hSession, const int nID)
  872. {
  873. const HHSESSION hhSess = VerifySessionHandle(hSession);
  874. if (hhSess->nIconId != nID)
  875. {
  876. hhSess->nIconId = nID;
  877. hhSess->hIcon = extLoadIcon(MAKEINTRESOURCE(nID));
  878. //hhSess->hIcon = LoadIcon(glblQueryDllHinst(), MAKEINTRESOURCE(nID));
  879. //hhSess->hLittleIcon = LoadIcon(glblQueryDllHinst(),
  880. // MAKEINTRESOURCE(nID + IDI_PROG_ICON_CNT));
  881. }
  882. }
  883. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  884. int sessQueryIconID(const HSESSION hSession)
  885. {
  886. const HHSESSION hhSess = VerifySessionHandle(hSession);
  887. return hhSess->nIconId;
  888. }
  889. HICON sessQueryIcon(const HSESSION hSession)
  890. {
  891. const HHSESSION hhSess = VerifySessionHandle(hSession);
  892. return hhSess->hIcon;
  893. }
  894. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
  895. void sessSetName(const HSESSION hSession, const LPTSTR pach)
  896. {
  897. const HHSESSION hhSess = VerifySessionHandle(hSession);
  898. /* This is here to catch an overrun I can't reproduce. DLW */
  899. #if !defined(NDEBUG)
  900. if (StrCharGetStrLength(pach) > 255)
  901. assert(FALSE);
  902. #endif
  903. StrCharCopyN(hhSess->achSessName, pach, FNAME_LEN + 1);
  904. return;
  905. }
  906. void sessQueryName(const HSESSION hSession, const LPTSTR pach, unsigned uSize)
  907. {
  908. const HHSESSION hhSess = VerifySessionHandle(hSession);
  909. if (pach == 0 || uSize == 0)
  910. return;
  911. pach[0] = TEXT('\0');
  912. /* --- uSize is the number of BYTES in the buffer! ---- */
  913. uSize = min(uSize, sizeof(hhSess->achSessName));
  914. if (uSize)
  915. MemCopy(pach, hhSess->achSessName, uSize);
  916. pach[uSize-1] = TEXT('\0');
  917. return;
  918. }
  919. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
  920. HTRANSLATE sessQueryTranslateHdl(const HSESSION hSession)
  921. {
  922. const HHSESSION hhSess = VerifySessionHandle(hSession);
  923. if (hhSess)
  924. {
  925. return hhSess->hTranslate;
  926. }
  927. else
  928. {
  929. return NULL;
  930. }
  931. }
  932. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  933. * FUNCTION:
  934. * sessQuerySound
  935. *
  936. * DESCRIPTION:
  937. * Return the sound setting for the session.
  938. *
  939. * ARGUMENTS:
  940. * hSession - the session handle.
  941. *
  942. * RETURNS:
  943. * fSound - the sound setting.
  944. */
  945. int sessQuerySound(const HSESSION hSession)
  946. {
  947. const HHSESSION hhSess = VerifySessionHandle(hSession);
  948. return ((int)hhSess->fSound);
  949. }
  950. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  951. * FUNCTION:
  952. * sessSetSound
  953. *
  954. * DESCRIPTION:
  955. * Set the sound setting for the session.
  956. *
  957. * ARGUMENTS:
  958. * hSession - the session handle.
  959. *
  960. * RETURNS:
  961. */
  962. void sessSetSound(const HSESSION hSession, int fSound)
  963. {
  964. const HHSESSION hhSess = VerifySessionHandle(hSession);
  965. hhSess->fSound = fSound;
  966. return;
  967. }
  968. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  969. * FUNCTION:
  970. * sessQueryExit
  971. *
  972. * DESCRIPTION:
  973. * Return the exit setting for the session.
  974. *
  975. * ARGUMENTS:
  976. * hSession - the session handle.
  977. *
  978. * RETURNS:
  979. * fExit - the exit setting.
  980. */
  981. int sessQueryExit(const HSESSION hSession)
  982. {
  983. const HHSESSION hhSess = VerifySessionHandle(hSession);
  984. return ((int)hhSess->fExit);
  985. }
  986. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  987. * FUNCTION:
  988. * sessSetExit
  989. *
  990. * DESCRIPTION:
  991. * Set the exit setting for the session.
  992. *
  993. * ARGUMENTS:
  994. * hSession - the session handle.
  995. *
  996. * RETURNS:
  997. */
  998. void sessSetExit(const HSESSION hSession, int fExit)
  999. {
  1000. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1001. hhSess->fExit = fExit;
  1002. return;
  1003. }
  1004. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1005. * FUNCTION:
  1006. * sessSetIsNewSession
  1007. *
  1008. * DESCRIPTION:
  1009. * Set the fIsNewSession flag.
  1010. *
  1011. * ARGUMENTS:
  1012. * hSession - the session handle.
  1013. * fIsNewSession - set appropriate session structure item to this value.
  1014. *
  1015. * RETURNS:
  1016. */
  1017. void sessSetIsNewSession(const HSESSION hSession, int fIsNewSession)
  1018. {
  1019. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1020. hhSess->fIsNewSession = fIsNewSession;
  1021. return;
  1022. }
  1023. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1024. * FUNCTION:
  1025. * sessQueryIsNewSession
  1026. *
  1027. * DESCRIPTION:
  1028. * Query the setting of fIsNewSession flag.
  1029. *
  1030. * ARGUMENTS:
  1031. * hSession - the session handle.
  1032. *
  1033. * RETURNS:
  1034. */
  1035. int sessQueryIsNewSession(const HSESSION hSession)
  1036. {
  1037. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1038. return ((int)hhSess->fIsNewSession);
  1039. }
  1040. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1041. * FUNCTION:
  1042. * sessIsSessNameDefault
  1043. *
  1044. * DESCRIPTION:
  1045. * Checks to see if the session name is still the default session name
  1046. * or has the user provided us with a custom session name.
  1047. *
  1048. * ARGUMENTS:
  1049. * pacName - session file name.
  1050. *
  1051. * RETURNS:
  1052. *
  1053. */
  1054. BOOL sessIsSessNameDefault(LPTSTR pacName)
  1055. {
  1056. TCHAR ach[FNAME_LEN];
  1057. if (pacName[0] == TEXT('\0'))
  1058. return TRUE;
  1059. TCHAR_Fill(ach, TEXT('\0'), sizeof(ach) / sizeof(TCHAR));
  1060. LoadString(glblQueryDllHinst(), IDS_GNRL_NEW_CNCT, ach,
  1061. sizeof(ach) / sizeof(TCHAR));
  1062. if (StrCharCmp(ach, pacName) == 0)
  1063. return TRUE;
  1064. return FALSE;
  1065. }
  1066. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1067. * FUNCTION:
  1068. * sessQueryWindowRect
  1069. *
  1070. * DESCRIPTION:
  1071. * Query the setting of the session window RECT.
  1072. *
  1073. * ARGUMENTS:
  1074. * hSession - the session handle.
  1075. * prc - pointer to RECT.
  1076. *
  1077. * RETURNS:
  1078. * void.
  1079. */
  1080. void sessQueryWindowRect(const HSESSION hSession, RECT *prc)
  1081. {
  1082. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1083. *prc = hhSess->rcSess; // mrw:3/10/95
  1084. return;
  1085. }
  1086. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1087. * FUNCTION:
  1088. * sessQueryWindowShowCmd
  1089. *
  1090. * DESCRIPTION:
  1091. * Query the setting of the session window show state.
  1092. *
  1093. * ARGUMENTS:
  1094. * hSession - the session handle.
  1095. *
  1096. * RETURNS:
  1097. * void.
  1098. */
  1099. int sessQueryWindowShowCmd(const HSESSION hSession)
  1100. {
  1101. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1102. return ((int)hhSess->iShowCmd);
  1103. }
  1104. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1105. * FUNCTION:
  1106. * sessQuerySidebarHwnd
  1107. *
  1108. * DESCRIPTION:
  1109. * Returns the sidebar window handle
  1110. *
  1111. * ARGUMENTS:
  1112. * hSession - public session handle.
  1113. *
  1114. * RETURNS:
  1115. * Sidebar window handle.
  1116. *
  1117. * AUTHOR: Mike Ward, 10-Mar-1995
  1118. */
  1119. HWND sessQuerySidebarHwnd(const HSESSION hSession)
  1120. {
  1121. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1122. return hhSess->hwndSidebar;
  1123. }
  1124. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1125. * FUNCTION:
  1126. * sessQueryAllowHostXfers
  1127. *
  1128. * DESCRIPTION:
  1129. * Return the exit setting for the session.
  1130. *
  1131. * ARGUMENTS:
  1132. * hSession - the session handle.
  1133. *
  1134. * RETURNS:
  1135. * fAllowHostXfers - the exit setting.
  1136. */
  1137. BOOL sessQueryAllowHostXfers(const HSESSION hSession)
  1138. {
  1139. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1140. return ((BOOL)hhSess->fAllowHostXfers);
  1141. }
  1142. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1143. * FUNCTION:
  1144. * sessSetAllowHostXfers
  1145. *
  1146. * DESCRIPTION:
  1147. * Set the exit setting for the session.
  1148. *
  1149. * ARGUMENTS:
  1150. * hSession - the session handle.
  1151. * fAllowHostXfers - the Allow Host Transfer flag.
  1152. *
  1153. * RETURNS:
  1154. */
  1155. void sessSetAllowHostXfers(const HSESSION hSession, BOOL fAllowHostXfers)
  1156. {
  1157. const HHSESSION hhSess = VerifySessionHandle(hSession);
  1158. hhSess->fAllowHostXfers = fAllowHostXfers;
  1159. return;
  1160. }
  1161. /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */