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.

1206 lines
36 KiB

  1. /*===========================================================================*/
  2. /* Copyright (c) 1987 - 1990, Future Soft Engineering, Inc. */
  3. /* Houston, Texas */
  4. /*===========================================================================*/
  5. #define NOGDICAPMASKS TRUE
  6. #define NOVIRTUALKEYCODES TRUE
  7. #define NOICONS TRUE
  8. #define NOKEYSTATES TRUE
  9. #define NOSYSCOMMANDS TRUE
  10. #define NOATOM TRUE
  11. #define NOCLIPBOARD TRUE
  12. #define NODRAWTEXT TRUE
  13. #define NOMB TRUE
  14. #define NOMINMAX TRUE
  15. #define NOSCROLL TRUE
  16. #define NOHELP TRUE
  17. #define NOPROFILER TRUE
  18. #define NODEFERWINDOWPOS TRUE
  19. #define NOPEN TRUE
  20. #define NO_TASK_DEFINES TRUE
  21. #define NOLSTRING TRUE
  22. #define WIN31
  23. #define USECOMM
  24. #include <windows.h>
  25. #include <port1632.h>
  26. #include "dcrc.h"
  27. #include "dynacomm.h"
  28. #include "network.h"
  29. #include "video.h"
  30. #include "connect.h"
  31. /**************************************************************************/
  32. /* */
  33. /* initConnectors */
  34. /* */
  35. /**************************************************************************/
  36. BOOL initConnectors(BOOL bInit)
  37. {
  38. LPCONNECTORS lpConnectors; /* slc nova 031 */
  39. if(bInit) /* we are initializing stuff */
  40. {
  41. ghConnectors = GlobalAlloc(GHND | GMEM_ZEROINIT, (DWORD) sizeof(CONNECTORS));
  42. if(ghConnectors == NULL)
  43. return(FALSE);
  44. /* slc nova 031 */
  45. ghCCB = GlobalAlloc(GHND | GMEM_ZEROINIT, (DWORD)sizeof(CONNECTOR_CONTROL_BLOCK));
  46. /* the lpConnectors struct not really used by DynaComm at this time */
  47. /* let's go ahead and allocate room for one CCB */
  48. lpConnectors = (LPCONNECTORS) GlobalLock(ghConnectors);
  49. lpConnectors->hCCBArray = ghCCB;
  50. if(lpConnectors->hCCBArray == NULL)
  51. {
  52. GlobalUnlock(ghConnectors);
  53. GlobalFree(ghConnectors);
  54. return(FALSE);
  55. }
  56. lpConnectors->lpCCB[0] = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(lpConnectors->hCCBArray);
  57. GlobalUnlock(ghConnectors);
  58. }
  59. else
  60. { /* we are unloading this stuff */
  61. GlobalFree(ghCCB); /* slc nova 031 */
  62. GlobalFree(ghConnectors); /* slc nova 031 */
  63. }
  64. return(TRUE);
  65. }
  66. /**************************************************************************/
  67. /* */
  68. /* addConnectorList */
  69. /* */
  70. /**************************************************************************/
  71. VOID addConnectorList(HWND hDlg, WORD wId) /* slc nova 031 */
  72. {
  73. HANDLE theHandle;
  74. OFSTRUCT ofDummy;
  75. if (MOpenFile((LPSTR)"LANMAN.DLL", (LPOFSTRUCT)&ofDummy, OF_EXIST) != -1)
  76. SendDlgItemMessage(hDlg, wId, LB_INSERTSTRING, -1, (LPARAM)"LANMAN");
  77. }
  78. /**************************************************************************/
  79. /* */
  80. /* DLL_ConnectConnector seh nova 005 */
  81. /* */
  82. /**************************************************************************/
  83. WORD DLL_ConnectConnector(HANDLE hCCB, BOOL bShow) /* slc nova 031 seh nova 005 */
  84. {
  85. FARPROC lpfnGetType;
  86. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  87. WORD wResult = 0;
  88. if(hCCB == NULL) /* slc nova 028 */
  89. return(0);
  90. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  91. return(0);
  92. if((lpfnGetType = GetProcAddress(lpCCB->hConnectorInst,
  93. MAKEINTRESOURCE(ORD_CONNECTCONNECTOR))) != NULL)
  94. {
  95. wResult = ((WORD)(*lpfnGetType)(dlgGetFocus(), lpCCB, (BOOL)bShow));
  96. }
  97. GlobalUnlock(hCCB);
  98. return(wResult);
  99. }
  100. /**************************************************************************/
  101. /* */
  102. /* DLL_DisconnectConnector seh nova 005 */
  103. /* */
  104. /**************************************************************************/
  105. WORD DLL_DisconnectConnector(HANDLE hCCB)
  106. {
  107. FARPROC lpfnGetType;
  108. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  109. WORD wResult = 0;
  110. if(hCCB == NULL)
  111. return(0);
  112. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  113. return(0);
  114. if((lpfnGetType = GetProcAddress(lpCCB->hConnectorInst,
  115. MAKEINTRESOURCE(ORD_DISCONNECTCONNECTOR))) != NULL)
  116. {
  117. /* wResult = ((WORD)(*lpfnGetType)(dlgGetFocus(), lpCCB)); */
  118. }
  119. GlobalUnlock(hCCB);
  120. return(wResult);
  121. }
  122. /**************************************************************************/
  123. /* */
  124. /* DLL_modemSendBreak */
  125. /* */
  126. /**************************************************************************/
  127. WORD DLL_modemSendBreak(HANDLE hCCB, INT nTimes)
  128. {
  129. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  130. FARPROC lpfnCommandConnector;
  131. WORD wResult = 0;
  132. if(hCCB == NULL)
  133. return(0);
  134. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  135. return(0);
  136. if((lpfnCommandConnector = GetProcAddress(lpCCB->hConnectorInst,
  137. MAKEINTRESOURCE(ORD_COMMANDCONNECTOR))) != NULL)
  138. {
  139. }
  140. GlobalUnlock(hCCB);
  141. return(wResult);
  142. }
  143. /**************************************************************************/
  144. /* */
  145. /* DLL_ReadConnector */
  146. /* */
  147. /**************************************************************************/
  148. WORD DLL_ReadConnector(HANDLE hCCB) /* slc nova 031 */
  149. {
  150. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  151. FARPROC lpfnRead;
  152. WORD wResult = 0;
  153. if(hCCB == NULL) /* slc nova 028 */
  154. return(0);
  155. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  156. return(0);
  157. if((lpfnRead = GetProcAddress(lpCCB->hConnectorInst,
  158. MAKEINTRESOURCE(ORD_READCONNECTOR))) != NULL)
  159. {
  160. wResult = (WORD)(*lpfnRead)(lpCCB);
  161. }
  162. GlobalUnlock(hCCB);
  163. return(wResult);
  164. }
  165. /**************************************************************************/
  166. /* */
  167. /* DLL_ConnectBytes */
  168. /* */
  169. /**************************************************************************/
  170. WORD DLL_ConnectBytes(HANDLE hCCB) /* slc nova 031 */
  171. {
  172. if(hCCB == NULL)
  173. {
  174. serCount = 0;
  175. return(FALSE);
  176. }
  177. return(DLL_ReadConnector(hCCB));
  178. }
  179. /**************************************************************************/
  180. /* */
  181. /* DLL_WriteConnector */
  182. /* */
  183. /**************************************************************************/
  184. WORD DLL_WriteConnector(HANDLE hCCB) /* slc nova 031 */
  185. {
  186. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  187. WORD wResult = FALSE;
  188. FARPROC lpfnWrite;
  189. if(hCCB == NULL) /* slc nova 028 */
  190. {
  191. serCount = 0;
  192. return(wResult);
  193. }
  194. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  195. return(0);
  196. if((lpfnWrite = GetProcAddress(lpCCB->hConnectorInst,
  197. MAKEINTRESOURCE(ORD_WRITECONNECTOR))) != NULL)
  198. {
  199. wResult = (WORD)(*lpfnWrite)(lpCCB);
  200. }
  201. GlobalUnlock(hCCB);
  202. return(wResult);
  203. }
  204. /**************************************************************************/
  205. /* */
  206. /* DLL_ExitConnector */
  207. /* */
  208. /**************************************************************************/
  209. WORD DLL_ExitConnector(HANDLE hCCB, recTrmParams *pTrmParams)
  210. {
  211. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  212. FARPROC lpfnGetType;
  213. if(hCCB == NULL) /* slc nova 028 */
  214. return(0);
  215. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  216. return(0);
  217. if((lpfnGetType = GetProcAddress(lpCCB->hConnectorInst,
  218. MAKEINTRESOURCE(ORD_EXITCONNECTOR))) != NULL)
  219. {
  220. }
  221. if(lpCCB->hConnectorInst != 0) /* slc nova 031 */
  222. FreeLibrary(lpCCB->hConnectorInst);
  223. lpCCB->hConnectorInst = 0;
  224. GlobalUnlock(hCCB);
  225. return(0);
  226. }
  227. /**************************************************************************/
  228. /* */
  229. /* DLL_ResetConnector */
  230. /* */
  231. /**************************************************************************/
  232. WORD DLL_ResetConnector(HANDLE hCCB, BOOL bShow) /* slc nova 031 */
  233. {
  234. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  235. FARPROC lpfnGetType;
  236. WORD wResult = 0;
  237. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  238. return(0);
  239. if((lpfnGetType = GetProcAddress(lpCCB->hConnectorInst,
  240. MAKEINTRESOURCE(ORD_RESETCONNECTOR))) != NULL)
  241. {
  242. wResult = (WORD)(*lpfnGetType)(dlgGetFocus(), lpCCB, (BOOL)bShow);
  243. }
  244. GlobalUnlock(hCCB);
  245. return(wResult);
  246. }
  247. /**************************************************************************/
  248. /* */
  249. /* DLL_SetupConnector */
  250. /* */
  251. /**************************************************************************/
  252. WORD DLL_SetupConnector(HANDLE hCCB, BOOL bShow) /* slc nova 031 */
  253. {
  254. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  255. FARPROC lpfnProcAddr;
  256. WORD wResult = 0;
  257. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  258. return(0);
  259. if((lpfnProcAddr = GetProcAddress(lpCCB->hConnectorInst,
  260. MAKEINTRESOURCE(ORD_SETUPCONNECTOR))) != NULL)
  261. {
  262. ccbFromTrmParams(lpCCB, &trmParams);
  263. wResult = (WORD)(*lpfnProcAddr)(dlgGetFocus(), lpCCB, (BOOL)bShow);
  264. ccbToTrmParams(&trmParams, lpCCB);
  265. }
  266. GlobalUnlock(hCCB);
  267. return(wResult);
  268. }
  269. /**************************************************************************/
  270. /* */
  271. /* loadConnector */
  272. /* */
  273. /**************************************************************************/
  274. HANDLE loadConnector(HWND hTopWnd, HANDLE hCCB, LPSTR lpszConnector, BOOL bShow)
  275. {
  276. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  277. FARPROC lpfnGetType;
  278. CHAR szWork[PATHLEN];
  279. HANDLE hResult = NULL;
  280. if((lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB)) == NULL)
  281. return(0);
  282. if(lpCCB->hConnectorInst != 0)
  283. FreeLibrary(lpCCB->hConnectorInst);
  284. lpCCB->hConnectorInst = 0;
  285. if(*lpszConnector)
  286. {
  287. if(!lstrcmp(lpszConnector, (LPSTR)"LANMAN"))
  288. {
  289. lstrcpy((LPSTR)szWork, lpszConnector);
  290. strcat(szWork, ".DLL");
  291. }
  292. lpCCB->hConnectorInst = LoadLibrary((LPSTR)szWork); /* slc nova 028 */
  293. }
  294. /* in win30 <32 rc is an error, but in win32 rc is NULL in case of an error -sdj*/
  295. #ifdef ORGCODE
  296. if(lpCCB->hConnectorInst < 32)
  297. lpCCB->hConnectorInst = 0;
  298. #else
  299. if(lpCCB->hConnectorInst == NULL)
  300. lpCCB->hConnectorInst = (HANDLE)0;
  301. #endif
  302. if(lpCCB->hConnectorInst != 0)
  303. { /* check to see if we have a DC_CONNECTOR type dll */
  304. if((lpfnGetType = GetProcAddress(lpCCB->hConnectorInst,
  305. MAKEINTRESOURCE(ORD_GETDLLTYPE))) == NULL)
  306. {
  307. FreeLibrary(lpCCB->hConnectorInst);
  308. lpCCB->hConnectorInst = 0;
  309. }
  310. else
  311. {
  312. if((WORD)(*lpfnGetType)((HWND)hTopWnd, (BOOL)bShow) != DC_CONNECTOR)
  313. {
  314. FreeLibrary(lpCCB->hConnectorInst);
  315. lpCCB->hConnectorInst = 0;
  316. }
  317. }
  318. }
  319. hResult = lpCCB->hConnectorInst;
  320. GlobalUnlock(hCCB);
  321. if(hResult) /* slc nova 031 */
  322. DLL_ResetConnector(hCCB, FALSE);
  323. return(hResult);
  324. }
  325. /**************************************************************************/
  326. /* */
  327. /* DLL_HasSetupBox seh nova 006 */
  328. /* */
  329. /**************************************************************************/
  330. BOOL DLL_HasSetupBox(HANDLE hCCB)
  331. {
  332. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  333. FARPROC lpProc;
  334. BOOL bHasSetup;
  335. if(hCCB == NULL) /* slc nova 028 */
  336. return(0);
  337. lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB); /* slc nova 031 */
  338. if((lpProc = GetProcAddress(lpCCB->hConnectorInst,
  339. MAKEINTRESOURCE(ORD_GETEXTENDEDINFO))) == NULL)
  340. {
  341. bHasSetup = FALSE;
  342. }
  343. else
  344. {
  345. bHasSetup = (WORD)(*lpProc)((WORD)GI_IDENTIFY, (WORD)GI_SETUPBOX, (LPSTR)NULL);
  346. }
  347. return(bHasSetup);
  348. }
  349. /**************************************************************************/
  350. /* */
  351. /* getConnectorCaps */
  352. /* */
  353. /**************************************************************************/
  354. WORD getConnectorCaps(LPCONNECTOR_CONTROL_BLOCK lpCCB) /* slc nova 031 */
  355. {
  356. FARPROC lpProc;
  357. WORD wReturn;
  358. if((lpProc = GetProcAddress(lpCCB->hConnectorInst,
  359. MAKEINTRESOURCE(ORD_GETCONNECTCAPS))) != NULL)
  360. {
  361. wReturn = (WORD)(*lpProc)((WORD)SET_PARAMETERS);
  362. }
  363. return(wReturn);
  364. }
  365. /**************************************************************************/
  366. /* */
  367. /* getConnectorSettings */
  368. /* */
  369. /**************************************************************************/
  370. WORD getConnectorSettings(LPCONNECTOR_CONTROL_BLOCK lpCCB, BOOL bShow) /* slc nova 031 */
  371. {
  372. FARPROC lpProc;
  373. WORD wReturn;
  374. WORD wPassVal = SP_GETDEFAULT;
  375. if(bShow)
  376. wPassVal |= SP_SHOW;
  377. if((lpProc = GetProcAddress(lpCCB->hConnectorInst,
  378. MAKEINTRESOURCE(ORD_SETPARAMETERS))) != NULL)
  379. {
  380. wReturn = (WORD)(*lpProc)((WORD)wPassVal, (LPCONNECTOR_CONTROL_BLOCK)lpCCB);
  381. }
  382. return(wReturn);
  383. }
  384. /**************************************************************************/
  385. /* */
  386. /* setConnectorSettings */
  387. /* */
  388. /**************************************************************************/
  389. WORD setConnectorSettings(HWND hDlg, HANDLE hCCB, BOOL bDefaults) /* slc nova 031 */
  390. {
  391. LPCONNECTOR_CONTROL_BLOCK lpCCB; /* slc nova 031 */
  392. LPCONNECTORS lpConnectors; /* slc nova 031 */
  393. FARPROC lpProc;
  394. WORD wSettings;
  395. WORD wWorkSettings, wWork;
  396. if(hCCB == NULL) /* slc nova 028 */
  397. return(0);
  398. lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB); /* slc nova 031 */
  399. if(lpCCB->hConnectorInst == 0) /* slc nova 046 */
  400. {
  401. GlobalUnlock(hCCB);
  402. return(0);
  403. }
  404. if((lpProc = GetProcAddress(lpCCB->hConnectorInst,
  405. MAKEINTRESOURCE(ORD_GETEXTENDEDINFO))) != NULL)
  406. {
  407. wSettings = (WORD)(*lpProc)((WORD)GI_IDENTIFY, (WORD)GI_SETUPBOX, (LPSTR)NULL);
  408. }
  409. if(wSettings)
  410. {
  411. EnableWindow(GetDlgItem(hDlg, ITMSETUP), TRUE); /* seh nova 005 */
  412. ShowWindow(GetDlgItem(hDlg, ITMSETUP), SW_SHOW); /* seh nova 005 */
  413. }
  414. else
  415. {
  416. EnableWindow(GetDlgItem(hDlg, ITMSETUP), FALSE); /* seh nova 005 */
  417. ShowWindow(GetDlgItem(hDlg, ITMSETUP), SW_HIDE); /* seh nova 005 */
  418. }
  419. wSettings = getConnectorCaps(lpCCB); /* slc nova 031 */
  420. getConnectorSettings(lpCCB, FALSE); /* slc nova 031 */
  421. if(bDefaults) /* slc nova 031 */
  422. {
  423. ccbFromTrmParams(lpCCB, &trmParams);
  424. ccbToTrmParams(&trmParams, lpCCB);
  425. }
  426. /* enable baud rates */
  427. for(wWork = ITMBD110; wWork <= ITMBD192; wWork++)
  428. EnableWindow(GetDlgItem(hDlg, wWork), FALSE);
  429. if((wSettings & SP_BAUD) == SP_BAUD)
  430. {
  431. wWorkSettings = lpCCB->wBaudFlags;
  432. if((wWorkSettings & BAUD_110) == BAUD_110)
  433. EnableWindow(GetDlgItem(hDlg, ITMBD110), TRUE);
  434. if((wWorkSettings & BAUD_300) == BAUD_300)
  435. EnableWindow(GetDlgItem(hDlg, ITMBD300), TRUE);
  436. if((wWorkSettings & BAUD_600) == BAUD_600)
  437. EnableWindow(GetDlgItem(hDlg, ITMBD600), TRUE);
  438. if((wWorkSettings & BAUD_120) == BAUD_120)
  439. EnableWindow(GetDlgItem(hDlg, ITMBD120), TRUE);
  440. if((wWorkSettings & BAUD_240) == BAUD_240)
  441. EnableWindow(GetDlgItem(hDlg, ITMBD240), TRUE);
  442. if((wWorkSettings & BAUD_480) == BAUD_480)
  443. EnableWindow(GetDlgItem(hDlg, ITMBD480), TRUE);
  444. if((wWorkSettings & BAUD_960) == BAUD_960)
  445. EnableWindow(GetDlgItem(hDlg, ITMBD960), TRUE);
  446. if((wWorkSettings & BAUD_192) == BAUD_192)
  447. EnableWindow(GetDlgItem(hDlg, ITMBD192), TRUE);
  448. CheckRadioButton(hDlg, ITMBD110, ITMBD192, putCCB_BAUDITM(lpCCB->wBaudSet));
  449. }
  450. /* enable data bits */
  451. for(wWork = ITMDATA5; wWork <= ITMDATA8; wWork++)
  452. EnableWindow(GetDlgItem(hDlg, wWork), FALSE);
  453. if((wSettings & SP_DATABITS) == SP_DATABITS)
  454. {
  455. wWorkSettings = lpCCB->wDataBitFlags;
  456. if((wWorkSettings & DATABITS_5) == DATABITS_5)
  457. EnableWindow(GetDlgItem(hDlg, ITMDATA5), TRUE);
  458. if((wWorkSettings & DATABITS_6) == DATABITS_6)
  459. EnableWindow(GetDlgItem(hDlg, ITMDATA6), TRUE);
  460. if((wWorkSettings & DATABITS_7) == DATABITS_7)
  461. EnableWindow(GetDlgItem(hDlg, ITMDATA7), TRUE);
  462. if((wWorkSettings & DATABITS_8) == DATABITS_8)
  463. EnableWindow(GetDlgItem(hDlg, ITMDATA8), TRUE);
  464. CheckRadioButton(hDlg, ITMDATA5, ITMDATA8, putCCB_DATABITS(lpCCB->wDataBitSet));
  465. }
  466. /* enable stop bits */
  467. for(wWork = ITMSTOP1; wWork <= ITMSTOP2; wWork++)
  468. EnableWindow(GetDlgItem(hDlg, wWork), FALSE);
  469. if((wSettings & SP_STOPBITS) == SP_STOPBITS)
  470. {
  471. wWorkSettings = lpCCB->wStopBitFlags;
  472. if((wWorkSettings & STOPBITS_10) == STOPBITS_10)
  473. EnableWindow(GetDlgItem(hDlg, ITMSTOP1), TRUE);
  474. if((wWorkSettings & STOPBITS_15) == STOPBITS_15)
  475. EnableWindow(GetDlgItem(hDlg, ITMSTOP5), TRUE);
  476. if((wWorkSettings & STOPBITS_20) == STOPBITS_20)
  477. EnableWindow(GetDlgItem(hDlg,ITMSTOP2), TRUE);
  478. CheckRadioButton(hDlg, ITMSTOP1, ITMSTOP2, putCCB_STOPBITS(lpCCB->wStopBitSet));
  479. }
  480. /* enable parity options */
  481. for(wWork = ITMNOPARITY; wWork <= ITMSPACEPARITY; wWork++)
  482. EnableWindow(GetDlgItem(hDlg, wWork), FALSE);
  483. if((wSettings & SP_PARITY) == SP_PARITY)
  484. {
  485. wWorkSettings = lpCCB->wParityFlags;
  486. if((wWorkSettings & PARITY_NONE) == PARITY_NONE)
  487. EnableWindow(GetDlgItem(hDlg, ITMNOPARITY), TRUE);
  488. if((wWorkSettings & PARITY_ODD) == PARITY_ODD)
  489. EnableWindow(GetDlgItem(hDlg, ITMODDPARITY), TRUE);
  490. if((wWorkSettings & PARITY_EVEN) == PARITY_EVEN)
  491. EnableWindow(GetDlgItem(hDlg, ITMEVENPARITY), TRUE);
  492. if((wWorkSettings & PARITY_MARK) == PARITY_MARK)
  493. EnableWindow(GetDlgItem(hDlg, ITMMARKPARITY), TRUE);
  494. if((wWorkSettings & PARITY_SPACE) == PARITY_SPACE)
  495. EnableWindow(GetDlgItem(hDlg, ITMSPACEPARITY), TRUE);
  496. CheckRadioButton(hDlg, ITMNOPARITY, ITMSPACEPARITY, putCCB_PARITY(lpCCB->wParitySet));
  497. }
  498. /* enable handshake options */
  499. for(wWork = ITMXONFLOW; wWork <= ITMNOFLOW; wWork++)
  500. EnableWindow(GetDlgItem(hDlg, wWork), FALSE);
  501. if((wSettings & SP_HANDSHAKING) == SP_HANDSHAKING)
  502. {
  503. wWorkSettings = lpCCB->wHandshakeFlags;
  504. if((wWorkSettings & HANDSHAKE_XONXOFF) == HANDSHAKE_XONXOFF)
  505. EnableWindow(GetDlgItem(hDlg, ITMXONFLOW), TRUE);
  506. if((wWorkSettings & HANDSHAKE_HARDWARE) == HANDSHAKE_HARDWARE)
  507. EnableWindow(GetDlgItem(hDlg, ITMHARDFLOW), TRUE);
  508. if((wWorkSettings & HANDSHAKE_NONE) == HANDSHAKE_NONE)
  509. EnableWindow(GetDlgItem(hDlg, ITMNOFLOW), TRUE);
  510. CheckRadioButton(hDlg, ITMXONFLOW, ITMNOFLOW, putCCB_FLOWCTRL(lpCCB->wHandshakeSet));
  511. }
  512. /* enable carrier detect button */
  513. //if((wSettings & SP_RLSD) == SP_RLSD) needs to be changed to SP_CARRIER_DETECT
  514. //{
  515. // EnableWindow(GetDlgItem(hDlg, ITMCARRIER), TRUE);
  516. //}
  517. //else
  518. //{
  519. EnableWindow(GetDlgItem(hDlg, ITMCARRIER), FALSE);
  520. //}
  521. /* enable parity check button */
  522. if((wSettings & SP_PARITY_CHECK) == SP_PARITY_CHECK)
  523. {
  524. EnableWindow(GetDlgItem(hDlg, ITMPARITY), TRUE);
  525. }
  526. else
  527. {
  528. EnableWindow(GetDlgItem(hDlg, ITMPARITY), FALSE);
  529. }
  530. GlobalUnlock(hCCB); /* slc nova 031 */
  531. return(wSettings);
  532. }
  533. /**************************************************************************/
  534. INT GetDynaCommProfileString(LPSTR lpsz1, LPSTR lpsz2, LPSTR lpsz3,
  535. LPSTR lpsz4, INT nSize, LPSTR lpsz5)
  536. {
  537. return GetPrivateProfileString(lpsz1, lpsz2, lpsz3, lpsz4, nSize, lpsz5);
  538. }
  539. /**************************************************************************/
  540. /* getConnectType seh nova 005 */
  541. /**************************************************************************/
  542. WORD getConnectType(HANDLE hConnector, HANDLE hCCB)
  543. {
  544. LPCONNECTOR_CONTROL_BLOCK lpCCB;
  545. WORD wResult;
  546. lpCCB = (LPCONNECTOR_CONTROL_BLOCK)GlobalLock(hCCB);
  547. wResult = (WORD)lpCCB->wType;
  548. GlobalUnlock(hCCB);
  549. return(wResult);
  550. }
  551. /**************************************************************************/
  552. /* ccbFromTrmParams slc nova 028 */
  553. /**************************************************************************/
  554. /**************************************************************************/
  555. /* getCCB_BAUD seh nova 005 */
  556. /**************************************************************************/
  557. WORD getCCB_BAUD(WORD wSpeed)
  558. {
  559. WORD wReturn;
  560. switch(wSpeed) /* from DC to CCB */
  561. {
  562. case 75:
  563. wReturn = BAUD_075;
  564. break;
  565. case 110:
  566. wReturn = BAUD_110;
  567. break;
  568. case 300:
  569. wReturn = BAUD_300;
  570. break;
  571. case 600:
  572. wReturn = BAUD_600;
  573. break;
  574. case 1200:
  575. wReturn = BAUD_120;
  576. break;
  577. case 2400:
  578. wReturn = BAUD_240;
  579. break;
  580. case 4800:
  581. wReturn = BAUD_480;
  582. break;
  583. case 9600:
  584. wReturn = BAUD_960;
  585. break;
  586. case 19200:
  587. wReturn = BAUD_192;
  588. break;
  589. default:
  590. wReturn = (WORD)BAUD_USER;
  591. break;
  592. }
  593. return(wReturn);
  594. }
  595. /**************************************************************************/
  596. /* getCCB_DATABITS slc nova 028 */
  597. /**************************************************************************/
  598. WORD getCCB_DATABITS(WORD wInput)
  599. {
  600. WORD wReturn;
  601. switch(wInput)
  602. {
  603. case ITMDATA5:
  604. wReturn = DATABITS_5;
  605. break;
  606. case ITMDATA6:
  607. wReturn = DATABITS_6;
  608. break;
  609. case ITMDATA7:
  610. wReturn = DATABITS_7;
  611. break;
  612. case ITMDATA8:
  613. wReturn = DATABITS_8;
  614. break;
  615. default:
  616. wReturn = DATABITS_8;
  617. break;
  618. }
  619. return(wReturn);
  620. }
  621. /**************************************************************************/
  622. /* getCCB_PARITY slc nova 028 */
  623. /**************************************************************************/
  624. WORD getCCB_PARITY(WORD wInput)
  625. {
  626. WORD wReturn;
  627. switch(wInput)
  628. {
  629. case ITMNOPARITY:
  630. wReturn = PARITY_NONE;
  631. break;
  632. case ITMODDPARITY:
  633. wReturn = PARITY_ODD;
  634. break;
  635. case ITMEVENPARITY:
  636. wReturn = PARITY_EVEN;
  637. break;
  638. case ITMMARKPARITY:
  639. wReturn = PARITY_MARK;
  640. break;
  641. case ITMSPACEPARITY:
  642. wReturn = PARITY_SPACE;
  643. break;
  644. default:
  645. wReturn = PARITY_NONE;
  646. break;
  647. }
  648. return(wReturn);
  649. }
  650. /**************************************************************************/
  651. /* getCCB_STOPBITS slc nova 028 */
  652. /**************************************************************************/
  653. WORD getCCB_STOPBITS(WORD wInput)
  654. {
  655. WORD wReturn;
  656. switch(wInput)
  657. {
  658. case ITMSTOP1:
  659. wReturn = STOPBITS_10;
  660. break;
  661. case ITMSTOP5:
  662. wReturn = STOPBITS_15;
  663. break;
  664. case ITMSTOP2:
  665. wReturn = STOPBITS_20;
  666. break;
  667. default:
  668. wReturn = STOPBITS_10;
  669. break;
  670. }
  671. return(wReturn);
  672. }
  673. /**************************************************************************/
  674. /* getCCB_FLOWCTRL slc nova 028 */
  675. /**************************************************************************/
  676. WORD getCCB_FLOWCTRL(WORD wInput)
  677. {
  678. WORD wReturn;
  679. switch(wInput)
  680. {
  681. case ITMXONFLOW:
  682. wReturn = HANDSHAKE_XONXOFF;
  683. break;
  684. case ITMHARDFLOW:
  685. wReturn = HANDSHAKE_HARDWARE;
  686. break;
  687. case ITMNOFLOW:
  688. wReturn = HANDSHAKE_NONE;
  689. break;
  690. case ITMETXFLOW:
  691. wReturn = HANDSHAKE_ETXFLOW;
  692. break;
  693. default:
  694. wReturn = HANDSHAKE_XONXOFF;
  695. break;
  696. }
  697. return(wReturn);
  698. }
  699. /**************************************************************************/
  700. /* getCCB_MISCSET slc nova 028 */
  701. /**************************************************************************/
  702. WORD getCCB_MISCSET(WORD wInput1, WORD wInput2)
  703. {
  704. WORD wReturn = 0;
  705. if(wInput1)
  706. wReturn = MISC_CARRIER_DETECT;
  707. if(wInput2)
  708. wReturn |= MISC_PARITY_CHECK;
  709. return(wReturn);
  710. }
  711. /**************************************************************************/
  712. VOID ccbFromTrmParams(LPCONNECTOR_CONTROL_BLOCK lpCCB, recTrmParams *pTrmParams)
  713. {
  714. // -sdj, dec'91 If the trmparams structure is packed with 1 byte alignment
  715. // -sdj, MIPS compiler breaks while compiling this funciton, I think the line
  716. // -sdj, is: lpCCB->byPadChar = (pTrmParams->commFlags & DCS_CF_NETNAMEPADDING) ? 0x20 : 0x00;
  717. // -sdj, the Fix for this cc bug wont make it into the pdk2, so lets bypass
  718. // -sdj, this function code for the time being
  719. // #ifdef BUGBYPASS
  720. // #else
  721. lstrcpy(lpCCB->szDLLName, (LPSTR)pTrmParams->szConnectorName); /* slc nova 106 */
  722. lpCCB->wSpeed = pTrmParams->speed; /* seh nova 005 */
  723. lpCCB->wBaudSet = getCCB_BAUD(lpCCB->wSpeed); /* seh nova 005 */
  724. lpCCB->wDataBitSet = getCCB_DATABITS(pTrmParams->dataBits);
  725. lpCCB->wParitySet = getCCB_PARITY(pTrmParams->parity);
  726. lpCCB->wStopBitSet = getCCB_STOPBITS(pTrmParams->stopBits);
  727. lpCCB->wHandshakeSet = getCCB_FLOWCTRL(pTrmParams->flowControl);
  728. lpCCB->wMiscSet = getCCB_MISCSET(pTrmParams->fCarrier,
  729. pTrmParams->fParity);
  730. lstrcpy(lpCCB->szPhoneNumber, (LPSTR)pTrmParams->phone); /* slc nova 106 */
  731. lstrcpy(lpCCB->szClient, (LPSTR)pTrmParams->localName); /* slc nova 106 */
  732. lstrcpy(lpCCB->szServer, (LPSTR)pTrmParams->remoteName); /* slc nova 106 */
  733. lpCCB->byPadChar = (pTrmParams->commFlags & DCS_CF_NETNAMEPADDING) ? 0x20 : 0x00;
  734. lmovmem((LPSTR)pTrmParams->connectorConfigData, lpCCB->configBuffer, 32); /* slc nova 106 */
  735. // #endif
  736. }
  737. /**************************************************************************/
  738. /* ccbToTrmParams slc nova 028 */
  739. /**************************************************************************/
  740. /**************************************************************************/
  741. /* putCCB_BAUDITM seh nova 005 */
  742. /**************************************************************************/
  743. WORD putCCB_BAUDITM(WORD wID) /* called by setConnectorSettings() */
  744. {
  745. WORD wReturn;
  746. switch(wID)
  747. {
  748. case BAUD_075:
  749. wReturn = ITMBD110; /* dc does not support yet */
  750. break;
  751. case BAUD_110:
  752. wReturn = ITMBD110;
  753. break;
  754. case BAUD_300:
  755. wReturn = ITMBD300;
  756. break;
  757. case BAUD_600:
  758. wReturn = ITMBD600;
  759. break;
  760. case BAUD_120:
  761. wReturn = ITMBD120;
  762. break;
  763. case BAUD_240:
  764. wReturn = ITMBD240;
  765. break;
  766. case BAUD_480:
  767. wReturn = ITMBD480;
  768. break;
  769. case BAUD_960:
  770. wReturn = ITMBD960;
  771. break;
  772. case BAUD_192:
  773. wReturn = ITMBD192;
  774. break;
  775. default:
  776. wReturn = ITMBD120;
  777. break;
  778. }
  779. return(wReturn);
  780. }
  781. /**************************************************************************/
  782. /* putCCB_BAUD seh nova 005 */
  783. /**************************************************************************/
  784. WORD putCCB_BAUD(WORD wID)
  785. {
  786. WORD wReturn;
  787. switch(wID)
  788. {
  789. case BAUD_075:
  790. wReturn = 75;
  791. break;
  792. case BAUD_110:
  793. wReturn = 110;
  794. break;
  795. case BAUD_300:
  796. wReturn = 300;
  797. break;
  798. case BAUD_600:
  799. wReturn = 600;
  800. break;
  801. case BAUD_120:
  802. wReturn = 1200;
  803. break;
  804. case BAUD_240:
  805. wReturn = 2400;
  806. break;
  807. case BAUD_480:
  808. wReturn = 4800;
  809. break;
  810. case BAUD_960:
  811. wReturn = 9600;
  812. break;
  813. case BAUD_192:
  814. wReturn = 19200;
  815. break;
  816. default:
  817. wReturn = 1200;
  818. break;
  819. }
  820. return(wReturn);
  821. }
  822. /**************************************************************************/
  823. /* putCCB_DATABITS slc nova 028 */
  824. /**************************************************************************/
  825. WORD putCCB_DATABITS(WORD wInput)
  826. {
  827. WORD wReturn;
  828. switch(wInput)
  829. {
  830. case DATABITS_5:
  831. wReturn = ITMDATA5;
  832. break;
  833. case DATABITS_6:
  834. wReturn = ITMDATA6;
  835. break;
  836. case DATABITS_7:
  837. wReturn = ITMDATA7;
  838. break;
  839. case DATABITS_8:
  840. wReturn = ITMDATA8;
  841. break;
  842. default:
  843. wReturn = ITMDATA8;
  844. break;
  845. }
  846. return(wReturn);
  847. }
  848. /**************************************************************************/
  849. /* putCCB_PARITY slc nova 028 */
  850. /**************************************************************************/
  851. WORD putCCB_PARITY(WORD wInput)
  852. {
  853. WORD wReturn;
  854. switch(wInput)
  855. {
  856. case PARITY_NONE:
  857. wReturn = ITMNOPARITY;
  858. break;
  859. case PARITY_ODD:
  860. wReturn = ITMODDPARITY;
  861. break;
  862. case PARITY_EVEN:
  863. wReturn = ITMEVENPARITY;
  864. break;
  865. case PARITY_MARK:
  866. wReturn = ITMMARKPARITY;
  867. break;
  868. case PARITY_SPACE:
  869. wReturn = ITMSPACEPARITY;
  870. break;
  871. default:
  872. wReturn = ITMNOPARITY;
  873. break;
  874. }
  875. return(wReturn);
  876. }
  877. /**************************************************************************/
  878. /* putCCB_STOPBITS slc nova 028 */
  879. /**************************************************************************/
  880. WORD putCCB_STOPBITS(WORD wInput)
  881. {
  882. WORD wReturn;
  883. switch(wInput)
  884. {
  885. case STOPBITS_10:
  886. wReturn = ITMSTOP1;
  887. break;
  888. case STOPBITS_15:
  889. wReturn = ITMSTOP5;
  890. break;
  891. case STOPBITS_20:
  892. wReturn = ITMSTOP2;
  893. break;
  894. default:
  895. wReturn = ITMSTOP1;
  896. break;
  897. }
  898. return(wReturn);
  899. }
  900. /**************************************************************************/
  901. /* putCCB_FLOWCTRL slc nova 028 */
  902. /**************************************************************************/
  903. WORD putCCB_FLOWCTRL(WORD wInput)
  904. {
  905. WORD wReturn;
  906. switch(wInput)
  907. {
  908. case HANDSHAKE_XONXOFF:
  909. wReturn = ITMXONFLOW;
  910. break;
  911. case HANDSHAKE_HARDWARE:
  912. wReturn = ITMHARDFLOW;
  913. break;
  914. case HANDSHAKE_NONE:
  915. wReturn = ITMNOFLOW;
  916. break;
  917. case HANDSHAKE_ETXFLOW:
  918. wReturn = ITMETXFLOW;
  919. break;
  920. default:
  921. wReturn = ITMXONFLOW;
  922. break;
  923. }
  924. return(wReturn);
  925. }
  926. /**************************************************************************/
  927. /* putCCB_MISCSET slc nova 028 */
  928. /**************************************************************************/
  929. WORD putCCB_MISCSET(WORD wInput1, WORD wInput2)
  930. {
  931. WORD wReturn = 0;
  932. if(wInput1)
  933. wReturn = MISC_CARRIER_DETECT;
  934. if(wInput2)
  935. wReturn |= MISC_PARITY_CHECK;
  936. return(wReturn);
  937. }
  938. /**************************************************************************/
  939. VOID ccbToTrmParams(recTrmParams *pTrmParams, LPCONNECTOR_CONTROL_BLOCK lpCCB)
  940. {
  941. // -sdj, dec'91 If the trmparams structure is packed with 1 byte alignment
  942. // -sdj, MIPS compiler breaks while compiling this funciton,
  943. // -sdj, the Fix for this cc bug wont make it into the pdk2, so lets bypass
  944. // -sdj, this function code for the time being
  945. // #ifdef BUGBYPASS
  946. // #else
  947. lstrcpy((LPSTR)pTrmParams->szConnectorName, lpCCB->szDLLName); /* slc nova 106 */
  948. pTrmParams->speed = putCCB_BAUD(lpCCB->wBaudSet);
  949. pTrmParams->dataBits = (BYTE)putCCB_DATABITS(lpCCB->wDataBitSet);
  950. pTrmParams->parity = (BYTE)putCCB_PARITY(lpCCB->wParitySet);
  951. pTrmParams->stopBits = (BYTE)putCCB_STOPBITS(lpCCB->wStopBitSet);
  952. pTrmParams->flowControl = (BYTE)putCCB_FLOWCTRL(lpCCB->wHandshakeSet);
  953. pTrmParams->fCarrier = (lpCCB->wMiscSet & MISC_CARRIER_DETECT) ? 1 : 0;
  954. pTrmParams->fParity = (lpCCB->wMiscSet & MISC_PARITY_CHECK) ? 1 : 0;
  955. lstrcpy((LPSTR)pTrmParams->phone, lpCCB->szPhoneNumber); /* slc nova 106 */
  956. lstrcpy((LPSTR)pTrmParams->localName, lpCCB->szClient); /* slc nova 106 */
  957. lstrcpy((LPSTR)pTrmParams->remoteName, lpCCB->szServer); /* slc nova 106 */
  958. if(lpCCB->byPadChar == 0x20)
  959. {
  960. pTrmParams->commFlags |= DCS_CF_NETNAMEPADDING;
  961. NETNAMEPADDING = ' ';
  962. }
  963. else
  964. {
  965. pTrmParams->commFlags &= ~DCS_CF_NETNAMEPADDING;
  966. NETNAMEPADDING = '\0';
  967. }
  968. lmovmem(lpCCB->configBuffer, (LPSTR)pTrmParams->connectorConfigData, 32); /* slc nova 106 */
  969. // #endif
  970. }
  971. /* the end */