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.

1512 lines
42 KiB

  1. /*-------------------------------------------------------------------
  2. | addwiz.c - Add Device Wizard.
  3. 11-24-98 - zero out psh struct to ensure deterministic propsheet behavior. kpb
  4. |--------------------------------------------------------------------*/
  5. #include "precomp.h"
  6. // testing!!!
  7. #define ROCKETMODEM_PCI4_SUPPORT 1
  8. static void set_field(HWND hDlg, WORD id);
  9. static void get_field(HWND hDlg, WORD id);
  10. //static int PaintIcon(HWND hWnd);
  11. #ifdef NT50
  12. // nt50 build does not link with this, so I made my own
  13. #define strupr(s) my_strupr(s)
  14. #endif
  15. static void my_strupr(char *str);
  16. static int FillDevicePropSheets(PROPSHEETPAGE *psp, LPARAM our_params);
  17. static int InvalidMacAddress = 1;
  18. #ifdef S_RK
  19. #define NUM_DEVPROP_SHEETS 7
  20. const LPSTR idWizIntro = MAKEINTRESOURCE(IDD_ADD_WIZ_INTRO);
  21. const LPSTR idWizBus = MAKEINTRESOURCE(IDD_ADD_WIZ_BUSTYPE);
  22. const LPSTR idWizModel = MAKEINTRESOURCE(IDD_ADD_WIZ_BOARD);
  23. const LPSTR idWizNumPorts = MAKEINTRESOURCE(IDD_ADD_WIZ_NUMPORTS);
  24. const LPSTR idWizIoBase = MAKEINTRESOURCE(IDD_ADD_WIZ_BASEIO);
  25. const LPSTR idWizCountry = MAKEINTRESOURCE(IDD_ADD_WIZ_COUNTRY);
  26. const LPSTR idWizDone = MAKEINTRESOURCE(IDD_ADD_WIZ_DONE);
  27. #else
  28. #define NUM_DEVPROP_SHEETS 7
  29. const LPSTR idWizIntro = MAKEINTRESOURCE(IDD_ADD_WIZ_INTRO);
  30. const LPSTR idWizDevice = MAKEINTRESOURCE(IDD_ADD_WIZ_DEVICE);
  31. const LPSTR idWizNumPorts = MAKEINTRESOURCE(IDD_ADD_WIZ_NUMPORTS);
  32. const LPSTR idWizMac = MAKEINTRESOURCE(IDD_ADD_WIZ_MAC);
  33. const LPSTR idWizCountry = MAKEINTRESOURCE(IDD_ADD_WIZ_COUNTRY);
  34. const LPSTR idWizBackup = MAKEINTRESOURCE(IDD_ADD_WIZ_BACKUP);
  35. const LPSTR idWizDone = MAKEINTRESOURCE(IDD_ADD_WIZ_DONE);
  36. #endif
  37. BOOL WINAPI WizIntroPropSheet(
  38. IN HWND hDlg,
  39. IN UINT uMessage,
  40. IN WPARAM wParam,
  41. IN LPARAM lParam);
  42. BOOL WINAPI WizBusPropSheet(
  43. IN HWND hDlg,
  44. IN UINT uMessage,
  45. IN WPARAM wParam,
  46. IN LPARAM lParam);
  47. BOOL WINAPI WizModelPropSheet(
  48. IN HWND hDlg,
  49. IN UINT uMessage,
  50. IN WPARAM wParam,
  51. IN LPARAM lParam);
  52. BOOL WINAPI WizNumPortsPropSheet(
  53. IN HWND hDlg,
  54. IN UINT uMessage,
  55. IN WPARAM wParam,
  56. IN LPARAM lParam);
  57. BOOL WINAPI WizIoBasePropSheet(
  58. IN HWND hDlg,
  59. IN UINT uMessage,
  60. IN WPARAM wParam,
  61. IN LPARAM lParam);
  62. BOOL WINAPI WizCountryPropSheet(
  63. IN HWND hDlg,
  64. IN UINT uMessage,
  65. IN WPARAM wParam,
  66. IN LPARAM lParam);
  67. BOOL WINAPI WizDonePropSheet(
  68. IN HWND hDlg,
  69. IN UINT uMessage,
  70. IN WPARAM wParam,
  71. IN LPARAM lParam);
  72. // vs specific prototypes:
  73. BOOL WINAPI WizDevicePropSheet(
  74. IN HWND hDlg,
  75. IN UINT uMessage,
  76. IN WPARAM wParam,
  77. IN LPARAM lParam);
  78. BOOL WINAPI WizNumPortsPropSheet(
  79. IN HWND hDlg,
  80. IN UINT uMessage,
  81. IN WPARAM wParam,
  82. IN LPARAM lParam);
  83. BOOL WINAPI WizMacPropSheet(
  84. IN HWND hDlg,
  85. IN UINT uMessage,
  86. IN WPARAM wParam,
  87. IN LPARAM lParam);
  88. BOOL WINAPI WizBackupPropSheet(
  89. IN HWND hDlg,
  90. IN UINT uMessage,
  91. IN WPARAM wParam,
  92. IN LPARAM lParam);
  93. /*------------------------------------------------------------------------
  94. | FillDevicePropSheets - Setup pages for driver level property sheets.
  95. |------------------------------------------------------------------------*/
  96. static int FillDevicePropSheets(PROPSHEETPAGE *psp, LPARAM our_params)
  97. {
  98. INT pi;
  99. static TCHAR title[20];
  100. load_str( glob_hinst, TITLESTR, title, CharSizeOf(title) );
  101. memset(psp, 0, sizeof(*psp) * NUM_DEVPROP_SHEETS);
  102. pi = 0;
  103. // Intro wizard page
  104. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  105. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  106. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  107. psp[pi].hInstance = glob_hinst;
  108. psp[pi].pszTemplate = idWizIntro;
  109. psp[pi].pfnDlgProc = WizIntroPropSheet;
  110. psp[pi].pszTitle = title;
  111. psp[pi].lParam = (LPARAM)our_params;
  112. psp[pi].pfnCallback = NULL;
  113. ++pi;
  114. #ifdef S_RK
  115. // BusType wizard page
  116. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  117. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  118. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  119. psp[pi].hInstance = glob_hinst;
  120. psp[pi].pszTemplate = idWizBus;
  121. psp[pi].pfnDlgProc = WizBusPropSheet;
  122. psp[pi].pszTitle = title;
  123. psp[pi].lParam = (LPARAM)our_params;
  124. psp[pi].pfnCallback = NULL;
  125. ++pi;
  126. #endif
  127. #ifdef S_RK
  128. // RocketPort/RocketModem Model wizard page
  129. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  130. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  131. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  132. psp[pi].hInstance = glob_hinst;
  133. psp[pi].pszTemplate = idWizModel;
  134. psp[pi].pfnDlgProc = WizModelPropSheet;
  135. psp[pi].pszTitle = title;
  136. psp[pi].lParam = (LPARAM)our_params;
  137. psp[pi].pfnCallback = NULL;
  138. ++pi;
  139. #else
  140. // VS1000/VS2000/RocketPort Serial Hub wizard page
  141. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  142. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  143. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  144. psp[pi].hInstance = glob_hinst;
  145. psp[pi].pszTemplate = idWizDevice;
  146. psp[pi].pfnDlgProc = WizDevicePropSheet;
  147. psp[pi].pszTitle = title;
  148. psp[pi].lParam = (LPARAM)our_params;
  149. psp[pi].pfnCallback = NULL;
  150. ++pi;
  151. #endif
  152. // NumPorts wizard page
  153. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  154. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  155. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  156. psp[pi].hInstance = glob_hinst;
  157. psp[pi].pszTemplate = idWizNumPorts;
  158. psp[pi].pfnDlgProc = WizNumPortsPropSheet;
  159. psp[pi].pszTitle = title;
  160. psp[pi].lParam = (LPARAM)our_params;
  161. psp[pi].pfnCallback = NULL;
  162. ++pi;
  163. #ifdef S_RK
  164. // BaseIoAddress wizard page
  165. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  166. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  167. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  168. psp[pi].hInstance = glob_hinst;
  169. psp[pi].pszTemplate = idWizIoBase;
  170. psp[pi].pfnDlgProc = WizIoBasePropSheet;
  171. psp[pi].pszTitle = title;
  172. psp[pi].lParam = (LPARAM)our_params;
  173. psp[pi].pfnCallback = NULL;
  174. ++pi;
  175. #endif
  176. // RowCountryCode wizard page
  177. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  178. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  179. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  180. psp[pi].hInstance = glob_hinst;
  181. psp[pi].pszTemplate = idWizCountry;
  182. psp[pi].pfnDlgProc = WizCountryPropSheet;
  183. psp[pi].pszTitle = title;
  184. psp[pi].lParam = (LPARAM)our_params;
  185. psp[pi].pfnCallback = NULL;
  186. ++pi;
  187. #ifdef S_VS
  188. // MacAddress wizard page
  189. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  190. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  191. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  192. psp[pi].hInstance = glob_hinst;
  193. psp[pi].pszTemplate = idWizMac;
  194. psp[pi].pfnDlgProc = WizMacPropSheet;
  195. psp[pi].pszTitle = title;
  196. psp[pi].lParam = (LPARAM)our_params;
  197. psp[pi].pfnCallback = NULL;
  198. ++pi;
  199. #endif
  200. #ifdef S_VS
  201. // BackupServer wizard page
  202. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  203. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  204. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  205. psp[pi].hInstance = glob_hinst;
  206. psp[pi].pszTemplate = idWizBackup;
  207. psp[pi].pfnDlgProc = WizBackupPropSheet;
  208. psp[pi].pszTitle = title;
  209. psp[pi].lParam = (LPARAM)our_params;
  210. psp[pi].pfnCallback = NULL;
  211. ++pi;
  212. #endif
  213. // Done wizard page
  214. psp[pi].dwSize = sizeof(PROPSHEETPAGE);
  215. //psp[pi].dwFlags = PSP_USEICONID | PSP_USETITLE;
  216. psp[pi].dwFlags = PSP_USETITLE | PSP_HASHELP;
  217. psp[pi].hInstance = glob_hinst;
  218. psp[pi].pszTemplate = idWizDone;
  219. psp[pi].pfnDlgProc = WizDonePropSheet;
  220. psp[pi].pszTitle = title;
  221. psp[pi].lParam = (LPARAM)our_params;
  222. psp[pi].pfnCallback = NULL;
  223. ++pi;
  224. return 0;
  225. }
  226. /*------------------------------------------------------------------------
  227. | DoAddWizPropPages - Main driver level property sheet for NT4.0
  228. |------------------------------------------------------------------------*/
  229. int DoAddWizPropPages(HWND hwndOwner)
  230. {
  231. PROPSHEETPAGE psp[NUM_DEVPROP_SHEETS];
  232. PROPSHEETHEADER psh;
  233. OUR_INFO *our_params;
  234. INT stat;
  235. AddWiz_Config *aw_info;
  236. #ifdef S_RK
  237. INT i, j;
  238. static WORD preferred_addresses[] = {0x180, 0x100, 0x140, 0x1c0,
  239. 0x200, 0x240, 0x280, 0x2c0,
  240. 0x300, 0x340, 0x380, 0x3c0, 0};
  241. #endif
  242. our_params = glob_info; // temporary kludge, unless we don't need re-entrantancy
  243. // init our add_wiz struct
  244. aw_info = glob_add_wiz;
  245. memset(aw_info, 0, sizeof(*aw_info));
  246. // set some defaults
  247. aw_info->CountryIdx = 0;
  248. #ifdef S_RK
  249. aw_info->NumPorts = 8;
  250. strcpy(aw_info->BoardType, szRocketPort);
  251. aw_info->IoAddress = 0; // next we'll try to pick a logical default address
  252. for (i = 0; (preferred_addresses[i] != 0) && (aw_info->IoAddress == 0); i++)
  253. {
  254. aw_info->IoAddress = preferred_addresses[i]; // our assumption
  255. for (j = 0; (j < glob_info->device_selected) && (aw_info->IoAddress != 0); j++)
  256. {
  257. if (wi->dev[j].IoAddress == preferred_addresses[i])
  258. // not available, so undo this default
  259. aw_info->IoAddress = 0;
  260. }
  261. }
  262. #else
  263. aw_info->NumPorts = 16;
  264. strcpy(aw_info->BoardType, szSerialHub); // first in list
  265. memset(aw_info->MacAddr, 0, sizeof(aw_info->MacAddr));
  266. aw_info->BackupServer = 0;
  267. aw_info->BackupTimer = 2;
  268. #endif
  269. //Fill out the PROPSHEETPAGE data structure for the Client Area Shape
  270. //sheet
  271. FillDevicePropSheets(&psp[0], (LPARAM)our_params);
  272. //Fill out the PROPSHEETHEADER
  273. memset(&psh, 0, sizeof(PROPSHEETHEADER)); // add fix 11-24-98
  274. psh.dwSize = sizeof(PROPSHEETHEADER);
  275. psh.dwFlags = PSH_PROPSHEETPAGE | PSH_WIZARD | PSH_NOAPPLYNOW;
  276. psh.hwndParent = hwndOwner;
  277. psh.hInstance = glob_hinst;
  278. psh.pszIcon = "";
  279. psh.pszCaption = (LPSTR)"Add Device Wizard";
  280. psh.nPages = NUM_DEVPROP_SHEETS;
  281. psh.ppsp = (LPCPROPSHEETPAGE) &psp;
  282. //And finally display the dialog with the property sheets.
  283. stat = PropertySheet(&psh);
  284. if (aw_info->finished)
  285. return 0; // ok
  286. else
  287. return 1; // canceled out
  288. }
  289. /*----------------------------------------------------------
  290. WizIntroPropSheet -
  291. |-------------------------------------------------------------*/
  292. BOOL WINAPI WizIntroPropSheet(
  293. IN HWND hDlg,
  294. IN UINT uMessage,
  295. IN WPARAM wParam,
  296. IN LPARAM lParam)
  297. {
  298. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  299. switch(uMessage)
  300. {
  301. case WM_INITDIALOG :
  302. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  303. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  304. return TRUE; // No need for us to set the focus.
  305. case WM_PAINT:
  306. return FALSE;
  307. case WM_HELP:
  308. our_context_help(lParam);
  309. return FALSE;
  310. case WM_NOTIFY :
  311. switch (((NMHDR *)lParam)->code)
  312. {
  313. case PSN_HELP :
  314. our_help(&wi->ip, IDD_ADD_WIZ_INTRO);
  315. break;
  316. case PSN_SETACTIVE:
  317. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_NEXT);
  318. break;
  319. case PSN_WIZNEXT:
  320. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  321. return TRUE;
  322. default :
  323. return FALSE;
  324. }
  325. default :
  326. return FALSE;
  327. }
  328. }
  329. #ifdef S_RK
  330. /*----------------------------------------------------------
  331. WizBusPropSheet -
  332. |-------------------------------------------------------------*/
  333. BOOL WINAPI WizBusPropSheet(
  334. IN HWND hDlg,
  335. IN UINT uMessage,
  336. IN WPARAM wParam,
  337. IN LPARAM lParam)
  338. {
  339. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  340. switch(uMessage)
  341. {
  342. case WM_INITDIALOG :
  343. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  344. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  345. return TRUE; // No need for us to set the focus.
  346. case WM_PAINT:
  347. #if 0
  348. PaintIcon(hDlg);
  349. #endif
  350. return FALSE;
  351. case WM_HELP:
  352. our_context_help(lParam);
  353. return FALSE;
  354. case WM_NOTIFY :
  355. switch (((NMHDR *)lParam)->code)
  356. {
  357. case PSN_HELP :
  358. our_help(&wi->ip, IDD_ADD_WIZ_BUSTYPE);
  359. break;
  360. case PSN_SETACTIVE:
  361. set_field(hDlg, IDC_WIZ_ISA);
  362. set_field(hDlg, IDC_WIZ_PCI);
  363. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  364. break;
  365. case PSN_WIZNEXT:
  366. get_field(hDlg, IDC_WIZ_ISA);
  367. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  368. return TRUE;
  369. default :
  370. return FALSE;
  371. }
  372. default :
  373. return FALSE;
  374. }
  375. }
  376. #endif
  377. #ifdef S_RK
  378. /*----------------------------------------------------------
  379. WizModelPropSheet -
  380. |-------------------------------------------------------------*/
  381. BOOL WINAPI WizModelPropSheet(
  382. IN HWND hDlg,
  383. IN UINT uMessage,
  384. IN WPARAM wParam,
  385. IN LPARAM lParam)
  386. {
  387. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  388. switch(uMessage)
  389. {
  390. case WM_INITDIALOG :
  391. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  392. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  393. return TRUE; // No need for us to set the focus.
  394. case WM_PAINT:
  395. #if 0
  396. PaintIcon(hDlg);
  397. #endif
  398. return FALSE;
  399. case WM_HELP:
  400. our_context_help(lParam);
  401. return FALSE;
  402. case WM_NOTIFY :
  403. switch (((NMHDR *)lParam)->code)
  404. {
  405. case PSN_SETACTIVE:
  406. set_field(hDlg, IDC_WIZ_CBOX_BOARD);
  407. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  408. break;
  409. case PSN_HELP :
  410. our_help(&wi->ip, IDD_ADD_WIZ_BOARD);
  411. break;
  412. case PSN_WIZNEXT:
  413. get_field(hDlg, IDC_WIZ_CBOX_BOARD);
  414. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  415. return TRUE;
  416. default :
  417. return FALSE;
  418. }
  419. default :
  420. return FALSE;
  421. }
  422. }
  423. #endif
  424. #ifdef S_VS
  425. /*----------------------------------------------------------
  426. WizDevicePropSheet -
  427. |-------------------------------------------------------------*/
  428. BOOL WINAPI WizDevicePropSheet(
  429. IN HWND hDlg,
  430. IN UINT uMessage,
  431. IN WPARAM wParam,
  432. IN LPARAM lParam)
  433. {
  434. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  435. switch(uMessage)
  436. {
  437. case WM_INITDIALOG :
  438. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  439. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  440. return TRUE; // No need for us to set the focus.
  441. case WM_PAINT:
  442. return FALSE;
  443. case WM_HELP:
  444. our_context_help(lParam);
  445. return FALSE;
  446. case WM_NOTIFY :
  447. switch (((NMHDR *)lParam)->code)
  448. {
  449. case PSN_SETACTIVE:
  450. set_field(hDlg, IDC_WIZ_CBOX_DEVICE);
  451. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  452. break;
  453. case PSN_HELP :
  454. our_help(&wi->ip, IDD_ADD_WIZ_DEVICE);
  455. break;
  456. case PSN_WIZNEXT:
  457. get_field(hDlg, IDC_WIZ_CBOX_DEVICE);
  458. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  459. return TRUE;
  460. default :
  461. return FALSE;
  462. }
  463. default :
  464. return FALSE;
  465. }
  466. }
  467. #endif
  468. /*----------------------------------------------------------
  469. WizNumPortsPropSheet -
  470. |-------------------------------------------------------------*/
  471. BOOL WINAPI WizNumPortsPropSheet(
  472. IN HWND hDlg,
  473. IN UINT uMessage,
  474. IN WPARAM wParam,
  475. IN LPARAM lParam)
  476. {
  477. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  478. AddWiz_Config *aw;
  479. aw = glob_add_wiz;
  480. switch(uMessage)
  481. {
  482. case WM_INITDIALOG :
  483. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  484. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  485. return TRUE; // No need for us to set the focus.
  486. case WM_PAINT:
  487. return FALSE;
  488. case WM_HELP:
  489. our_context_help(lParam);
  490. return FALSE;
  491. case WM_NOTIFY :
  492. switch (((NMHDR *)lParam)->code)
  493. {
  494. case PSN_SETACTIVE:
  495. set_field(hDlg, IDC_WIZ_CBOX_NUMPORTS);
  496. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  497. break;
  498. case PSN_HELP :
  499. our_help(&wi->ip, IDD_ADD_WIZ_NUMPORTS);
  500. break;
  501. case PSN_WIZNEXT:
  502. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  503. get_field(hDlg, IDC_WIZ_CBOX_NUMPORTS);
  504. #ifdef S_RK
  505. if (!aw->IsIsa) {
  506. // PCI
  507. if (!aw->IsModemDev) {
  508. // not a RocketModem, so we're done
  509. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizDone);
  510. // tell sheet not to handle advance -- we overrode it
  511. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  512. }
  513. else
  514. {
  515. // new PCI RocketModem, so prompt for country
  516. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizCountry);
  517. // tell sheet not to handle advance -- we overrode it
  518. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  519. }
  520. }
  521. #else
  522. #ifdef VS2000_ROW_SUPPORT
  523. if (!aw->IsModemDev)
  524. {
  525. #endif
  526. // not a VS2000 - and/or - no ROW support; skip over Country page
  527. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizMac);
  528. // tell sheet not to handle advance -- we overrode it
  529. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  530. #ifdef VS2000_ROW_SUPPORT
  531. }
  532. #endif
  533. #endif
  534. return TRUE;
  535. default :
  536. return FALSE;
  537. }
  538. default :
  539. return FALSE;
  540. }
  541. }
  542. #ifdef S_RK
  543. /*----------------------------------------------------------
  544. WizIoBasePropSheet -
  545. |-------------------------------------------------------------*/
  546. BOOL WINAPI WizIoBasePropSheet(
  547. IN HWND hDlg,
  548. IN UINT uMessage,
  549. IN WPARAM wParam,
  550. IN LPARAM lParam)
  551. {
  552. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  553. AddWiz_Config *aw;
  554. aw = glob_add_wiz;
  555. switch(uMessage)
  556. {
  557. case WM_INITDIALOG :
  558. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  559. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  560. return TRUE; // No need for us to set the focus.
  561. case WM_PAINT:
  562. return FALSE;
  563. case WM_HELP:
  564. our_context_help(lParam);
  565. return FALSE;
  566. case WM_NOTIFY :
  567. switch (((NMHDR *)lParam)->code)
  568. {
  569. case PSN_SETACTIVE:
  570. set_field(hDlg, IDC_WIZ_CBOX_IOADDR);
  571. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  572. break;
  573. case PSN_HELP :
  574. our_help(&wi->ip, IDD_ADD_WIZ_BASEIO);
  575. break;
  576. case PSN_WIZNEXT:
  577. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  578. get_field(hDlg, IDC_WIZ_CBOX_IOADDR);
  579. if (!aw->IsModemDev) {
  580. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizDone);
  581. // tell sheet not to handle advance -- we overrode it
  582. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  583. }
  584. return TRUE;
  585. default :
  586. return FALSE;
  587. }
  588. default :
  589. return FALSE;
  590. }
  591. }
  592. #endif
  593. /*----------------------------------------------------------
  594. WizCountryPropSheet -
  595. |-------------------------------------------------------------*/
  596. BOOL WINAPI WizCountryPropSheet(
  597. IN HWND hDlg,
  598. IN UINT uMessage,
  599. IN WPARAM wParam,
  600. IN LPARAM lParam)
  601. {
  602. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  603. AddWiz_Config *aw;
  604. aw = glob_add_wiz;
  605. switch(uMessage)
  606. {
  607. case WM_INITDIALOG :
  608. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  609. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  610. return TRUE; // No need for us to set the focus.
  611. case WM_PAINT:
  612. return FALSE;
  613. case WM_HELP:
  614. our_context_help(lParam);
  615. return FALSE;
  616. case WM_NOTIFY :
  617. switch (((NMHDR *)lParam)->code)
  618. {
  619. case PSN_SETACTIVE:
  620. set_field(hDlg, IDC_WIZ_CBOX_COUNTRY);
  621. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  622. break;
  623. case PSN_HELP :
  624. our_help(&wi->ip, IDD_ADD_WIZ_COUNTRY);
  625. break;
  626. case PSN_WIZBACK:
  627. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  628. if (aw->IsIsa == 0)
  629. {
  630. // PCI RocketModem: back up to numports dialog instead of ioaddr
  631. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizNumPorts);
  632. // tell sheet not to handle advance -- we overrode it
  633. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  634. }
  635. return TRUE;
  636. case PSN_WIZNEXT:
  637. get_field(hDlg, IDC_WIZ_CBOX_COUNTRY);
  638. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  639. return TRUE;
  640. default :
  641. return FALSE;
  642. }
  643. default :
  644. return FALSE;
  645. }
  646. }
  647. #ifdef S_VS
  648. /*----------------------------------------------------------
  649. WizMacPropSheet -
  650. |-------------------------------------------------------------*/
  651. BOOL WINAPI WizMacPropSheet(
  652. IN HWND hDlg,
  653. IN UINT uMessage,
  654. IN WPARAM wParam,
  655. IN LPARAM lParam)
  656. {
  657. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  658. AddWiz_Config *aw;
  659. aw = glob_add_wiz;
  660. switch(uMessage)
  661. {
  662. case WM_INITDIALOG :
  663. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  664. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  665. return TRUE; // No need for us to set the focus.
  666. case WM_PAINT:
  667. return FALSE;
  668. case WM_HELP:
  669. our_context_help(lParam);
  670. return FALSE;
  671. case WM_NOTIFY :
  672. switch (((NMHDR *)lParam)->code)
  673. {
  674. case PSN_SETACTIVE:
  675. set_field(hDlg, IDC_WIZ_CBOX_MAC);
  676. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  677. break;
  678. case PSN_HELP :
  679. our_help(&wi->ip, IDD_ADD_WIZ_MAC);
  680. break;
  681. case PSN_WIZBACK:
  682. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  683. #ifdef VS2000_ROW_SUPPORT
  684. if (!aw->IsModemDev)
  685. {
  686. #endif
  687. // not a VS2000 - and/or - no ROW support; skip over Country page
  688. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizNumPorts);
  689. // tell sheet not to handle advance -- we overrode it
  690. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  691. #ifdef VS2000_ROW_SUPPORT
  692. }
  693. #endif
  694. break;
  695. case PSN_WIZNEXT:
  696. get_field(hDlg, IDC_WIZ_CBOX_MAC);
  697. if (InvalidMacAddress == 1)
  698. // don't allow advance to next field
  699. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  700. else
  701. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  702. return TRUE;
  703. default :
  704. return FALSE;
  705. }
  706. default :
  707. return FALSE;
  708. }
  709. }
  710. #endif
  711. #ifdef S_VS
  712. /*----------------------------------------------------------
  713. WizBackupPropSheet -
  714. |-------------------------------------------------------------*/
  715. BOOL WINAPI WizBackupPropSheet(
  716. IN HWND hDlg,
  717. IN UINT uMessage,
  718. IN WPARAM wParam,
  719. IN LPARAM lParam)
  720. {
  721. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  722. char tmpstr[60];
  723. WORD uCmd;
  724. HWND hwnd;
  725. AddWiz_Config *aw;
  726. aw = glob_add_wiz;
  727. switch(uMessage)
  728. {
  729. case WM_INITDIALOG :
  730. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  731. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  732. return TRUE; // No need for us to set the focus.
  733. case WM_PAINT:
  734. return FALSE;
  735. case WM_HELP:
  736. our_context_help(lParam);
  737. return FALSE;
  738. case WM_COMMAND:
  739. uCmd = HIWORD(wParam);
  740. switch (LOWORD(wParam))
  741. {
  742. case IDC_WIZ_BACKUP_YES:
  743. case IDC_WIZ_BACKUP_NO:
  744. //--- enable or disable backup-timer field depending on backup server[]
  745. hwnd = GetDlgItem(hDlg, IDC_WIZ_CBOX_BACKUPTIME);
  746. if (IsDlgButtonChecked(hDlg, IDC_WIZ_BACKUP_YES))
  747. EnableWindow(hwnd,1);
  748. else EnableWindow(hwnd,0);
  749. break;
  750. }
  751. break;
  752. case WM_NOTIFY :
  753. switch (((NMHDR *)lParam)->code)
  754. {
  755. case PSN_SETACTIVE:
  756. set_field(hDlg, IDC_WIZ_BACKUP_YES);
  757. set_field(hDlg, IDC_WIZ_CBOX_BACKUPTIME);
  758. //--- enable or disable backup-timer field depending on backup server[]
  759. hwnd = GetDlgItem(hDlg, IDC_WIZ_CBOX_BACKUPTIME);
  760. if (IsDlgButtonChecked(hDlg, IDC_WIZ_BACKUP_YES))
  761. EnableWindow(hwnd,1);
  762. else EnableWindow(hwnd,0);
  763. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_NEXT);
  764. break;
  765. case PSN_HELP :
  766. our_help(&wi->ip, IDD_ADD_WIZ_BACKUP);
  767. break;
  768. case PSN_WIZNEXT:
  769. get_field(hDlg, IDC_WIZ_BACKUP_YES);
  770. get_field(hDlg, IDC_WIZ_CBOX_BACKUPTIME);
  771. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  772. return TRUE;
  773. default :
  774. return FALSE;
  775. }
  776. default :
  777. return FALSE;
  778. }
  779. }
  780. #endif
  781. /*----------------------------------------------------------
  782. WizDonePropSheet -
  783. |-------------------------------------------------------------*/
  784. BOOL WINAPI WizDonePropSheet(
  785. IN HWND hDlg,
  786. IN UINT uMessage,
  787. IN WPARAM wParam,
  788. IN LPARAM lParam)
  789. {
  790. OUR_INFO *OurProps = (OUR_INFO *)GetWindowLong(hDlg, DWL_USER);
  791. AddWiz_Config *aw;
  792. aw = glob_add_wiz;
  793. switch(uMessage)
  794. {
  795. case WM_INITDIALOG :
  796. OurProps = (OUR_INFO *)((LPPROPSHEETPAGE)lParam)->lParam;
  797. SetWindowLong(hDlg, DWL_USER, (LONG)OurProps);
  798. return TRUE; // No need for us to set the focus.
  799. case WM_PAINT:
  800. return FALSE;
  801. case WM_HELP:
  802. our_context_help(lParam);
  803. return FALSE;
  804. case WM_NOTIFY :
  805. switch (((NMHDR *)lParam)->code)
  806. {
  807. case PSN_SETACTIVE:
  808. PropSheet_SetWizButtons(GetParent(hDlg), PSWIZB_BACK | PSWIZB_FINISH);
  809. break;
  810. case PSN_HELP :
  811. our_help(&wi->ip, IDD_ADD_WIZ_DONE);
  812. break;
  813. #ifdef S_RK
  814. case PSN_WIZBACK:
  815. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  816. if (!aw->IsModemDev)
  817. {
  818. if (!aw->IsIsa)
  819. {
  820. // back up to the numports dialog
  821. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizNumPorts);
  822. // tell sheet not to handle advance -- we overrode it
  823. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  824. }
  825. else
  826. {
  827. // back up to the base io dialog
  828. PropSheet_SetCurSelByID(((NMHDR *)lParam)->hwndFrom, idWizIoBase);
  829. // tell sheet not to handle advance -- we overrode it
  830. SetWindowLong(hDlg, DWL_MSGRESULT, -1);
  831. }
  832. }
  833. return TRUE;
  834. #endif
  835. case PSN_WIZNEXT:
  836. case PSN_WIZFINISH:
  837. aw->finished = 1;
  838. SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
  839. return TRUE;
  840. default :
  841. return FALSE;
  842. }
  843. default :
  844. return FALSE;
  845. }
  846. }
  847. #ifdef S_VS
  848. /*----------------------------------------------------------
  849. set_mac_field -
  850. |------------------------------------------------------------*/
  851. static int set_mac_field(HWND hDlg, WORD id)
  852. {
  853. HWND hwnd;
  854. char tmpstr[60];
  855. int stat;
  856. int i;
  857. int addr_used, nbytes, found;
  858. BYTE *macbuf;
  859. BYTE *mac;
  860. AddWiz_Config *aw;
  861. aw = glob_add_wiz;
  862. //------------------ fill in mac addr selection
  863. hwnd = GetDlgItem(hDlg, id);
  864. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  865. // alloc 8byte mac-address fields(2 times as many as could be configured)
  866. found = 0;
  867. nbytes = 0;
  868. macbuf = our_get_ping_list(&stat, &nbytes);
  869. if (stat == 0)
  870. {
  871. for (i=0; i<nbytes/8; i++)
  872. {
  873. mac = &macbuf[i*8];
  874. //if (mac_match(mac, aw->MacAddr))
  875. // found = 1;
  876. //mess("macgot:%s",macbuf);
  877. format_mac_addr(tmpstr, mac);
  878. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) tmpstr);
  879. }
  880. }
  881. addr_used = 1;
  882. if ( (mac_match(aw->MacAddr, broadcast_addr)) ||
  883. (mac_match(aw->MacAddr, mac_zero_addr)) )
  884. addr_used = 0;
  885. if (addr_used)
  886. {
  887. mac = &aw->MacAddr[0];
  888. format_mac_addr(tmpstr, mac);
  889. if (!found) // configured mac-addr not in list yet
  890. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) tmpstr);
  891. }
  892. else
  893. {
  894. memset(aw->MacAddr, 0, 6);
  895. strcpy(tmpstr, "00 C0 4E # # #");
  896. }
  897. // set the text in the window
  898. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "00 C0 4E # # #");
  899. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) tmpstr);
  900. return 0;
  901. }
  902. #endif
  903. /*-------------------------------------------------------------------
  904. | get_field - Run when a selection is changed.
  905. |--------------------------------------------------------------------*/
  906. static void get_field(HWND hDlg, WORD id)
  907. {
  908. char tmpstr[60];
  909. int i;
  910. AddWiz_Config *aw;
  911. aw = glob_add_wiz;
  912. switch (id)
  913. {
  914. #ifdef S_RK
  915. case IDC_WIZ_ISA:
  916. case IDC_WIZ_PCI:
  917. if (IsDlgButtonChecked(hDlg, IDC_WIZ_ISA))
  918. aw->IsIsa = 1;
  919. else aw->IsIsa = 0;
  920. break;
  921. #endif
  922. #ifdef S_RK
  923. case IDC_WIZ_CBOX_BOARD:
  924. GetDlgItemText(hDlg, id, aw->BoardType, sizeof(aw->BoardType));
  925. aw->IsModemDev = 0;
  926. if (!strcmp(aw->BoardType, szRocketModem))
  927. aw->IsModemDev = TYPE_RM_VS2000;
  928. else if (!strcmp(aw->BoardType, szRocketModemII))
  929. aw->IsModemDev = TYPE_RMII;
  930. else if (!strcmp(aw->BoardType, szRocketModem_i))
  931. aw->IsModemDev = TYPE_RM_i;
  932. break;
  933. #endif
  934. #ifdef S_VS
  935. case IDC_WIZ_CBOX_DEVICE:
  936. GetDlgItemText(hDlg, id, aw->BoardType, sizeof(aw->BoardType));
  937. if (!strcmp(aw->BoardType, szSerialHub))
  938. {
  939. aw->IsHub = 1;
  940. aw->IsModemDev = 0;
  941. }
  942. else
  943. {
  944. aw->IsHub = 0;
  945. if (!strcmp(aw->BoardType, szVS2000))
  946. aw->IsModemDev = TYPE_RM_VS2000;
  947. else
  948. aw->IsModemDev = 0;
  949. }
  950. break;
  951. #endif
  952. #ifdef S_RK
  953. case IDC_WIZ_CBOX_IOADDR:
  954. GetDlgItemText(hDlg, id, tmpstr, 58);
  955. aw->IoAddress = gethint(tmpstr, &i);
  956. break;
  957. #endif
  958. case IDC_WIZ_CBOX_NUMPORTS:
  959. GetDlgItemText(hDlg, id, tmpstr, 58);
  960. aw->NumPorts = getint(tmpstr, &i);
  961. break;
  962. case IDC_WIZ_CBOX_COUNTRY:
  963. GetDlgItemText(hDlg, id, tmpstr, 58);
  964. aw->CountryIdx = 0;
  965. if (aw->IsModemDev == TYPE_RM_VS2000) {
  966. for (
  967. i = 0;
  968. i < NUM_ROW_COUNTRIES;
  969. i++
  970. ) {
  971. if (!strcmp(tmpstr, RowInfo[i].RowCountryName)) {
  972. aw->CountryIdx = i;
  973. aw->CountryCode = RowInfo[i].RowCountryCode;
  974. break;
  975. }
  976. }
  977. }
  978. else if (aw->IsModemDev == TYPE_RM_i) {
  979. for (
  980. i = 0;
  981. i < NUM_CTR_ROW_COUNTRIES;
  982. i++
  983. ) {
  984. if (!strcmp(tmpstr, CTRRowInfo[i].RowCountryName)) {
  985. aw->CountryIdx = i;
  986. aw->CountryCode = CTRRowInfo[i].RowCountryCode;
  987. break;
  988. }
  989. }
  990. }
  991. else if (aw->IsModemDev) {
  992. aw->CountryIdx = 0;
  993. aw->CountryCode = RowInfo[0].RowCountryCode;
  994. }
  995. break;
  996. #ifdef S_VS
  997. case IDC_WIZ_CBOX_MAC:
  998. // get_mac_field() is shared and is in devprop.c
  999. InvalidMacAddress = get_mac_field(hDlg, id, aw->MacAddr);
  1000. break;
  1001. case IDC_WIZ_BACKUP_NO:
  1002. case IDC_WIZ_BACKUP_YES:
  1003. if (IsDlgButtonChecked(hDlg, IDC_WIZ_BACKUP_YES))
  1004. aw->BackupServer = 1;
  1005. else aw->BackupServer = 0;
  1006. break;
  1007. case IDC_WIZ_CBOX_BACKUPTIME:
  1008. //------------------ get the backup timer value
  1009. GetDlgItemText(hDlg, id, tmpstr, 19);
  1010. if (sscanf(tmpstr, "%ld", &i) == 1)
  1011. aw->BackupTimer = i;
  1012. if (aw->BackupTimer < 2)
  1013. aw->BackupTimer = 2;
  1014. break;
  1015. #endif
  1016. }
  1017. }
  1018. /*----------------------------------------------------------
  1019. set_field -
  1020. |------------------------------------------------------------*/
  1021. static void set_field(HWND hDlg, WORD id)
  1022. {
  1023. HWND hwnd;
  1024. char tmpstr[60];
  1025. int i;
  1026. #ifdef S_RK
  1027. int j;
  1028. BOOL is_avail;
  1029. WORD baseaddr;
  1030. static WORD hex_addresses[] = {0x100, 0x140, 0x180, 0x1c0,
  1031. 0x200, 0x240, 0x280, 0x2c0,
  1032. 0x300, 0x340, 0x380, 0x3c0, 0};
  1033. #endif
  1034. AddWiz_Config *aw;
  1035. aw = glob_add_wiz;
  1036. switch(id)
  1037. {
  1038. #ifdef S_RK
  1039. case IDC_WIZ_ISA:
  1040. SendDlgItemMessage(hDlg, IDC_WIZ_ISA, BM_SETCHECK, aw->IsIsa, 0);
  1041. SendDlgItemMessage(hDlg, IDC_WIZ_PCI, BM_SETCHECK, 1 - aw->IsIsa, 0);
  1042. break;
  1043. #endif
  1044. #ifdef S_RK
  1045. case IDC_WIZ_CBOX_BOARD:
  1046. //------------------ fill in board type (model) selection
  1047. hwnd = GetDlgItem(hDlg, id);
  1048. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1049. if (aw->IsIsa) {
  1050. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketPort);
  1051. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketPort485);
  1052. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketModem);
  1053. }
  1054. else
  1055. {
  1056. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketPort);
  1057. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketPortPlus);
  1058. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketModemII);
  1059. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szRocketModem_i);
  1060. }
  1061. // make sure there's a default
  1062. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) "R");
  1063. // now try to select the last device chosen by user. it may not be valid
  1064. // if the user switched from ISA to PCI (for example) and the choice
  1065. // isn't available on the new bus.
  1066. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) aw->BoardType);
  1067. break;
  1068. #endif
  1069. #ifdef S_VS
  1070. case IDC_WIZ_CBOX_DEVICE:
  1071. //------------------ fill in board type (model) selection
  1072. hwnd = GetDlgItem(hDlg, id);
  1073. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1074. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szVS1000);
  1075. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szVS2000);
  1076. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szSerialHub);
  1077. // make sure there's a default
  1078. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) aw->BoardType);
  1079. break;
  1080. #endif
  1081. #ifdef S_RK
  1082. case IDC_WIZ_CBOX_IOADDR:
  1083. //------------------ fill in io base address selection
  1084. hwnd = GetDlgItem(hDlg, id);
  1085. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1086. for (i = 0; hex_addresses[i] != 0; i++)
  1087. {
  1088. baseaddr = hex_addresses[i];
  1089. // see if this base address already chosen by another card
  1090. is_avail = TRUE; // our assumption
  1091. for (j = 0; (j < glob_info->device_selected) && (is_avail); j++)
  1092. {
  1093. if (wi->dev[j].IoAddress == baseaddr)
  1094. is_avail = FALSE;
  1095. }
  1096. if (is_avail)
  1097. {
  1098. wsprintf(tmpstr, "%x Hex", baseaddr);
  1099. if (baseaddr == 0x180)
  1100. strcat(tmpstr, " (default)");
  1101. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)tmpstr);
  1102. }
  1103. }
  1104. // now make the previous choice the default choice
  1105. if (aw->IoAddress == 0x180)
  1106. wsprintf(tmpstr, "%x hex (default)", aw->IoAddress);
  1107. else
  1108. wsprintf(tmpstr, "%x hex", aw->IoAddress);
  1109. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) tmpstr);
  1110. break;
  1111. #endif
  1112. case IDC_WIZ_CBOX_NUMPORTS:
  1113. //------------------ fill in numports selection
  1114. hwnd = GetDlgItem(hDlg, id);
  1115. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1116. #ifdef S_RK
  1117. if ((aw->IsModemDev) && (aw->IsIsa == 0))
  1118. {
  1119. // PCI RocketModem can be 4 or 6 ports
  1120. # ifdef ROCKETMODEM_PCI4_SUPPORT
  1121. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP4);
  1122. # endif
  1123. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP6);
  1124. // default the number of ports for the pci rocketmodem to 6
  1125. aw->NumPorts = 6;
  1126. }
  1127. else
  1128. {
  1129. // all other boards follow this logic:
  1130. if (strstr(aw->BoardType, szRocketPortPlus))
  1131. {
  1132. // Rocketport Plus available in a 2-port version
  1133. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP2);
  1134. }
  1135. if (!strstr(aw->BoardType, szRocketPort485))
  1136. {
  1137. // all except Rocketport 485 available in a 4-port version
  1138. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP4);
  1139. }
  1140. // all RocketPort variations available in an 8-port version
  1141. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP8);
  1142. if (strlen(aw->BoardType) == strlen(szRocketPort))
  1143. {
  1144. // only standard boards available in 16 & 32 port versions
  1145. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP16);
  1146. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP32);
  1147. }
  1148. }
  1149. wsprintf(tmpstr, "%d", aw->NumPorts);
  1150. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) tmpstr);
  1151. #else // S_VS
  1152. if (aw->IsModemDev)
  1153. {
  1154. // VS2000 only available in 8 port configuration
  1155. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP8);
  1156. // default the number of ports for the VS2000 to 8
  1157. aw->NumPorts = 8;
  1158. }
  1159. else if (aw->IsHub)
  1160. {
  1161. // SerialHub available in 4 (not yet) and 8 port configuration
  1162. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP4);
  1163. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP8);
  1164. // default the number of ports for the Serial Hub to 8
  1165. aw->NumPorts = 8;
  1166. }
  1167. else
  1168. {
  1169. // we must have a VS1000 or VS1000/VS1100 combo
  1170. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP16);
  1171. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP32);
  1172. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP48);
  1173. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)szNP64);
  1174. // default the number of ports for the VS1000 to 16
  1175. aw->NumPorts = 16;
  1176. }
  1177. wsprintf(tmpstr, "%d", aw->NumPorts);
  1178. SendMessage(hwnd, CB_SELECTSTRING, (WPARAM)-1, (LPARAM)(char far *) tmpstr);
  1179. #endif // S_VS
  1180. break;
  1181. case IDC_WIZ_CBOX_COUNTRY:
  1182. //------------------ fill in country selection
  1183. hwnd = GetDlgItem(hDlg, id);
  1184. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1185. if (aw->IsModemDev == TYPE_RM_VS2000) {
  1186. for (
  1187. i = 0;
  1188. i < NUM_ROW_COUNTRIES;
  1189. ++i
  1190. ) {
  1191. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(RowInfo[i].RowCountryName));
  1192. }
  1193. SendMessage(
  1194. hwnd,
  1195. CB_SELECTSTRING,
  1196. (WPARAM)-1,
  1197. (LPARAM)(RowInfo[aw->CountryIdx].RowCountryName));
  1198. }
  1199. else if (aw->IsModemDev == TYPE_RM_i) {
  1200. for (
  1201. i = 0;
  1202. i < NUM_CTR_ROW_COUNTRIES;
  1203. ++i
  1204. ) {
  1205. SendMessage(
  1206. hwnd,
  1207. CB_ADDSTRING,
  1208. 0,
  1209. (LPARAM)(CTRRowInfo[i].RowCountryName));
  1210. }
  1211. SendMessage(
  1212. hwnd,
  1213. CB_SELECTSTRING,
  1214. (WPARAM)-1,
  1215. (LPARAM)(CTRRowInfo[aw->CountryIdx].RowCountryName));
  1216. }
  1217. else if (aw->IsModemDev) {
  1218. SendMessage(
  1219. hwnd,
  1220. CB_ADDSTRING,
  1221. 0,
  1222. (LPARAM)(RowInfo[0].RowCountryName));
  1223. SendMessage(
  1224. hwnd,
  1225. CB_SELECTSTRING,
  1226. (WPARAM)-1,
  1227. (LPARAM)(RowInfo[0].RowCountryName));
  1228. }
  1229. break;
  1230. #ifdef S_VS
  1231. case IDC_WIZ_CBOX_MAC:
  1232. set_mac_field(hDlg, id);
  1233. break;
  1234. case IDC_WIZ_BACKUP_YES:
  1235. case IDC_WIZ_BACKUP_NO:
  1236. SendDlgItemMessage(hDlg, IDC_WIZ_BACKUP_YES, BM_SETCHECK,
  1237. aw->BackupServer, 0);
  1238. SendDlgItemMessage(hDlg, IDC_WIZ_BACKUP_NO, BM_SETCHECK,
  1239. 1 - aw->BackupServer, 0);
  1240. break;
  1241. case IDC_WIZ_CBOX_BACKUPTIME:
  1242. //------------------ fill in backup timer selection
  1243. hwnd = GetDlgItem(hDlg, IDC_WIZ_CBOX_BACKUPTIME);
  1244. SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
  1245. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "2 min");
  1246. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "5 min");
  1247. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "10 min");
  1248. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "30 min");
  1249. SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(char far *) "60 min");
  1250. if (aw->BackupTimer < 2)
  1251. aw->BackupTimer = 2; // 2 minutes, no less
  1252. wsprintf(tmpstr, "%d min", aw->BackupTimer);
  1253. SetDlgItemText(hDlg, IDC_WIZ_CBOX_BACKUPTIME, tmpstr);
  1254. break;
  1255. #endif
  1256. }
  1257. }
  1258. #if 0
  1259. /*---------------------------------------------------------------------------
  1260. PaintIcon - Paints the Icon in the property sheet.
  1261. |---------------------------------------------------------------------------*/
  1262. static int PaintIcon(HWND hWnd)
  1263. {
  1264. // int status;
  1265. HBITMAP hBitMap;
  1266. HGDIOBJ hGdiObj;
  1267. HDC hDC, hMemDC ;
  1268. PAINTSTRUCT ps ;
  1269. RECT spot, main; // left, top, right, bottom
  1270. static int cnt = 0;
  1271. GetWindowRect(GetDlgItem(hWnd, IDB_HELP), &spot);
  1272. GetWindowRect(hWnd, &main);
  1273. #ifdef COMMENT_OUT
  1274. rect = &right;
  1275. mess("hlp r:%d l:%d b:%d t:%d",
  1276. rect->right, rect->left, rect->bottom, rect->top);
  1277. #endif
  1278. spot.left -= main.left;
  1279. spot.top -= main.top;
  1280. spot.left += 5;
  1281. spot.top += 20; // spacing
  1282. // load bitmap and display it
  1283. hDC = BeginPaint( hWnd, &ps ) ;
  1284. if (NULL != (hMemDC = CreateCompatibleDC( hDC )))
  1285. {
  1286. hBitMap = LoadBitmap(glob_hinst,
  1287. MAKEINTRESOURCE(BMP_SMALL_LOGO));
  1288. hGdiObj = SelectObject(hMemDC, hBitMap);
  1289. BitBlt( hDC, spot.left, spot.top, 100, 100, hMemDC, 0, 0, SRCCOPY ) ;
  1290. //StretchBlt( hDC, 5, 5, 600,100, hMemDC, 0, 0, 446, 85, SRCCOPY ) ;
  1291. DeleteObject( SelectObject( hMemDC, hGdiObj ) ) ;
  1292. DeleteDC( hMemDC ) ;
  1293. }
  1294. EndPaint( hWnd, &ps ) ;
  1295. return 0;
  1296. }
  1297. #endif
  1298. /*-------------------------------------------------------------------
  1299. | my_strupr -
  1300. |--------------------------------------------------------------------*/
  1301. static void my_strupr(char *str)
  1302. {
  1303. while (*str != 0)
  1304. {
  1305. *str = (char) toupper(*str);
  1306. ++str;
  1307. }
  1308. }