⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yhnew3.c

📁 在dos 与Linux下通过命令来改变BIOS项设置。
💻 C
📖 第 1 页 / 共 3 页
字号:
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h> /* for libc5 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <i86.h>
#include "cmostool.h"
//extern int bios_init(void);
//extern  struct CMOSStruct cmosstruct;
//int tag=0;
struct yhCmosstruct{
	 int index;
	 int optionValue[15];
	 char optiondesction[14][30];
	 unsigned short currentValue;
	 char Key_input[10];
	 unsigned short cbit[14];
	 unsigned short start_post;
        unsigned short media;
	 int  token_index;
	 char description_info[60];
        int (*validate)();
       unsigned short (*readValue)();
        unsigned short (*writeValue)();
        void (*showValue)();
	 unsigned  short (*prasePam)();
};
struct yhCmosstruct_input{
	int index;
	// unsigned short optionValue[10];
	 //char optiondesction[10][20];
	int currentValuei[10];
	char currentValuec[20];
	 char Key_input[10];
	// short cbit[10];
	 //short start_post;
	 //int pos_location;
	    void (*done_input)();
	 char description_info[40];
        int (*validate)();
            void (*showValue)();
        void (*writeValue)();
	 unsigned  short (*prasePam)();
};
struct date_type
{
	char *value;
	int member;
};
struct link_type
{
	int id;
	struct date_type input;
	struct link_type *next;
	struct link_type *front;
};
struct date_type Bootdevicedefault[16]={
{"USB Key",11},
{"IDE2 SATA0", 2},
{"IDE3 SATA1",3},
{"IDE4 SATA2",4},
{"IDE5 SATA3",5},
{"IDE CDROM",0},
{"PCI BEV: NVIDIA",26},
{"PCI BEV: 2NVIDIA",27},
{"PCI BEV: 3NVIDIA",28},
{"Legacy Network Card",38},
{"Boot add Cards",43},
{"Floppy",7},
{"Legacy Diskette A",6},
{"PCI SCSI Card",33},
{"None",100},
{"None",100}
};
struct date_type Bootdevice[14]={{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100},{"None",100}};
struct date_type temp;
void system_call(char *paminput);
int vali_date(struct yhCmosstruct current_bcu,int paminut);
unsigned short prase_pam(struct yhCmosstruct current_bcu,int paminput);
//void write_value(struct yhCmosstruct current_bcu);
void  show_value(struct yhCmosstruct current_bcu);
int vali_date_mac(void);
int vali_date_mask(void);
int vali_date_ip_gw(void);
unsigned short boot_device_read(unsigned short  useless);
unsigned short boot_device_write(unsigned short  useless1, unsigned short  useless2);
void boot_device_show(struct yhCmosstruct current_bcu);
unsigned short boot_device_prase_pam(struct yhCmosstruct current_bcu,int paminput);
int boot_device_vali_date(struct yhCmosstruct current_bcu,int paminut);
int vali_date_d_dhcp(void);
unsigned short current_bootvlaue[8]={6,6,6,6,6,6,6,6};
char show_boot[12][20];
unsigned short timevlaue[6]={10,20,30,01,02,03};
int place_temp=0;
void read_set_username(void);
//char timeshow[10];
int device_num;
int para_long;
int para=1;
unsigned short get_date(unsigned short  useless);
int vali_date_time(struct yhCmosstruct current_bcu,int timeinput);
void show_value_time(struct yhCmosstruct current_bcu);
unsigned short get_time(unsigned short  useless);
unsigned short write_time(unsigned short  useless1, unsigned short  useless2);
unsigned short write_date(unsigned short  useless1, unsigned short  useless2);
unsigned short prase_pam_time(struct yhCmosstruct current_bcu,int timeinput);
int vali_date_date(struct yhCmosstruct current_bcu,int timeinput);
void done_system(char* key_input);
void done_configfile(char* key_input);
  void  creat_link(void);
  void print_link(void);
  void add_item( int place);
  void del_item(int place);
  struct date_type temp_boot;
char time_input[100];
struct link_type *head;

//struct yhCmosstruct bcu[0]=
//struct yhCmosstruct bcu1[]=(struct yhCmosstruct *)malloc(20*sizeof(struct yhCmosstruct));
struct yhCmosstruct bcu[]={
 {
 //Screen
 .index=0,
 .optionValue={0,1,100},
  .optiondesction={"Disable","Enable"},
 .cbit={0,1},
 .Key_input="/Screen",
 .start_post=0x015d,
 .media=0,
 .description_info="Summary Screen",
 .validate=vali_date,
 .showValue=show_value,
 .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//Halt
 .index=1,
 .optionValue={0,1,100},
 .optiondesction={"No halt","All errors"},
 .cbit={0,1},
 .Key_input="/Halt",
 .start_post=0x0f6,
  .media=0,
 .description_info="Halt on POST Errors",
 .validate=vali_date,
  .showValue=show_value,
  .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//OS
 .index=2,
 .optionValue={0,1,2,3,4,100},
 .optiondesction={"Other","Win95","Win98","Winme","Win2K/XP"},
 .cbit={0,1,4,5,6},
 .Key_input="/OS",
 .start_post=0x011d,
  .media=0,
 .description_info="Install OS",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
/*{
//MAC1 Lan
 .index=3,
 .optionValue={0,1,100},
 .optiondesction={"Enable","Disable"},
 .cbit={0,1},
 .Key_input="/PXE_N1",
 .start_post=0x01b3,
  .media=0,
 .description_info="NIC1 with PXE",
 .validate=vali_date,
  .showValue=show_value,
  .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//MAC2 Lan
 .index=4,
 .optionValue={0,1,100},
 .optiondesction={"Enable","Disable"},
 .cbit={0,1},
 .Key_input="/PXE_N2",
 .start_post=0x032a,
  .media=0,
 .description_info="NIC2 with PXE",
 .validate=vali_date,
  .showValue=show_value,
  .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
*/{
//Classis Intrusion
 .index=3,
 .optionValue={0,1,100},
 .optiondesction={"No","Yes"},
 .cbit={0,1},
 .Key_input="/Classis",
 .start_post=0x00f0,
   .media=0,
 .description_info="Classis Instruction",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},

{
//Quick Boot
 .index=4,
 .optionValue={0,1,100},
 .optiondesction={"Disable","Enable"},
 .cbit={0,1},
 .Key_input="/Qboot",
 .start_post=0x0131,
   .media=0,
 .description_info="Quick Boot Mode",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//Quiet Boot Mode
 .index=5,
 .optionValue={0,1,100},
 .optiondesction={"Disable","Eable"},
 .cbit={1,0},
 .Key_input="/Quiet",
 .start_post=0x013a,
   .media=0,
 .description_info="Quiet Boot Mode",
 .validate=vali_date,
  .showValue=show_value,
  .readValue=getTokenItemValue,
  .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
/*{
//Default Video
 .index=8,
 .optionValue={0,1,2,100},
 .optiondesction={"Onboard VGA","PCI-E x8 Slot","PCI-E x16 Slot"},
 .cbit={0,2,3},
 .Key_input="/Video",
 .start_post=0x015c,
   .media=1,
 .description_info="Default Primary Video Adapter",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//Power Button
 .index=9,
 .optionValue={0,1,100},
 .optiondesction={"Enable","Disable"},
 .cbit={0,1},
 .Key_input="/Power",
 .start_post=0x0145,
   .media=1,
 .description_info="Power Button Off",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
  .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
*/
{
//boot Device Priority
 .index=6,
 .optionValue={0,1,2,3,4,5,6,7,8,9,10,11,12,13,100},
 .optiondesction={"USB Key","SATA0","SATA1","SATA2","SATA3","IDE CDROM","PCI BEV: IBA","PCI BEV: 1IBA","PCI BEV: 2IBA","Boot add Cards","Legacy Network Card","Legacy Diskette A","Floppy","PCI SCSI Card"},
 .cbit={11,2,3,4,5,0,26,27,28,43,38,6,7,33},
 .Key_input="/Boot",
 .start_post=0x015e,
   .media=0,
 .description_info="Boot Device Priority",
 .validate=boot_device_vali_date,
 .showValue=boot_device_show,
 .readValue=boot_device_read,
 .writeValue=boot_device_write,
 .prasePam=boot_device_prase_pam,
},
{
//Legacy Diskette A
 .index=7,
 .optionValue={0,1,2,3,4,5,100},
 .optiondesction={"Disable","360kb","1.2MB","720Kb","1.44/1.25MB","2.88MB"},
 .cbit={0,1,2,3,4,6},
 .Key_input="/Disk_A",
 .start_post=0x0084,
   .media=0,
 .description_info="Legacy Diskette A",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
//ACPI
/*{
 .index=8,
 .optionValue={0,1,100},
 .optiondesction={"No","Yes"},
 .cbit={0,1},
 .Key_input="/ACPI",
 .start_post=0x0147,
   .media=0,
 .description_info="Enable/Disabled  ACPI",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//ACPI_Sx
 .index=9,
 .optionValue={0,1,100},
 .optiondesction={"S1","S3"},
 .cbit={0,1},
 .Key_input="/A_sx",
 .start_post=0x0384,
   .media=0,
 .description_info="Enable ACPI_Sx",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
*/{
//action
 .index=8,
 .optionValue={0,1,2,100},
 .optiondesction={"Stay off","Last State","Power On"},
 .cbit={0,1,2},
 .Key_input="/Action",
 .start_post=0x0229,
   .media=0,
 .description_info="Action After power Failure",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},

{
//Com port Address
 .index=9,
 .optionValue={0,1,2,100},
 .optiondesction={"Disable","On-board com A","On-board com B"},
 .cbit={0,2,3},
 .Key_input="/Con_s",
 .start_post=0x0105,
   .media=0,
 .description_info="Com port Address",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
  .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},

{
//Baud Rate
 .index=10,
 .optionValue={0,1,2,3,4,5,6,7,100},
 .optiondesction={"300","1200","2400","9600","19.2k","38.4k","57.6k","115.2K"},
 .cbit={0,1,2,3,4,5,6,7},
 .Key_input="/Con_rate",
 .start_post=0x0107,
   .media=0,
 .description_info="Baud Rate",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//Consloe Flow Control
  .index=11,
  .optionValue={0,1,2,100},
  .optiondesction={"None","Xon/Xoff","CTS/RTS"},
  .cbit={0,1,2},
  .Key_input="/Con_fc",
  .start_post=0x010d,
  .media=0,
  .description_info="Consloe Flow Control",
  .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
  .writeValue=setTokenItemValue,
  .prasePam=prase_pam,
},{
//Console Connection
 .index=12,
 .optionValue={0,1,100},
 .optiondesction={"Direct","Via Modem"},
 .cbit={0,1},
 .Key_input="/Con_con",
 .start_post=0x010f,
   .media=0,
 .description_info="Console Connection",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
 {
 //Console Type
 .index=13,
 .optionValue={0,1,2,3,4,5,6,100},
 .optiondesction={"VT100","VT100,8bit","PC-ANSI,7bit","PC-ANSI","VT100t","VT-UTF8","ASCII"},
 .cbit={0,1,2,3,4,5,6},
 .Key_input="/Con_type",
 .start_post=0x010a,
   .media=0,
 .description_info="Console Type",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
 .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//Continue C.R after Post
 .index=14,
 .optionValue={0,1,100},
 .optiondesction={"Off","On"},
 .cbit={0,1},
 .Key_input="/Con_post",
 .start_post=0x0110,
   .media=0,
 .description_info="Continue C.R after Post",
 .validate=vali_date,
  .showValue=show_value,
   .readValue=getTokenItemValue,
  .writeValue=setTokenItemValue,
 .prasePam=prase_pam,
},
{
//time
 .index=15,
 //.optionValue={0,1,100},
 //.optiondesction={"Off","On"},
 //.cbit={0,1},
 .Key_input="/Time",
 //.start_post=0x01b2,
 //  .media=0,
 .description_info="Date and time:",
 .validate=vali_date_time,
  .showValue=show_value_time,
  .readValue=get_time,
  .writeValue=write_time,
 .prasePam=prase_pam_time,
},
{
//time
 .index=16,
 //.optionValue={0,1,100},
 //.optiondesction={"Off","On"},
 //.cbit={0,1},
 .Key_input="/Date",
 //.start_post=0x01b2,
  // .media=0,
 .description_info="Date and time:",
 .validate=vali_date_date,
  .showValue=show_value_time,
  .readValue=get_date,
  .writeValue=write_date,
 .prasePam=prase_pam_time,
},
};
 struct yhCmosstruct_input bcu_o[]={
  	{
//Display the LAN Configuation
 .index=17,
  .Key_input="/dd",
  .description_info="Display the LAN Configuation",
 .validate=vali_date_d_dhcp,
.done_input=done_system,
//   .readValue=getTokenItemValue,
// .writeValue=setTokenItemValue,
//  .prasePam=prase_pam,
},
 	{
//DHCP
 .index=18,
  .Key_input="/dhcp",
  .description_info="Enable/Disabled DHCP",
.validate=vali_date_d_dhcp,
.done_input=done_system,
//   .readValue=getTokenItemValue,
// .writeValue=setTokenItemValue,
//  .prasePam=prase_pam,
},
{
 .index=19,
 .Key_input="/ip",
 .description_info="Set LAN parameters  IP address",
 .validate=vali_date_ip_gw,
 .done_input=done_system,
// .writeValue=write_value,
// .prasePam=prase_pam,
},
{
 .index=20,
 .Key_input="/net",
  .description_info="Set LAN parameters netmask",
  .validate=vali_date_mask,
 .done_input=done_system,
 // .writeValue=write_value,
 //.prasePam=prase_pam,
},

{
 .index=21,
 .Key_input="/gateway",
  .description_info="Set LAN parameters gateway",
   .validate=vali_date_ip_gw,
//   .readValue=read_value,
 .done_input=done_system,
// .prasePam=prase_pam,
},
/*{
 .index=28,
 .Key_input="/mac",
  .description_info="Set LAN MAC address",
 .validate=vali_date_mac,
 .done_input=done_system,
  //.writeValue=write_value,
 //.prasePam=prase_pam,
},
*/
{
 .index=22,
 .Key_input="/users",
  .description_info="Read user name",
 .validate=vali_date_d_dhcp,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -