实现功能

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2021-12-12 00:23:19 +08:00
parent f30786a5e1
commit e2efa35648
4 changed files with 54 additions and 24 deletions
+53 -23
View File
@@ -7,9 +7,9 @@ const char bios_head[32]=
{ {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x5A,0xA5,0xF0,0x0F,0x03,0x00,0x04,0x03,0x06,0x02,0x10,0x15,0x20,0x01,0x21,0x00 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x5A,0xA5,0xF0,0x0F,0x03,0x00,0x04,0x03,0x06,0x02,0x10,0x15,0x20,0x01,0x21,0x00
}; };
char buff[1024*1000*16]; char buff[0xffffff];
char id[32]; char id[32];
char outputdir[256];
char chack_str(const char *a,char *b,int len) char chack_str(const char *a,char *b,int len)
{ {
int c; int c;
@@ -25,7 +25,9 @@ char chack_str(const char *a,char *b,int len)
void tryunlock(char *dir) void tryunlock(char *dir)
{ {
int a;
FILE *bios=NULL; FILE *bios=NULL;
FILE *output_bios=NULL;
bios=fopen(dir,"rb"); bios=fopen(dir,"rb");
if(bios==NULL) if(bios==NULL)
{ {
@@ -39,6 +41,34 @@ void tryunlock(char *dir)
}else }else
{ {
printf("try it..\n"); printf("try it..\n");
if(fseek(bios,0xf00,SEEK_SET))
{
printf("ERROR. -0\n");
}else
{
fread(id,32,1,bios);
for(a=0;a<32;a++)
{
buff[0xf00+a]=id[a];
}
for(a=0;a<256;a++)
{
outputdir[a]=0;
}
sprintf(outputdir,"%s%s",dir,"_unlock.bin");
printf("Output flie %s",outputdir);
output_bios=fopen(outputdir,"wb");
if(output_bios==NULL)
{
printf("ERROR. can't Output file ..\n");
}else
{
fwrite(buff,0xffffff,1,output_bios);
fclose(output_bios);
}
printf("\n");
}
} }
} }
@@ -46,7 +76,19 @@ void tryunlock(char *dir)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
printf("ThinkPad Bios unlock..v0.1\n"); printf("ThinkPad Bios unlock..v0.1\n\n\n");
if(argc==1)
{
printf("联想ThinkPad Bios超级密码解锁程序(目前仅支持X250)\n\n使用方法:\n");
printf("1 使用编程器将原机Bios读出\n");
printf("2 将读出的内容以二进制格式bin保存\n");
printf("3 将bin文件拖进本程序,程序会自动生成解锁Bios,(支持批量拖入)\n");
printf("4 将生成的解锁bios刷入,然后开机,按F1进入Bios,将超级密码改成空密码,按F10保存\n");
printf("5 完成! 注意,部分Bios芯片写入之前要先清空,否则无法校验通过。\n\n\n");
printf("编写 吴文峰 邮箱 kevin@lmve.net \n\n");
printf("项目地址 https://git.lmve.net/summary/thinkpad_unlock_bios.git \n!!!请勿商用!!!\n\n");
}
int a; int a;
FILE *unlock_bios = NULL; FILE *unlock_bios = NULL;
unlock_bios=fopen("./X250.bbb","rb"); unlock_bios=fopen("./X250.bbb","rb");
@@ -55,29 +97,17 @@ int main(int argc, char *argv[])
printf("ERROR_NOTFUND_THE_BIOS_FILE\n"); printf("ERROR_NOTFUND_THE_BIOS_FILE\n");
return -1; return -1;
} }
fread(buff,1024*1000*16,1,unlock_bios); fread(buff,0xffffff,1,unlock_bios);
if(argc>1)
{
while(argc>1)
{
argc--; while(argc>1)
printf("Input flie %s\n",argv[argc]);
tryunlock(argv[argc]);
}
printf("\n");
}else
{ {
printf("联想ThinkPad Bios超级密码解锁程序\n\n使用方法:\n");
printf("1 使用编程器将原机Bios读出\n"); argc--;
printf("2 将读出的内容以二进制格式bin保存\n"); printf("Input flie %s\n",argv[argc]);
printf("3 将bin文件拖进本程序,程序会自动生成解锁Bios,(支持批量拖入)\n"); tryunlock(argv[argc]);
printf("4 将生成的解锁bios刷入,然后开机,按F1进入Bios,将超级密码改成空密码,按F10保存\n");
printf("5 完成! 注意,部分Bios芯片写入之前要先清空,否则无法校验通过。\n\n\n");
printf("编写 吴文峰 邮箱 kevin@lmve.net \n\n");
printf("项目地址 https://git.lmve.net/summary/thinkpad_unlock_bios.git \n!!!请勿商用!!!\n\n");
return 0;
} }
printf("\n");
printf("\n"); printf("\n");
//printf("have %d file\n",argc-1); //printf("have %d file\n",argc-1);
//printf(argv[1]); //printf(argv[1]);
BIN
View File
Binary file not shown.
Binary file not shown.