论坛: 编程破解 标题: 1+1=1 复制本贴地址    
作者: hhh [hhh]    论坛用户   登录
#include<bios.h>
#include<stdio.h>
#include<stdlib.h>
#include<dos.h>
#include<fcntl.h>
#include<sys\types.h>
#include<sys\stat.h>
void main()
    {int a;
system("cls");
printf("\t\t1.Partition table\n");
printf("\t\t2.Cmos password\n");
printf("\t\tPlease input(1~2):");
scanf("%d",&a);
switch(a)
{case 1:dbt();
break;
case 2:cmospass();
break;
      }
}
dbt()
{
int a;
printf("\tHard disk partition table backup program v1.00\n");
printf("\t\t1.Backup partition table\n");
printf("\t\t2.Restore partition table\n");
printf("\t\t3.Exit the program\n");
printf("\t\tPlease input(1~3):");
scanf("%d",&a);
switch(a)
{case 1:bakup();
break;
case 2:restore();
break;
case 3:printf("\n\nThank you using partition table operating program!");exit(1);
break;
default:printf("Thank you using partition table operating program!");
}
}
bakup()
{
char c[1];
FILE *fp;
int result;
char buffer[512];
result=biosdisk(2,0x80,0,0,1,1,buffer);
if(!result)
{printf("reding hard disk partition table ok!\n");
printf("please insert floppy disk a and input \"Y\":");
scanf("%s",c);
if(!strcmp(c,"y")||!strcmp(c,"Y"))
{fp=fopen("a:dpt.bin","wb+");
fwrite(buffer,1,512,fp);
fclose(fp);
printf("\nsaveing hard disk partition table to A: OK!\n");
printf("Thank you using partition table backup program!");
return 0;
}
else
exit(1);
}
else
{fprintf(stderr,"reading partition tabld failure");
exit(1);
}
}
restore()
{
FILE *fp;
char dc[1];
char buffer[512];
int result;
printf("Please insert partition backup disk A:and Input \"Y\":");
scanf("%s",dc);
if(!strcmp(dc,"y")||!strcmp(dc,"Y"))
{
fp=fopen("A:dpt.bin","rb+");
fread(buffer,1,512,fp);
result=biosdisk(3,0x80,0,0,1,1,buffer);
if(!result)
{printf("\nHard disk partition table is restored\n");
fclose(fp);
printf("Thank you using partition table backup program!");
return 0;
}
else
{fprintf(stderr,"restoretion of hard disk partition table failed");
fclose(fp);
exit(1);
}
}
else
return(0);
}
cmospass()
{
int n;
char cmospass;
char temp=0;
int  result;
printf("\n\nThis program only is display  award bios password!!\n\n");
printf("The \"cmos\" password of the cmos is:");
outportb(0x70,0x1d);
cmospass=inportb(0x71);
for(n=6;n>=0;n-=2)
   {
    temp=cmospass;
    temp>>=n;
    temp=temp&0x03;
    printf("%d",temp);
   }
outportb(0x70,0x1c);
result=inportb(0x71);
for(n=6;n>=0;n-=2)
   {
    temp=cmospass;
    temp>>=n;
    temp=temp&0x03;
    printf("%d",temp);
   }
return(0);
}



地主 发表时间: 11/08 18:35

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号