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.

1299 lines
32 KiB

  1. /*
  2. * Copyright 1994 by Hilgraeve Inc. -- Monroe, MI
  3. * All rights reserved
  4. *
  5. * $Revision: 24 $
  6. * $Date: 7/12/02 12:42p $
  7. */
  8. // #define DEBUGSTR 1
  9. #include <windows.h>
  10. #pragma hdrstop
  11. #include <commctrl.h>
  12. #include <time.h>
  13. #include "stdtyp.h"
  14. #include "assert.h"
  15. #include "globals.h"
  16. #include "session.h"
  17. #include "session.hh"
  18. #include "term.h"
  19. #include "print.h"
  20. #include "cnct.h"
  21. #include "misc.h"
  22. #include "banner.h"
  23. #include "file_msc.h"
  24. #include "errorbox.h"
  25. #include "load_res.h"
  26. #include "sf.h"
  27. #include "cloop.h"
  28. #include "com.h"
  29. #include "timers.h"
  30. #include "capture.h"
  31. #include "xfer_msc.h"
  32. #include <xfer\xfer.h>
  33. #include <term\res.h>
  34. #include <emu\emu.h>
  35. #include <emu\emudlgs.h>
  36. #include "property.h"
  37. #include "htchar.h"
  38. #include "backscrl.h"
  39. //mpt:08-22-97 added HTML help
  40. #if defined(INCL_USE_HTML_HELP)
  41. #include <htmlhelp.h>
  42. #endif
  43. #include "tdll.h"
  44. #include "hlptable.h"
  45. #include "statusbr.h"
  46. //*jcm
  47. #include "open_msc.h"
  48. #include "mc.h"
  49. //*end of jcm
  50. #if defined(TESTMENU) && !defined(NDEBUG)
  51. #include <cncttapi\cncttapi.h>
  52. #endif
  53. #ifdef INCL_KEY_MACROS
  54. #include "keyutil.h"
  55. #endif
  56. #ifdef INCL_NAG_SCREEN
  57. #include "nagdlg.h"
  58. #include "register.h"
  59. #endif
  60. STATIC_FUNC void SP_WM_SIZE(const HWND hwnd, const unsigned fwSizeType,
  61. const int iWidth, const int iHite);
  62. STATIC_FUNC void SP_WM_CREATE(const HWND hwnd, const CREATESTRUCT *pcs);
  63. STATIC_FUNC void SP_WM_DESTROY(const HWND hwnd);
  64. STATIC_FUNC LRESULT SP_WM_CMD(const HWND hwnd, const int nId,
  65. const int nNotify, const HWND hwndCtrl);
  66. STATIC_FUNC void SP_WM_INITMENUPOPUP(const HWND hwnd, const HMENU hMenu,
  67. const UINT uPos, const BOOL fSysMenu);
  68. STATIC_FUNC void SP_WM_CONTEXTMENU(const HWND hwnd);
  69. STATIC_FUNC BOOL SP_WM_CLOSE(const HWND hwnd);
  70. STATIC_FUNC int CheckOpenFile(const HSESSION hSession, ATOM aFile);
  71. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72. * FUNCTION:
  73. * SessProc
  74. *
  75. * DESCRIPTION:
  76. * Main window proc for term
  77. *
  78. */
  79. LRESULT CALLBACK SessProc(HWND hwnd, UINT uMsg, WPARAM wPar, LPARAM lPar)
  80. {
  81. HSESSION hSession;
  82. #if defined(INCL_USE_HTML_HELP)
  83. TCHAR achHtmlFilename[100];
  84. #endif
  85. switch (uMsg)
  86. {
  87. // User pressed F1 key over the session window.
  88. // We also get this message from child windows if they do not process
  89. // it themselves.
  90. //
  91. case WM_HELP:
  92. //#if 0 //mpt:3-10-98 for some reason, using this call causes an access violation
  93. // in HyperTrm.dll. Using the winhelp call gives us the same results.
  94. //mpt:4-30-98 Re-enabled for the NT folks - go figure
  95. #if defined(INCL_USE_HTML_HELP)
  96. LoadString(glblQueryDllHinst(), IDS_HTML_HELPFILE, achHtmlFilename,
  97. sizeof(achHtmlFilename) / sizeof(TCHAR));
  98. HtmlHelp(0, achHtmlFilename, HH_HELP_FINDER, 0); //formely owned by hwnd - mpt
  99. #else
  100. WinHelp(hwnd,
  101. glblQueryHelpFileName(),
  102. HELP_FINDER, // mrw:3/10/95
  103. (DWORD)(LPTSTR)"");
  104. #endif
  105. return 0;
  106. case WM_CREATE:
  107. SP_WM_CREATE(hwnd, (CREATESTRUCT *)lPar);
  108. return 0;
  109. case WM_SIZE:
  110. SP_WM_SIZE(hwnd, (unsigned)wPar, LOWORD(lPar), HIWORD(lPar));
  111. return 0;
  112. case WM_COMMAND:
  113. return SP_WM_CMD(hwnd, LOWORD(wPar), HIWORD(wPar), (HWND)lPar);
  114. case WM_TIMER:
  115. case WM_FAKE_TIMER:
  116. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  117. TimerMuxProc(hSession);
  118. return 0;
  119. case WM_SETFOCUS:
  120. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  121. SetFocus(sessQueryHwndTerminal(hSession));
  122. return 0;
  123. case WM_SYSCOLORCHANGE:
  124. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  125. SendDlgItemMessage(hwnd, IDC_TERMINAL_WIN, uMsg, wPar, lPar);
  126. return 0;
  127. case WM_GETMINMAXINFO:
  128. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  129. sessSetMinMaxInfo(hSession, (PMINMAXINFO)lPar);
  130. return 0;
  131. case WM_CONTEXTMENU:
  132. SP_WM_CONTEXTMENU(hwnd);
  133. return 0;
  134. case WM_INITMENUPOPUP:
  135. SP_WM_INITMENUPOPUP(hwnd, (HMENU)wPar, LOWORD(lPar), HIWORD(lPar));
  136. return 0;
  137. case WM_EXITMENULOOP:
  138. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  139. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  140. (WPARAM)SBR_MAX_PARTS, 0);
  141. break;
  142. case WM_MENUSELECT:
  143. {
  144. TCHAR ach[128];
  145. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  146. if (HIWORD(wPar) & MF_POPUP)
  147. {
  148. SendMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_NOPARTS, 0, (LPARAM)(LPTSTR)"");
  149. return 0;
  150. }
  151. if (LOWORD(wPar))
  152. {
  153. LoadString(glblQueryDllHinst(),
  154. IDM_MENU_BASE+LOWORD(wPar),
  155. ach,
  156. sizeof(ach) / sizeof(TCHAR));
  157. SendMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_NOPARTS, 0, (LPARAM)(LPTSTR)ach);
  158. }
  159. }
  160. return 0;
  161. case WM_PASTE:
  162. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  163. PasteFromClipboardToHost(hwnd, hSession);
  164. return 0;
  165. case WM_DRAWITEM:
  166. if (wPar == IDC_STATUS_WIN)
  167. {
  168. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  169. sbr_WM_DRAWITEM(sessQueryHwndStatusbar(hSession),
  170. (LPDRAWITEMSTRUCT)lPar);
  171. return 1;
  172. }
  173. return 0;
  174. case WM_QUERYENDSESSION:
  175. case WM_CLOSE:
  176. if (!SP_WM_CLOSE(hwnd))
  177. return 0;
  178. break;
  179. case WM_DESTROY:
  180. SP_WM_DESTROY(hwnd);
  181. return 0;
  182. /* --- Public Session Messages --- */
  183. case WM_NOTIFY:
  184. DecodeNotification(hwnd, wPar, lPar);
  185. return 1;
  186. case WM_SESS_NOTIFY:
  187. DecodeSessionNotification(hwnd, (NOTIFICATION)wPar, lPar);
  188. return 1;
  189. case WM_SESS_ENDDLG:
  190. if (IsWindow((HWND)lPar))
  191. {
  192. // I think that this needs to be done in this order.
  193. // Think about it.
  194. DestroyWindow((HWND)lPar);
  195. glblDeleteModelessDlgHwnd((HWND)lPar);
  196. }
  197. return 0;
  198. case WM_CMDLN_DIAL:
  199. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  200. // mrw:4/21/95 by microsoft's request
  201. //if (sessQueryWindowShowCmd(hSession) != SW_SHOWMINIMIZED)
  202. sessCmdLnDial(hSession);
  203. return 0;
  204. case WM_SESS_SIZE_SHOW:
  205. sessSizeAndShow(hwnd, (int)wPar);
  206. return 0;
  207. case WM_CNCT_DIALNOW:
  208. // wPar contains connection flags
  209. //
  210. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  211. cnctConnect(sessQueryCnctHdl(hSession), (unsigned int)wPar);
  212. return 0;
  213. case WM_DISCONNECT:
  214. // wPar contains disconnection flags
  215. //
  216. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  217. cnctDisconnect(sessQueryCnctHdl(hSession), (unsigned int)wPar);
  218. return 0;
  219. case WM_HT_QUERYOPENFILE:
  220. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  221. return CheckOpenFile(hSession, (ATOM)lPar);
  222. case WM_SESS_SHOW_SIDEBAR:
  223. // Autoloads can't do this directly or they hang hypertrm.
  224. //
  225. hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  226. ShowWindow(sessQuerySidebarHwnd(hSession), SW_SHOW);
  227. // Force terminal window to fit
  228. //
  229. SendDlgItemMessage(hwnd, IDC_TERMINAL_WIN, WM_SIZE, 0, 0);
  230. return 0;
  231. case WM_ERROR_MSG:
  232. {
  233. TCHAR ach[128];
  234. LoadString(glblQueryDllHinst(),
  235. (UINT)wPar,
  236. ach,
  237. sizeof(ach)/sizeof(TCHAR));
  238. TimedMessageBox(hwnd, ach, "Message", MB_OK, 0);
  239. }
  240. return 0;
  241. default:
  242. break;
  243. }
  244. return DefWindowProc(hwnd, uMsg, wPar, lPar);
  245. }
  246. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  247. * FUNCTION:
  248. * SP_WM_CMD
  249. *
  250. * DESCRIPTION:
  251. * WM_COMMAND processor for SessProc()
  252. *
  253. * ARGUMENTS:
  254. * hwnd - session window handle
  255. * nId - item, control, or accelerator identifier
  256. * nNotify - notification code
  257. * hwndCtrl - handle of control
  258. *
  259. * RETURNS:
  260. * void
  261. *
  262. */
  263. STATIC_FUNC LRESULT SP_WM_CMD(const HWND hwnd, const int nId, const int nNotify,
  264. const HWND hwndCtrl)
  265. {
  266. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  267. DWORD dwCnt;
  268. void *pv;
  269. LPTSTR pszFileName;
  270. TCHAR ach[100], achList[100], achDir[MAX_PATH];
  271. #if defined(INCL_USE_HTML_HELP)
  272. TCHAR achHtmlFilename[100];
  273. #endif
  274. switch (nId)
  275. {
  276. case IDC_TOOLBAR_WIN:
  277. /* Got a notification from the toolbar */
  278. return ToolbarNotification(hwnd, nId, nNotify, hwndCtrl);
  279. /* --- File Menu --- */
  280. case IDM_NEW:
  281. if (!sessDisconnectToContinue(hSession, hwnd))
  282. break;
  283. if (SaveSession(hSession, hwnd))
  284. {
  285. if (ReinitializeSessionHandle(hSession, TRUE) == FALSE)
  286. break;
  287. cnctConnect(sessQueryCnctHdl(hSession), CNCT_NEW);
  288. }
  289. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  290. (WPARAM)SBR_KEY_PARTS, 0);
  291. break;
  292. case IDM_OPEN:
  293. if (!sessDisconnectToContinue(hSession, hwnd))
  294. break;
  295. // In the OpenSession() we will ask if the user wants to save
  296. // existing opened new session, or save silently, only after the
  297. // user has commited to opening a new one by pressing the OK button.
  298. // -jac. 10-06-94 03:56pm
  299. if (OpenSession(hSession, hwnd) >= 0)
  300. {
  301. PostMessage(sessQueryHwndStatusbar(hSession),
  302. SBR_NTFY_REFRESH, (WPARAM)SBR_MAX_PARTS, 0);
  303. // Run through the connection procedure. This message is
  304. // Posted instead of calling cnctConnect directly to avoid
  305. // a focus problem on the connection dialog. Calling
  306. // cnctConnect from here leaves focus on the terminal screen,
  307. // instead of on the connection dialog, which is where we want it.
  308. //
  309. PostMessage(hwnd, WM_COMMAND, IDM_ACTIONS_DIAL, 0);
  310. }
  311. break;
  312. case IDM_SAVE:
  313. SilentSaveSession(hSession, hwnd, TRUE);
  314. break;
  315. case IDM_SAVE_AS:
  316. SaveAsSession(hSession, hwnd);
  317. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  318. (WPARAM)SBR_KEY_PARTS, 0);
  319. break;
  320. case IDA_CONTEXT_MENU: // SHIFT+F10
  321. SP_WM_CONTEXTMENU(hwnd);
  322. return 0;
  323. case IDM_PAGESETUP:
  324. case IDM_CHOOSEPRINT:
  325. printPageSetup(sessQueryPrintHdl(hSession), hwnd);
  326. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  327. (WPARAM)SBR_KEY_PARTS, 0);
  328. break;
  329. case IDM_PRINT:
  330. case IDM_CONTEXT_PRINT:
  331. printsetSetup(sessQueryPrintHdl(hSession), hwnd);
  332. break;
  333. case IDM_PROPERTIES:
  334. DoInternalProperties(hSession, hwnd);
  335. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  336. (WPARAM)SBR_ALL_PARTS, 0);
  337. break;
  338. case IDM_EXIT:
  339. PostMessage(hwnd, WM_CLOSE, 0, 0);
  340. break;
  341. /* --- Edit Menu --- */
  342. case IDM_SELECT_ALL:
  343. case IDM_CONTEXT_SELECT_ALL:
  344. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_MARK_ALL, 0, 0);
  345. break;
  346. case IDM_PASTE:
  347. case IDM_CONTEXT_PASTE:
  348. SendMessage(hwnd, WM_PASTE, 0, 0L);
  349. break;
  350. case IDM_COPY:
  351. case IDM_CONTEXT_COPY:
  352. if (CopyMarkedTextFromTerminal(hSession, &pv, &dwCnt, TRUE))
  353. {
  354. CopyBufferToClipBoard(hwnd, dwCnt, pv);
  355. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_UNMARK, 0, 0);
  356. free(pv); // free allocated buffer from terminal
  357. pv = NULL;
  358. }
  359. break;
  360. case IDM_CLEAR_BACKSCROLL:
  361. #if defined(INCL_TERMINAL_CLEAR)
  362. case IDM_CONTEXT_CLEAR_BACKSCROLL:
  363. #endif
  364. backscrlFlush(sessQueryBackscrlHdl(hSession));
  365. break;
  366. #if defined(INCL_TERMINAL_CLEAR)
  367. case IDM_CLEAR_SCREEN:
  368. case IDM_CONTEXT_CLEAR_SCREEN:
  369. emuEraseTerminalScreen(sessQueryEmuHdl(hSession));
  370. emuHomeHostCursor(sessQueryEmuHdl(hSession));
  371. NotifyClient(hSession, EVENT_TERM_UPDATE, 0);
  372. RefreshTermWindow(sessQueryHwndTerminal(hSession));
  373. break;
  374. #endif
  375. /* --- View Menu --- */
  376. case IDM_VIEW_TOOLBAR:
  377. sessSetToolbarVisible(hSession,
  378. !sessQueryToolbarVisible(hSession));
  379. SP_WM_SIZE(hwnd, (unsigned)(-1), 0, 0);
  380. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  381. (WPARAM)SBR_MAX_PARTS, 0);
  382. break;
  383. case IDM_VIEW_STATUS:
  384. sessSetStatusbarVisible(hSession,
  385. !sessQueryStatusbarVisible(hSession));
  386. SP_WM_SIZE(hwnd, (unsigned)(-1), 0, 0);
  387. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  388. (WPARAM)SBR_MAX_PARTS, 0);
  389. break;
  390. case IDM_VIEW_FONTS:
  391. DisplayFontDialog(hSession, FALSE);
  392. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  393. (WPARAM)SBR_KEY_PARTS, 0);
  394. break;
  395. case IDM_VIEW_SNAP:
  396. case IDM_CONTEXT_SNAP:
  397. sessSnapToTermWindow(hwnd);
  398. break;
  399. #ifdef INCL_KEY_MACROS
  400. case IDM_KEY_MACROS:
  401. DoDialog(glblQueryDllHinst(),
  402. MAKEINTRESOURCE(IDD_KEYSUMMARYDLG),
  403. hwnd,
  404. KeySummaryDlg,
  405. (LPARAM)hSession);
  406. break;
  407. #endif
  408. /* --- Actions Menu --- */
  409. case IDM_ACTIONS_DIAL:
  410. {
  411. HWND hWnd = sessQueryHwnd(hSession);
  412. cnctConnect(sessQueryCnctHdl(hSession), 0);
  413. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  414. (WPARAM)SBR_KEY_PARTS, 0);
  415. if (hWnd != NULL)
  416. {
  417. PostMessage(hWnd, WM_COMMAND, XFER_CNCT, 0);
  418. }
  419. }
  420. break;
  421. case IDM_ACTIONS_HANGUP:
  422. {
  423. HWND hWnd = sessQueryHwnd(hSession);
  424. //mpt:10-28-97 added exit upon disconnect feature
  425. // REV: 02/16/2001 Added support for canceling file transfers.
  426. int iDisconnectStatus =
  427. cnctDisconnect(sessQueryCnctHdl(hSession),
  428. sessQueryExit(hSession) ? DISCNCT_EXIT | CNCT_XFERABORTCONFIRM : CNCT_XFERABORTCONFIRM);
  429. if (hWnd != NULL && iDisconnectStatus != CNCT_IN_DISCONNECT)
  430. {
  431. PostMessage(hWnd, WM_COMMAND, XFER_CNCT, 0);
  432. }
  433. }
  434. break;
  435. case IDM_ACTIONS_SEND:
  436. case IDM_CONTEXT_SEND:
  437. DoDialog(glblQueryDllHinst(),
  438. MAKEINTRESOURCE(IDD_TRANSFERSEND),
  439. hwnd, /* parent window */
  440. TransferSendDlg,
  441. (LPARAM)hSession);
  442. break;
  443. case IDM_ACTIONS_RCV:
  444. case IDM_CONTEXT_RECEIVE:
  445. /*
  446. * This will probably need to be modeless later.
  447. * Maybe only for Upper Wacker.
  448. */
  449. DoDialog(glblQueryDllHinst(),
  450. MAKEINTRESOURCE(IDD_TRANSFERRECEIVE),
  451. hwnd,
  452. TransferReceiveDlg,
  453. (LPARAM)hSession);
  454. break;
  455. case IDM_ACTIONS_CAP:
  456. DoDialog(glblQueryDllHinst(),
  457. MAKEINTRESOURCE(IDD_CAPTURE),
  458. hwnd,
  459. CaptureFileDlg,
  460. (LPARAM)hSession);
  461. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  462. (WPARAM)SBR_CAPT_PART_NO, 0);
  463. break;
  464. case IDM_CAPTURE_STOP:
  465. cpfSetCaptureState(sessQueryCaptureFileHdl(hSession),
  466. CPF_CAPTURE_OFF);
  467. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  468. (WPARAM)SBR_CAPT_PART_NO, 0);
  469. break;
  470. case IDM_CAPTURE_PAUSE:
  471. cpfSetCaptureState(sessQueryCaptureFileHdl(hSession),
  472. CPF_CAPTURE_PAUSE);
  473. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  474. (WPARAM)SBR_CAPT_PART_NO, 0);
  475. break;
  476. case IDM_CAPTURE_RESUME:
  477. cpfSetCaptureState(sessQueryCaptureFileHdl(hSession),
  478. CPF_CAPTURE_ON);
  479. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  480. (WPARAM)SBR_CAPT_PART_NO, 0);
  481. break;
  482. case IDM_ACTIONS_SEND_TEXT:
  483. LoadString(glblQueryDllHinst(), IDS_SND_TXT_FILE, ach,
  484. sizeof(ach)/sizeof(TCHAR));
  485. resLoadFileMask(glblQueryDllHinst(), IDS_CPF_FILES1, 2, achList,
  486. sizeof(achList) / sizeof(TCHAR));
  487. //Changed to use working folder rather than current folder - mpt 8-18-99
  488. if ( !GetWorkingDirectory( achDir, sizeof(achDir) / sizeof(TCHAR)) )
  489. {
  490. GetCurrentDirectory(sizeof(achDir) / sizeof(TCHAR), achDir);
  491. }
  492. pszFileName = gnrcFindFileDialog(hwnd, ach, achDir, achList);
  493. if (pszFileName)
  494. {
  495. CLoopSendTextFile(sessQueryCLoopHdl(hSession), pszFileName);
  496. free(pszFileName);
  497. pszFileName = NULL;
  498. }
  499. break;
  500. case IDM_ACTIONS_PRINT:
  501. if (!printQueryStatus(emuQueryPrintEchoHdl(sessQueryEmuHdl(hSession))))
  502. {
  503. if (printVerifyPrinter(sessQueryPrintHdl(hSession)) == -1)
  504. break;
  505. }
  506. else
  507. {
  508. printEchoClose(emuQueryPrintEchoHdl(sessQueryEmuHdl(hSession)));
  509. }
  510. printStatusToggle(emuQueryPrintEchoHdl(sessQueryEmuHdl(hSession)));
  511. PostMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_REFRESH,
  512. (WPARAM)SBR_PRNE_PART_NO, 0);
  513. break;
  514. case IDM_ACTIONS_WAIT_FOR_CALL:
  515. cnctConnect(sessQueryCnctHdl(hSession), CNCT_ANSWER);
  516. break;
  517. case IDM_ACTIONS_STOP_WAITING:
  518. cnctDisconnect(sessQueryCnctHdl(hSession), DISCNCT_NOBEEP);
  519. break;
  520. /* --- Help Menu --- */
  521. case IDM_HELPTOPICS:
  522. //#if 0 //mpt:3-10-98 for some reason, using this call causes an access violation
  523. // in HyperTrm.dll. Using the winhelp call gives us the same results.
  524. //mpt:4-30-98 Re-enabled for the NT folks - go figure
  525. #if defined(INCL_USE_HTML_HELP)
  526. LoadString(glblQueryDllHinst(), IDS_HTML_HELPFILE, achHtmlFilename,
  527. sizeof(achHtmlFilename) / sizeof(TCHAR));
  528. HtmlHelp(0, achHtmlFilename, HH_HELP_FINDER, 0);
  529. #else
  530. WinHelp(hwnd,
  531. glblQueryHelpFileName(),
  532. HELP_FINDER, // mrw:3/10/95
  533. (DWORD)(LPTSTR)"");
  534. #endif
  535. break;
  536. #if defined(INCL_NAG_SCREEN)
  537. case IDM_PURCHASE_INFO:
  538. DoUpgradeDlg(hwnd);
  539. break;
  540. case IDM_REG_CODE:
  541. DoRegisterDlg(hwnd);
  542. break;
  543. case IDM_REGISTER:
  544. DoRegister();
  545. break;
  546. case IDM_DISCUSSION:
  547. ShellExecute(NULL, "open", TEXT("http://www.hilgraeve.com/discuss"), NULL, NULL, SW_SHOW);
  548. break;
  549. #endif
  550. case IDM_ABOUT:
  551. AboutDlg(hwnd);
  552. break;
  553. /* --- Session Context Menu --- */
  554. // Other context menu items are placed with their main menu
  555. // equivalents.
  556. #if 0 // mrw, 1/27/95
  557. case IDM_CONTEXT_WHATS_THIS:
  558. WinHelp(hwnd, glblQueryHelpFileName(), HELP_CONTEXTPOPUP,
  559. (DWORD)(LPTSTR)IDH_TERM_CONTEXT_WHATS_THIS);
  560. break;
  561. #endif
  562. #if defined(TESTMENU) && !defined(NDEBUG)
  563. /* --- Test Menu --- */
  564. case IDM_TEST_SAVEAS:
  565. SaveAsSession(hSession, hwnd);
  566. break;
  567. case IDM_TEST_CLEARTERM:
  568. break;
  569. case IDM_TEST_CLEARBACK:
  570. break;
  571. case IDM_TEST_SELECTTERM:
  572. break;
  573. case IDM_TEST_SELECTBACK:
  574. break;
  575. case IDM_TEST_TESTFILE:
  576. {
  577. pszFileName = 0;
  578. pszFileName = gnrcFindFileDialog(hwnd,
  579. "Emulator test file",
  580. "D:\\WACKER",
  581. "Text files\0*.TXT\0Ansi files\0*.ans\0VT100 files\0*.100");
  582. if (pszFileName)
  583. {
  584. CLoopSendTextFile(sessQueryCLoopHdl(hSession), pszFileName);
  585. free(pszFileName);
  586. pszFileName = NULL;
  587. }
  588. }
  589. break;
  590. case IDM_TEST_BEZEL:
  591. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_BEZEL, 0, 0);
  592. break;
  593. case IDM_TEST_SNAP:
  594. sessSnapToTermWindow(hwnd);
  595. break;
  596. case IDM_TEST_NEW_CONNECTION:
  597. DoDialog(glblQueryDllHinst(),
  598. MAKEINTRESOURCE(IDD_NEWCONNECTION),
  599. hwnd,
  600. NewConnectionDlg,
  601. (LPARAM)hSession);
  602. break;
  603. case IDM_TEST_FLUSH_BACKSCRL:
  604. backscrlFlush(sessQueryBackscrlHdl(hSession));
  605. break;
  606. case IDM_TEST_LOAD_ANSI:
  607. emuLoad(sessQueryEmuHdl(hSession), EMU_ANSI);
  608. break;
  609. case IDM_TEST_LOAD_MINITEL:
  610. emuLoad(sessQueryEmuHdl(hSession), EMU_MINI);
  611. break;
  612. case IDM_TEST_LOAD_VIEWDATA:
  613. emuLoad(sessQueryEmuHdl(hSession), EMU_VIEW);
  614. break;
  615. case IDM_TEST_LOAD_AUTO:
  616. emuLoad(sessQueryEmuHdl(hSession), EMU_AUTO);
  617. break;
  618. case IDM_TEST_LOAD_TTY:
  619. emuLoad(sessQueryEmuHdl(hSession), EMU_TTY);
  620. break;
  621. case IDM_TEST_LOAD_VT52:
  622. emuLoad(sessQueryEmuHdl(hSession), EMU_VT52);
  623. break;
  624. case IDM_TEST_LOAD_VT100:
  625. emuLoad(sessQueryEmuHdl(hSession), EMU_VT100);
  626. break;
  627. #if defined(INCL_VT220)
  628. case IDM_TEST_LOAD_VT220:
  629. emuLoad(sessQueryEmuHdl(hSession), EMU_VT220);
  630. break;
  631. #endif
  632. #if defined(INCL_VT320)
  633. case IDM_TEST_LOAD_VT320:
  634. emuLoad(sessQueryEmuHdl(hSession), EMU_VT320);
  635. break;
  636. #endif
  637. #if defined(INCL_VT100PLUS)
  638. case IDM_TEST_LOAD_VT100PLUS:
  639. emuLoad(sessQueryEmuHdl(hSession), EMU_VT100PLUS);
  640. break;
  641. #endif
  642. #if defined(INCL_VTUTF8)
  643. case IDM_TEST_LOAD_VTUTF8:
  644. emuLoad(sessQueryEmuHdl(hSession), EMU_VTUTF8);
  645. break;
  646. #endif
  647. case IDM_TEST_SESSNAME:
  648. {
  649. TCHAR ach[FNAME_LEN];
  650. sessQueryName(hSession, ach, FNAME_LEN);
  651. TimedMessageBox(hwnd, ach, "Message", MB_OK, 0);
  652. }
  653. break;
  654. #endif
  655. default:
  656. break;
  657. }
  658. return 0;
  659. }
  660. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  661. * FUNCTION:
  662. * SP_WM_CREATE
  663. *
  664. * DESCRIPTION:
  665. * Does the WM_CREATE stuff for the frameproc window.
  666. *
  667. * ARGUMENTS:
  668. * hwnd - frame window handle.
  669. * *pcs - pointer to CREATESTRUCT, structure passed from CreateWindowEx().
  670. *
  671. * RETURNS:
  672. * void
  673. *
  674. */
  675. STATIC_FUNC void SP_WM_CREATE(const HWND hwnd, const CREATESTRUCT *pcs)
  676. {
  677. HSESSION hSession;
  678. hSession = CreateSessionHandle(hwnd);
  679. // Need to set even if hSession is zero so the destroy handle routine
  680. // does not try to destroy a non-handle.
  681. SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hSession);
  682. if (hSession == 0)
  683. {
  684. assert(FALSE);
  685. PostMessage(hwnd, WM_CLOSE, 0, 0);
  686. return;
  687. }
  688. if (InitializeSessionHandle(hSession, hwnd, pcs) == FALSE)
  689. {
  690. assert(FALSE);
  691. PostMessage(hwnd, WM_CLOSE, 0, 0);
  692. return;
  693. }
  694. if (glblQueryProgramStatus())
  695. {
  696. /* Something has shut use down, don't continue */
  697. return;
  698. }
  699. // mrw, 1/27/95 SetWindowContextHelpId(hwnd, IDH_TERM_WINDOW);
  700. return;
  701. }
  702. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  703. * FUNCTION:
  704. * SP_WM_DESTROY
  705. *
  706. * DESCRIPTION:
  707. * WM_DESTROY message processor for session window.
  708. *
  709. * ARGUMENTS:
  710. * hwnd - session window handle.
  711. *
  712. * RETURNS:
  713. * void
  714. *
  715. */
  716. STATIC_FUNC void SP_WM_DESTROY(const HWND hwnd)
  717. {
  718. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  719. if (GetFileSizeFromName(glblQueryHelpFileName(), NULL))
  720. WinHelp(hwnd, glblQueryHelpFileName(), HELP_QUIT, 0L);
  721. // It appears that our subclassed statusbar window doesn't get the
  722. // WM_DESTROY message when its parent, the session window, is getting
  723. // destroyed, so we force it...
  724. //
  725. DestroyWindow(sessQueryHwndStatusbar(hSession));
  726. if (hSession)
  727. DestroySessionHandle(hSession);
  728. PostQuitMessage(0);
  729. return;
  730. }
  731. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  732. * FUNCTION:
  733. * SP_WM_SIZE
  734. *
  735. * DESCRIPTION:
  736. * WM_SIZE message processor for sessproc.
  737. *
  738. * ARGUMENTS:
  739. * hwnd - session window
  740. * fwSizeType - from WM_SIZE
  741. * iWidth - width of window
  742. * iHige - hite of window
  743. *
  744. * RETURNS:
  745. * void
  746. *
  747. */
  748. STATIC_FUNC void SP_WM_SIZE(const HWND hwnd,
  749. const unsigned fwSizeType,
  750. const int iWidth,
  751. const int iHite)
  752. {
  753. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  754. HWND hwndDisplay;
  755. // DbgOutStr("WM_SIZE %d (%d x %d)\r\n", fwSizeType, iWidth, iHite, 0,0);
  756. /*
  757. * We need a bunch of fiddling around for the transfer display
  758. */
  759. if (hSession)
  760. {
  761. hwndDisplay = xfrGetDisplayWindow(sessQueryXferHdl(hSession));
  762. if (IsWindow(hwndDisplay))
  763. {
  764. switch (fwSizeType)
  765. {
  766. case SIZE_MINIMIZED:
  767. case SIZE_MAXHIDE:
  768. // DbgOutStr("Iconic\r\n", 0,0,0,0,0);
  769. if (IsWindowVisible(hwndDisplay))
  770. ShowWindow(hwndDisplay, SW_HIDE);
  771. break;
  772. case SIZE_MAXIMIZED:
  773. case SIZE_RESTORED:
  774. case SIZE_MAXSHOW:
  775. if (!IsWindowVisible(hwndDisplay))
  776. ShowWindow(hwndDisplay, SW_SHOWDEFAULT);
  777. break;
  778. default:
  779. break;
  780. }
  781. }
  782. }
  783. SendDlgItemMessage(hwnd, IDC_STATUS_WIN, WM_SIZE, 0, 0);
  784. SendDlgItemMessage(hwnd, IDC_TOOLBAR_WIN, WM_SIZE, 0, 0);
  785. SendDlgItemMessage(hwnd, IDC_TERMINAL_WIN, WM_SIZE, 0, 0);
  786. SendDlgItemMessage(hwnd, IDC_SIDEBAR_WIN, WM_SIZE, 0, 0);
  787. return;
  788. }
  789. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  790. * FUNCTION:
  791. * SP_WM_INITMENUPOPUP
  792. *
  793. * DESCRIPTION:
  794. * WM_INITMENUPOPUP message handler for session window.
  795. *
  796. * ARGUMENTS:
  797. * hwnd - session window handle
  798. * hMenu - menu handle of popup
  799. * uPos - position of menu item that invoked popup
  800. * fSysMenu- TRUE if system menu popup
  801. *
  802. * RETURNS:
  803. * void
  804. *
  805. */
  806. STATIC_FUNC void SP_WM_INITMENUPOPUP(const HWND hwnd, const HMENU hMenu,
  807. const UINT uPos, const BOOL fSysMenu)
  808. {
  809. HMENU hWinMenu;
  810. int nOK, nIdx;
  811. TCHAR ach[50];
  812. // Popup menus are referenced by position since id's can't be assigned
  813. // (grrrrr!). Actual menu init functions are in sessmenu.c
  814. #define MENU_FILE_POS 0
  815. #define MENU_EDIT_POS 1
  816. #define MENU_VIEW_POS 2
  817. #define MENU_CALL_POS 3
  818. #define MENU_TRANSFER_POS 4
  819. #define MENU_HELP_POS 5
  820. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  821. // Display help for top menu item.
  822. // I suppose we will have to be read from the resource file once we know
  823. // what the strings and their ids are.
  824. //
  825. LoadString(glblQueryDllHinst(),
  826. IDM_MENU_BASE+uPos,
  827. ach,
  828. sizeof(ach) / sizeof(TCHAR));
  829. //wsprintf(ach, "Help for menu item %d\0", uPos);
  830. SendMessage(sessQueryHwndStatusbar(hSession), SBR_NTFY_NOPARTS, 0, (LPARAM)(LPTSTR)ach);
  831. if (fSysMenu)
  832. return;
  833. /*
  834. * This makes sure we only handle top level menu items here.
  835. *
  836. * The problem is that secondary popup menus also cause a WM_INITPOPUP
  837. * message to get sent. The only way to tell one of these messages from
  838. * another is to check the menu handle. As MRW alluded to above, this
  839. * would be less of a problem if they did this stuff with IDs instead of
  840. * offsets.
  841. */
  842. hWinMenu = GetMenu(hwnd);
  843. nOK = FALSE;
  844. for (nIdx = 0; nIdx <= MENU_HELP_POS; nIdx += 1)
  845. {
  846. if (hMenu == GetSubMenu(hWinMenu, nIdx))
  847. nOK = TRUE;
  848. }
  849. if (!nOK)
  850. return;
  851. /* --- Ok, its a top-level menu, let's have at it --- */
  852. switch (uPos)
  853. {
  854. case MENU_FILE_POS:
  855. break;
  856. case MENU_EDIT_POS:
  857. sessInitMenuPopupEdit(hSession, hMenu);
  858. break;
  859. case MENU_VIEW_POS:
  860. sessInitMenuPopupView(hSession, hMenu);
  861. break;
  862. case MENU_CALL_POS:
  863. sessInitMenuPopupCall(hSession, hMenu);
  864. break;
  865. case MENU_TRANSFER_POS:
  866. sessInitMenuPopupTransfer(hSession, hMenu);
  867. break;
  868. case MENU_HELP_POS:
  869. sessInitMenuPopupHelp(hSession, hMenu);
  870. break;
  871. default:
  872. break;
  873. }
  874. return;
  875. }
  876. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  877. * FUNCTION:
  878. * DecodeSessionNotification
  879. *
  880. * DESCRIPTION:
  881. * Receives a NotifyClient event and routes the notification.
  882. *
  883. * ARGUMENTS:
  884. * hwndSession - session window handle
  885. * nEvent - notification event
  886. * lExtra - additional data to pass
  887. *
  888. * RETURNS:
  889. * void
  890. *
  891. */
  892. void DecodeSessionNotification(const HWND hwndSession,
  893. const NOTIFICATION nEvent,
  894. const LPARAM lExtra)
  895. {
  896. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwndSession,
  897. GWLP_USERDATA);
  898. switch (nEvent) /*lint -e787 -e788 */
  899. {
  900. case EVENT_TERM_UPDATE:
  901. // This message must be sent, not posted so initialization
  902. // at program startup works - mrw
  903. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_GETUPDATE, 0, 0);
  904. break;
  905. case EVENT_TERM_TRACK:
  906. PostMessage(sessQueryHwndTerminal(hSession), WM_TERM_TRACK, 0, 0);
  907. break;
  908. case EVENT_EMU_CLRATTR:
  909. // This message must be sent, not posted so initialization
  910. // at program startup works - mrw
  911. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_CLRATTR, 0, 0);
  912. break;
  913. case EVENT_EMU_SETTINGS:
  914. // This message must be sent, not posted so initialization
  915. // at program startup works - mrw
  916. SendMessage(sessQueryHwndTerminal(hSession), WM_TERM_EMU_SETTINGS, 0, 0);
  917. break;
  918. case EVENT_CONNECTION_OPENED:
  919. //cnctMessage(sessQueryCnctHdl(hSession), IDS_CNCT_OPEN);
  920. emuNotify(sessQueryEmuHdl(hSession), EMU_EVENT_CONNECTED);
  921. cnctSetStartTime(sessQueryCnctHdl(hSession));
  922. CLoopControl(sessQueryCLoopHdl(hSession), CLOOP_SET, CLOOP_CONNECTED);
  923. break;
  924. case EVENT_CONNECTION_INPROGRESS:
  925. emuNotify(sessQueryEmuHdl(hSession), EMU_EVENT_CONNECTING);
  926. break;
  927. case EVENT_CONNECTION_CLOSED:
  928. //cnctMessage(sessQueryCnctHdl(hSession), IDS_CNCT_CLOSE);
  929. emuNotify(sessQueryEmuHdl(hSession), EMU_EVENT_DISCONNECTED);
  930. CLoopControl(sessQueryCLoopHdl(hSession), CLOOP_CLEAR, CLOOP_CONNECTED);
  931. break;
  932. case EVENT_HOST_XFER_REQ:
  933. xfrDoAutostart(sessQueryXferHdl(hSession), (long)lExtra);
  934. break;
  935. case EVENT_CLOOP_SEND:
  936. PostMessage(sessQueryHwndTerminal(hSession), WM_TERM_TRACK,
  937. (WPARAM)1, 0);
  938. break;
  939. case EVENT_PORTONLY_OPEN:
  940. cnctConnect(sessQueryCnctHdl(hSession), CNCT_PORTONLY);
  941. break;
  942. case EVENT_LOST_CONNECTION:
  943. cnctDisconnect(sessQueryCnctHdl(hSession),
  944. (unsigned int)(lExtra) | CNCT_LOSTCARRIER);
  945. break;
  946. default:
  947. break;
  948. } /*lint +e787 +e788 */
  949. return;
  950. }
  951. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  952. * FUNCTION:
  953. * DecodeNotification
  954. *
  955. * DESCRIPTION:
  956. * Receives a NotifyClient event and routes the notification.
  957. *
  958. * ARGUMENTS:
  959. * hwndSession - session window handle
  960. * wPar - standard wPar to window proc
  961. * lPar - standard lPar to window proc, points to NMHDR structure for
  962. * details of notification. See WM_NOTIFY.
  963. *
  964. * RETURNS:
  965. * void
  966. *
  967. */
  968. void DecodeNotification(const HWND hwndSession, WPARAM wPar, LPARAM lPar)
  969. {
  970. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwndSession, GWLP_USERDATA);
  971. NMHDR *pN = (NMHDR *)lPar;
  972. switch (pN->code) /*lint -e787 -e788 */
  973. {
  974. case TTN_NEEDTEXT:
  975. ToolbarNeedsText(hSession, lPar);
  976. break;
  977. default:
  978. break;
  979. } /*lint +e787 +e788 */
  980. return;
  981. }
  982. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  983. * FUNCTION:
  984. * SP_WM_CONTEXTMENU
  985. *
  986. * DESCRIPTION:
  987. * WM_CONTEXTMENU message handler for session window.
  988. *
  989. * ARGUMENTS:
  990. *
  991. * RETURNS:
  992. */
  993. STATIC_FUNC void SP_WM_CONTEXTMENU(const HWND hwnd)
  994. {
  995. RECT rc;
  996. POINT pt;
  997. HWND hwndToolbar, hwndStatus;
  998. const HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  999. GetCursorPos((LPPOINT)&pt);
  1000. hwndToolbar = sessQueryHwndToolbar(hSession);
  1001. if (IsWindowVisible(hwndToolbar))
  1002. {
  1003. GetClientRect(hwndToolbar, (LPRECT)&rc);
  1004. ScreenToClient(hwndToolbar, (LPPOINT)&pt);
  1005. if (PtInRect((LPRECT)&rc, pt))
  1006. return;
  1007. }
  1008. GetCursorPos((LPPOINT)&pt);
  1009. hwndStatus = sessQueryHwndStatusbar(hSession);
  1010. if (IsWindowVisible(hwndStatus))
  1011. {
  1012. GetClientRect(hwndStatus, (LPRECT)&rc);
  1013. ScreenToClient(hwndStatus, (LPPOINT)&pt);
  1014. if (PtInRect((LPRECT)&rc, pt))
  1015. return;
  1016. }
  1017. GetCursorPos((LPPOINT)&pt);
  1018. GetClientRect(hwnd, (LPRECT)&rc);
  1019. ScreenToClient(hwnd, (LPPOINT)&pt);
  1020. if (PtInRect((LPRECT)&rc, pt))
  1021. HandleContextMenu(hwnd, pt);
  1022. }
  1023. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1024. * FUNCTION:
  1025. * SP_WM_CLOSE
  1026. *
  1027. * DESCRIPTION:
  1028. * WM_CLOSE message processing.
  1029. *
  1030. * ARGUMENTS:
  1031. * hwnd - session window.
  1032. *
  1033. * RETURNS:
  1034. * TRUE if all OK, FALSE otherwise.
  1035. *
  1036. */
  1037. STATIC_FUNC BOOL SP_WM_CLOSE(const HWND hwnd)
  1038. {
  1039. HSESSION hSession = (HSESSION)GetWindowLongPtr(hwnd, GWLP_USERDATA);
  1040. if (!sessDisconnectToContinue(hSession, hwnd))
  1041. return FALSE;
  1042. if (!SaveSession(hSession, hwnd))
  1043. return FALSE;
  1044. return TRUE;
  1045. }
  1046. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1047. * FUNCTION:
  1048. * CheckOpenFile
  1049. *
  1050. * DESCRIPTION:
  1051. * Checks if given atom matches current system file name
  1052. *
  1053. * ARGUMENTS:
  1054. * hSession - public session handle
  1055. * aFile - atom of session file
  1056. *
  1057. * RETURNS:
  1058. * TRUE if current system file matches the one in the atom
  1059. *
  1060. * AUTHOR: Mike Ward, 27-Jan-1995
  1061. */
  1062. static int CheckOpenFile(const HSESSION hSession, ATOM aFile)
  1063. {
  1064. TCHAR ach[FNAME_LEN];
  1065. TCHAR achSessFile[FNAME_LEN];
  1066. ach[0] = TEXT('\0');
  1067. if (GlobalGetAtomName(aFile, ach, FNAME_LEN))
  1068. {
  1069. achSessFile[0] = TEXT('\0');
  1070. sfGetSessionFileName(sessQuerySysFileHdl(hSession),
  1071. FNAME_LEN, achSessFile);
  1072. return !StrCharCmpi(achSessFile, ach);
  1073. }
  1074. return FALSE;
  1075. }