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

📄 yhnew3.c

📁 在dos 与Linux下通过命令来改变BIOS项设置。
💻 C
📖 第 1 页 / 共 3 页
字号:
			//printf("temp-boot %s",temp_boot.value);
			//printf("del member =%d t =%d",temp_boot.member,t);
			del_item(j);
			add_item(t);
		}
		
		}
		n=head;
		n=n->next;
		i=0;
		while(n->input.member!=100&&i<8)
		{
			current_bootvlaue[i]=n->input.member;
			i++;
			n=n->next;
		}
	return 0;
}
int boot_device_vali_date(struct yhCmosstruct current_bcu,int paminut)
{
	//int temp[8];
	//int m,n,i,k;
	int m,i,j;
	int input_order[15];
	int tag=1;
	j=0;
	for(i=0;i<strlen(time_input);i++)
	{	
		if(time_input[i]==',')
			{j++;}
	}
	
	if(j>7)
	{tag=2;}
	sscanf(time_input, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &input_order[0],&input_order[1],&input_order[2],&input_order[3],&input_order[4],&input_order[5],&input_order[6],&input_order[7],&input_order[8],&input_order[9],&input_order[10],&input_order[11],&input_order[12],&input_order[13],&input_order[14]);
	for(i=0;i<j+1;i++)
	{	
		m=input_order[i];
		if(m>13||m<0)
		{tag=0;}
	}
	//n=10000000;
	//printf("boot device_validate\n");
	//m=paminut;
	//printf("para_num= %d\t paminput=%d\n",para_long,m);
	/*for(i=0;i<8;i++)
	{printf("%d \t",current_bootvlaue[i]);}	
		printf("\n");
	*/
	/*n=1;
	for(k=0;k<para_long-1;k++)
		{n=n*10;}
	for(i=0;i<para_long;i++)
	{
		temp[i]=m/n;
		m=m%n;
		n=n/10;
	}
	if(para_long>8)
		{tag=0;}
	for(i=0;i<para_long;i++)
	{printf("%d \t",temp[i]);
	}
	printf("\n");
	*/
/*	for(i=0;i<para_long;i++)
	{if(temp[i]>9)
		{tag=0;}
	}
	for(i=0;i<para_long-1;i++)
	{
		for(k=i+1;k<para_long;k++)
		{
			if(temp[i]==temp[k])
				{tag=3;}
		}
	}
	*/
	/*o=0;
	for(i=0;i<para_long;i++)
	{  	o=0;
		for(k=0;k<device_num;k++)
		{
			for(n=0;n<8;n++)
			{
				if(temp[i]==current_bcu.optionValue[n])
					{m=n;}
			}
			if( current_bcu.cbit[m]==current_bootvlaue[k])
				{o=k+1;}
		}
		if(o==0)
			{tag=2;}
	}
	*///printf("tag=%d\n",tag);
	if(tag==0)
		{printf("Parametr error, please input the numbersize in 0-13\n");}
	if(tag==2)
		{printf("please input parameter number in 1-8\n");
		tag=0;
		}
		/*printf("Found:\t");
		boot_device_show(bcu[10]);
		printf("complete:\n0:USB Key\n1:SATA1\n2:SATA2\n3:USB CDROM\n4:PCI BEV: NVIDIA \n5:PCI BEV: 2NVIDIA \n6:Boot add Cards \n7: Legacy Network Card\n");
		for(i=0;i<device_num;i++)
		{o=0;
			for(k=0;k<8;k++)
			{
				if(current_bootvlaue[i]==current_bcu.cbit[k])
					{o=k;}
			}
			printf("  %d ",current_bcu.optionValue[o]);
		}
		tag=0;
		}
		//printf("tag=%d\n",tag);
	//if(tag==3)
		//{printf("please don't input the same number\n");
		//tag=0;}
		//printf("tag=%d\n",tag);
	*/
	return tag;
}
int vali_date_time(struct yhCmosstruct current_bcu,int timeinput)
{	
	int tag=1;
	//int i;
	int temp[3];
	//printf("time_input %s\n",time_input);
	sscanf(time_input, "%d:%d:%d", &temp[0],&temp[1],&temp[2]);	
	//printf(" %d-%d-%d\n",temp[0],temp[1],temp[2]);	
	if(temp[0]>24||temp[1]>60||temp[2]>60)
		{tag=0;}
	if(tag==0)
		{printf("error input, please input right time\n");}
	
	return tag;
	
}
int vali_date_date(struct yhCmosstruct current_bcu,int timeinput)
{	
	int tag=1;
	//int i;
	int temp[3];
	//printf("time_input %s\n",time_input);
	sscanf(time_input, "%d-%d-%d", &temp[0],&temp[1],&temp[2]);	
	//printf(" %d:%d:%d\n",temp[0],temp[1],temp[2]);	
	if(temp[0]>12||temp[1]>31)
		{tag=0;}
	if(tag==0)
		{printf("error input, please input right date\n");}
	
	return tag;
	
}
void show_value_time(struct yhCmosstruct current_bcu)
{

	unsigned char datetime[50];
	unsigned char datetime1[50];
 	memset(datetime,'\0',20);
  	memset(datetime1,'\0',20);
    	ReadTime(datetime);
     	printf("time:%s",datetime);
      	ReadDate(datetime1);
	printf("Date:%s",datetime1);
    	return;
}

struct data_time
{
     unsigned char  cur_sec;
     unsigned char  ala_sec;
     unsigned char  cur_min;
     unsigned char  ala_sec1;
     unsigned char  cur_hour;
     unsigned char  ala_hour1;
     unsigned char  cur_day_week;
     unsigned char   cur_day;
     unsigned char   cur_year;
 };


unsigned short get_time(unsigned short  useless)
{
     unsigned char datetime[50];

     ReadTime(datetime);
      return 0;
}	

unsigned short get_date(unsigned short  useless)
{
     unsigned char datetime[50];

     ReadDate(datetime);
     return 0;
}	

	
unsigned short write_time(unsigned short  useless1, unsigned short  useless2)
{	
	
	WriteTime(time_input);
	return 1;
}
unsigned short write_date(unsigned short  useless1, unsigned short  useless2)
{	
	
	WriteDate(time_input);
	return 1;
}


unsigned short prase_pam_time(struct yhCmosstruct current_bcu,int timeinput)
	{
	
		int tag;
	tag=1;
	
	return tag;
}


void done_system(char* key_input)
{
   
       char  cmdline[50];
  	if(!(strncmp(key_input,"/dd", 3)))
  		{key_input="/d";}
       memset(cmdline,'\0',50);
       strcpy(cmdline, "uh8d.exe ");
       //printf("---key_input=%s\n",key_input);
       
	strcat(cmdline, key_input);
      	//printf("paraLlomg %d",para);
       if(para!=0)
       {	strcat(cmdline,"=");
       	strcat(cmdline,time_input);
       	//printf("time input:%s",time_input);
        	if(!(strncmp(key_input,"/users", 6)))
        		{
			//printf("begin setname\n");
        		set_username();}
  		else      
			{system(cmdline);}
       }
       else
       	{system(cmdline);}
}
void done_configfile(char* key_input)
{
 
        FILE *cfg = NULL;
        char buf[80];
       // char *vs;
        printf("time input %s\n",time_input);
        cfg = fopen(time_input, "rt");
        while (fgets(buf, sizeof(buf), cfg))
        {
                if (strstr(buf, "/Screen"))
                {
                	printf("buf=%s\n");
                      /*  vs = strstr(buf, "= ");
                        memset(test_bios_ver, 0, sizeof(test_bios_ver));
                        sscanf(vs, "= %s %s", test_bios_ver, comp_bios_ver);
                        test_bios_ver[strlen(test_bios_ver) - 1] = '\0';
                */}
               
                if (strstr(buf, "/Halt"))
                {
                	printf("buf=%s\n");
                       /* vs = strstr(buf, "= ");
                        memset(test_amount, 0, sizeof(test_amount));
                        sscanf(vs, "= %s %d", test_amount, &comp_mem_count);
                       test_amount[strlen(test_amount) - 1] = '\0';
                */ }
		printf("enf config\n");
                
        }
        fclose(cfg);
}
void set_username(void)
{	 
	char *cmd1;
	char *cmd2;
	char *cmd3;
	char  cmdline[20];
	FILE *fp;
	int i;
       
       char in_file[20];
       //filename="temp.cfg";
       // char *vs;
       memset(cmdline,'\0',20);
   	for(i=0;i<20;i++)
   		{in_file[i]=0x00;}
       in_file[0]=0x20;
       in_file[1]=0x18;
       in_file[2]=0x45;
       in_file[3]=0x03;
       for(i=0;i<strlen(time_input);i++)
       	{in_file[4+i]=time_input[i];}
       //strncpy(&(cmdline[4]), time_input,strlen(time_input));
    //   for(i=0;i<20;i++)
       //	{printf("%02x ",in_file[i]);}
        fp = fopen( "temp.cfg","w" );
    	if( fp != NULL ) 
    	{		
    		//printf("aaa\n");
    		for(i=0;i<20;i++)
       	{fprintf(fp,"%02x ",in_file[i]);}
    		//printf("end fprintf\n");
    		 fclose( fp );
    		cmd1="uh8d.exe /cfg=temp.cfg";
		system(cmd1);
		cmd3="uh8d.exe /users";
		system(cmd3);
			//printf("end\n");
		   cmd2="del temp.cfg";
		    system(cmd2);
    	}
      else
      	{printf("can not open temp.cfg\n");}
    }
/*void pxe_check(void)
{
int i;
int tag1;
int location1;
int location2;
int tag2;
tag1=0;
tag2=0;
	for(i=0;i<8;i++)
	{
		if(current_bootvlaue[i]==49)
			{tag1=1;
			location1=i;
			}
		if(current_bootvlaue[i]==50)
			{tag2=1;
			location2=i;
			}
	}
	if(tag1==0&&bcu[3].currentValue==0)
	{	
		i=0;
		while(current_bootvlaue[i]!=63)
			{i++;}
		current_bootvlaue[i]=49;
	}
	if(tag2==0&&bcu[4].currentValue==0)
	{	
		i=0;
		while(current_bootvlaue[i]!=63)
			{i++;}
		current_bootvlaue[i]=50;
	}
	if(tag1==1&&bcu[3].currentValue==1)
	{
	for(i=location1;i<7;i++)
		current_bootvlaue[i]=current_bootvlaue[i+1];
	}
	if(tag2==1&&bcu[4].currentValue==1)
	{
	for(i=location2;i<7;i++)
		current_bootvlaue[i]=current_bootvlaue[i+1];
	}
	return;
}*/
  void  creat_link()
{
	int i;
	struct link_type *p1,*p2;
	//struct link_type *del,*check;
	//printf("creadte\n");
	//head->id=0;
	//head->input=Bootdevice[0];
	//	printf("begin create");
	head=(struct link_type *)malloc(sizeof(struct link_type));
	head->id=100;
	head->input=Bootdevice[0];
	i=0;
	p1=(struct link_type *)malloc(sizeof(struct link_type));
	head->next=p1;
	head->front=NULL;
	p1->front=head;
	i++;
	p1->id=i;	
	p1->input=Bootdevice[i];
	while(i<12)
	{
		p2=(struct link_type *)malloc(sizeof(struct link_type));
		p1->next=p2;
		p2->front=p1;
		i++;
		p2->id=i;
		p2->input=Bootdevice[i];
		//printf("id %d=%s \n",p2->id,p2->input);
		p1=(struct link_type *)malloc(sizeof(struct link_type));
		p2->next=p1;
		p1->front=p2;
		i++;
		p1->id=i;
		p1->input=Bootdevice[i];
		//printf("id %d=%s \n",p1->id,p1->input);
	}
	//p1->next=NULL;
	//printf("end create");
	//print_link();
	return;
}
void print_link()
{
	
	struct link_type *check;
	//printf("printf\n");
	check=head;
	check=check->next;
	//while(check->next!=NULL&&check->input.member!=0&&check->id<9)
	while(check->input.member!=100&&check->id<9)
	//while(check->next!=NULL)
	{
		printf("id %d %s\n",check->id,check->input.value);
		check=check->next;	
	}
	//if(check->input.member!=0)
	//{printf("id %d %s\n",check->id,check->input.value);}
	printf("\n");
	return;
}
void add_item( int place)
{
	//int i;
	struct link_type *add,*b,*n, *temp;
	//printf("add item\n");
	add=(struct link_type *)malloc(sizeof(struct link_type));
		temp=(struct link_type *)malloc(sizeof(struct link_type));
	add->input=temp_boot;
	//add->input.member=temp_boot.member;
	//printf("please input the value and id\n");
	//scanf("%s,%d",&add->input.value,&add->input.be);
	
	add->id=place;
	b=head;
	
	while(b->id!=place&&b->next!=NULL)
	{
		b=b->next;
	}
	//printf("add b.id= %d",b->id);
	if(b->next!=NULL&&b->front!=NULL)
	{	
		//printf("id in middle\n");
		n=b;
		b=b->front;
		b->next=add;
		add->next=n;
		n->front=add;
		add->front=b;
		while(n->input.member!=100)
		{
			n->id++;
			n=n->next;
		}
		//n->id++;
		//break;
	}
	else if(b->next==NULL)
	{
		//printf("end item\n");
		b->next=add;
		add->front=b;
		add->next=temp;
		//break;
	}
	else if(b->id==100)
	{	
		//printf("begin item\n");
		head->front=add;
		add->next=head;
		add->front=NULL;
		head=head->front;
		n=head->next;
		while(n->next!=NULL)
		{
			n->id++;
			n=n->next;
		}
		n->id++;
		//break;
	}
	//print_link();

	//	current_bootvlaue[i]=n->input.member;
		

	return;
}

void del_item(int place)
{
	
	struct link_type *del,*b,*n;
	del=head;
	//place_temp=place;
	//printf("del %d\t",place);
	//printf("del item\n");
	
	while(del->id!=place&&del->next!=NULL)
	{
		del=del->next;
	}
	//printf("del id %d ",del->id);
	while(del->next!=NULL&&del->front!=NULL)
	{	
		//printf("del iin middle\n");
		b=del->front;
		n=del->next;
		b->next=n;
		n->front=b;
		while(n->next!=NULL)
		{
			n->id--;
			n=n->next;
		}
		n->id--;
		
		break;
	}
	while(del->next==NULL)
	{
		//printf("del last item\n");
		b=del->front;
		b->next=NULL;
		break;
	}
	while(del->front==NULL)
	{	
		//printf("first item\n");
		head=head->next;
		head->front=NULL;
		n=head;
		while(n->next!=NULL)
		{
			n->id--;
			n=n->next;
		}
		n->id--;
		break;
	}
	//temp.value=del->input.value;
	//temp.be=del->input.be;
	free(del);
	//print_link();
	return ;
}

⌨️ 快捷键说明

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