Пример #1
0
void OnInitDialog(HWND hW) {
	char *dev;
	//int i;

	LoadConf();

	ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "Expansion");
	ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "PC Card");
	for (int j=0;j<2;j++)
	{
	for (int i=0; i<pcap_io_get_dev_num(); i++) {
		dev = pcap_io_get_dev_desc(i,j);
		int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), dev);
		ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup(pcap_io_get_dev_name(i,j)));
		if (strcmp(pcap_io_get_dev_name(i,j), config.Eth) == 0) {
			ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm);
		}
	}
	}
	vector<tap_adapter> * al=GetTapAdapters();
	for (size_t i=0; i<al->size(); i++) {
		
		int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str());
		ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup( al[0][i].guid.c_str()));
		if (strcmp(al[0][i].guid.c_str(), config.Eth) == 0) {
			ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm);
		}
	}

	Edit_SetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd);

	Button_SetCheck(GetDlgItem(hW, IDC_ETHENABLED), config.ethEnable);
	Button_SetCheck(GetDlgItem(hW, IDC_HDDENABLED), config.hddEnable);
}
Пример #2
0
//called when entering sh4 thread , from the new thread context (for any thread speciacific init)
s32 FASTCALL edInit(ext_device_init_params* p)
{
	params=*p;
	if (settings.mode!=0)
	{
		int nd=pcap_io_get_dev_num();
		printf("%d adapters\n",nd);
		for(int i=0;i<nd;i++)
		{
			printf("%d : %s :",i,pcap_io_get_dev_name(i));
			printf("\t%s\n",pcap_io_get_dev_desc(i));
		}

		printf("using :%d : %s :",settings.adapter,pcap_io_get_dev_name(settings.adapter));
		printf("\t%s\n",pcap_io_get_dev_desc(settings.adapter));
		pcap_io_init(pcap_io_get_dev_name(settings.adapter));
	}
	if (settings.mode==3)
		bba_init();

	return rv_ok;
}