int upnp_load_conf(const char *name,UPNP_PARA_t *_conf) { char tmp[32]; memset(_conf,0,sizeof(UPNP_PARA_t)); IniFileInitialize(name); _conf->num=IniFileGetInteger("upnp-conf","num",0); if(_conf->num == 0){ return -1; } strcpy(_conf->ip_gw,IniFileGetStr("upnp-conf","gateway","192.168.1.1")); strcpy(_conf->ip_me,IniFileGetStr("upnp-conf","ip","192.168.1.114")); printf("Request port map num %d gw:%s ip:%s\n",_conf->num, _conf->ip_gw,_conf->ip_me); int i; for(i=0;i<_conf->num;i++){ char secname[16]; sprintf(secname,"upnp%d",i+1); strcpy(tmp,IniFileGetStr(secname,"protocal","tcp")); if(strcmp(tmp,"tcp")==0){ _conf->port_maps[i].protocal=PROTOCAL_TCP; }else if(strcmp(tmp,"udp")==0){ _conf->port_maps[i].protocal=PROTOCAL_UDP; } _conf->port_maps[i].inPort=IniFileGetInteger(secname,"internal_port",80); _conf->port_maps[i].exPort=IniFileGetInteger(secname,"external_port",10080); printf("request map %d : %s %d -> %d\n",i+1,tmp,_conf->port_maps[i].inPort, _conf->port_maps[i].exPort); } IniFileCleanUp(); return 0; }
int ddns_load_conf(const char *name,DDNS_PARA_t *_conf) { char tmp[32]; memset(_conf,0,sizeof(UPNP_PARA_t)); IniFileInitialize(name); strcpy(tmp,IniFileGetStr("ddns-conf","server","none")); if(strcmp(tmp,"none") == 0){ return -1; } else if(strcmp(tmp,"changeip") == 0){ _conf->provider = DDNS_CHANGEIP; }else if(strcmp(tmp,"3322") == 0){ _conf->provider = DDNS_3322; }else if(strcmp(tmp,"dyndns") == 0){ _conf->provider = DDNS_DYNDNS; }else if(strcmp(tmp,"noip") == 0){ _conf->provider = DDNS_NOIP; }else{ printf("no vaild provider :%s\n",tmp); exit(0); } strcpy(_conf->changeip.register_url,IniFileGetStr("ddns-conf","domain","test.changeip.org")); strcpy(_conf->changeip.username,IniFileGetStr("ddns-conf","username","test")); strcpy(_conf->changeip.password,IniFileGetStr("ddns-conf","password","123456")); printf("[DDNS Load Config Done.]\n"); printf("\tprovider : %s\n",tmp); printf("\tdomain : %s\n",_conf->changeip.register_url); printf("\tusername : %s\n",_conf->changeip.username); printf("\tpassword : %s\n",_conf->changeip.password); IniFileCleanUp(); return 0; }
VOID RunLoader(VOID) { ULONG_PTR SectionId; ULONG OperatingSystemCount; OperatingSystemItem* OperatingSystemList; PCSTR* OperatingSystemDisplayNames; ULONG DefaultOperatingSystem; LONG TimeOut; ULONG SelectedOperatingSystem; ULONG i; if (!MachInitializeBootDevices()) { UiMessageBoxCritical("Error when detecting hardware."); return; } #ifdef _M_IX86 /* Load additional SCSI driver (if any) */ if (LoadBootDeviceDriver() != ESUCCESS) { UiMessageBoxCritical("Unable to load additional boot device drivers."); } #endif if (!IniFileInitialize()) { UiMessageBoxCritical("Error initializing .ini file."); return; } /* Debugger main initialization */ DebugInit(TRUE); if (!IniOpenSection("FreeLoader", &SectionId)) { UiMessageBoxCritical("Section [FreeLoader] not found in freeldr.ini."); return; } TimeOut = GetTimeOut(); /* UI main initialization */ if (!UiInitialize(TRUE)) { UiMessageBoxCritical("Unable to initialize UI."); return; } OperatingSystemList = InitOperatingSystemList(&OperatingSystemCount); if (!OperatingSystemList) { UiMessageBox("Unable to read operating systems section in freeldr.ini.\nPress ENTER to reboot."); goto Reboot; } if (OperatingSystemCount == 0) { UiMessageBox("There were no operating systems listed in freeldr.ini.\nPress ENTER to reboot."); goto Reboot; } DefaultOperatingSystem = GetDefaultOperatingSystem(OperatingSystemList, OperatingSystemCount); /* Create list of display names */ OperatingSystemDisplayNames = FrLdrTempAlloc(sizeof(PCSTR) * OperatingSystemCount, 'mNSO'); if (!OperatingSystemDisplayNames) goto Reboot; for (i = 0; i < OperatingSystemCount; i++) { OperatingSystemDisplayNames[i] = OperatingSystemList[i].LoadIdentifier; } /* Find all the message box settings and run them */ UiShowMessageBoxesInSection("FreeLoader"); for (;;) { /* Redraw the backdrop */ UiDrawBackdrop(); /* Show the operating system list menu */ if (!UiDisplayMenu("Please select the operating system to start:", "For troubleshooting and advanced startup options for " "ReactOS, press F8.", TRUE, OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, TimeOut, &SelectedOperatingSystem, FALSE, MainBootMenuKeyPressFilter)) { UiMessageBox("Press ENTER to reboot."); goto Reboot; } TimeOut = -1; /* Load the chosen operating system */ LoadOperatingSystem(&OperatingSystemList[SelectedOperatingSystem]); } Reboot: UiUnInitialize("Rebooting..."); return; }