![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-09-15 01:40 |
共 47,812 主题排行 / 349,917 发帖 / 今日 0 篇 / 48,268 会员排行 |
| DOS软件下载 & 游戏分享 (下载室) » [转帖]开机密码 |
| 可打印版本 1,820 / 1 |
| 第1楼 imp | 发表于 2002-12-07 00:00 |
| 银牌会员 发帖 309 积分 1,001 | |
|
[转帖]开机密码 /*************************************/
#include #include #include static char Pass_w; static char Chang; static char new1; static char new2; FILE *fp; /**************************************/ void Creat() { creat ("keyword" ;fclose(fp); } /****************************************/ void save() {int i; if ((fp=fopen("keyword","wb" )==NULL){printf("Cannot open file\n" ;exit(0); } fwrite(Pass_w,strlen(Pass_w),1,fp); fclose(fp); } /********************************************/ void red() { if ((fp=fopen("keyword","rb" )==NULL){ printf("Cannot Open File \n" ;exit(0); } fscanf(fp,"%s",Pass_w); fclose(fp); } /***********************************/ void juage() { if ((fp=fopen("keyword","rb" )==NULL){ creat(); loop:printf("Please Enter Your New Password:" ;scanf("%s",new1); printf("\nPlease Enter Your New Password Again:" ;scanf("%s",new2); while (strcmp(new1,new2)!=0) { printf ("\nYour Password is wrong!!!\nPlease Enter It Again: " ;printf("\n" ;goto loop; } strcpy(Pass_w,new1); save(); } } /*************************************/ void star() {int i=123; for (i=0;i<=20;i++) {Chang=getch(); if (Chang=='\r' ![]() {Chang='\0'; break;} else putch('*' ;}return ; } /*************************************/ void login() { printf("Please Enter Your Password: " ;star(); while (strcmp(Chang,Pass_w)!=0) { printf ("\nYour Password is wrong!!!\nPlease Enter It Again: " ;star(); printf("\n" ;} clrscr(); printf("\t ***************Login*****Successfull*************\n\t*\t\t Loading Windows \t\t*\n\t*************************************************" ;} /**************************************/ void gai() { char new1; char new2; printf("Please Enter Your Old Password:" ;star(); printf("\n" ;while (strcmp(Chang,Pass_w)!=0) { printf ("\nYour Password is wrong!!!\nPlease Enter It Again: " ;star(); printf("\n" ;} loop:printf("Please Enter Your New Password:" ;scanf("%s",new1); printf("Please Enter Your New Password Again:" ;scanf("%s",new2); while (strcmp(new1,new2)!=0) { printf ("\nYour Password is wrong!!!\nPlease Enter It Again: " ;printf("\n" ;goto loop; } strcpy(Pass_w,new1); creat(); save(); clrscr(); printf("\t******************Successfull********************\n\t*\t\t\t\t\t\t*\n\t*************************************************" ;}/************************************/ void welcome () {static char wel={0}; printf("\t\tWELCOME TO BLUEEVIL'S PERSONAL COMPUTER" ;loop:printf("\n\t\t.Login\t\t.Change The Password\nPlease Choose:\n\n" ;wel=getch(); if (wel=='1' ![]() login(); else if (wel=='2' {gai();goto loop;}else {printf("Please Choose Or \n" ;goto loop;} } /**********************************************/ main() {clrscr(); printf("<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>" ;printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n" ;juage(); red(); welcome(); } |
|
| 第2楼 imp | 发表于 2002-12-07 00:00 |
| 银牌会员 发帖 309 积分 1,001 | |
|
作者:小草
开机密码程序,运行一次自动把程序添加到autoexec.bat文件中,下次开机就会要输入密码才能通过。 程序如下: #include "conio.h" #include "string.h" #include "stdio.h" void error() {window(12,10,68,10); textbackground(15); textcolor(132); clrscr(); cprintf("file or system error! you can't enter the system!!!" ;while(1); /*若有错误不能通过程序*/ } void look() {FILE *fauto,*fbak; char *pass="c:\\windows\\password.exe"; /*本程序的位置*/ char a,ch; char *au="autoexec.bat",*bname="hecfback.^^^"; /*bname 是autoexec.bat 的备份*/ setdisk(2); /*set currently disk c:*/ chdir("\\" ; /*set currently directory \*/fauto=fopen(au,"r+" ;if (fauto==NULL) {fauto=fopen(au,"w+" ;if (fauto==NULL) error();} fread(a,23,1,fauto); /*读取autoexec.bat前23各字符*/ a='\0'; if (strcmp(a,pass)==0) /*若读取的和pass指针一样就关闭文件,不然就添加*/ fclose(fauto); else {fbak=fopen(bname,"w+" ;if (fbak==NULL) error(); fwrite(pass,23,1,fbak); fputc('\n',fbak); rewind(fauto); while(!feof(fauto)) {ch=fgetc(fauto); fputc(ch,fbak);} rewind(fauto); rewind(fbak); while(!feof(fbak)) {ch=fgetc(fbak); fputc(ch,fauto);} fclose(fauto); fclose(fbak); remove(bname); /*del bname file*/ } } void pass() {char *password="88888888"; char input; int n; while(1) {window(1,1,80,25); textbackground(0); textcolor(15); clrscr(); n=0; window(20,12,60,12); textbackground(1); textcolor(15); clrscr(); cprintf("password:" ;while(1) {input=getch(); if (n>58) {putchar(7); break;} /*若字符多于58个字符就结束本次输入*/ if (input==13) break; if (input>=32 && input0) {cprintf("\b \b" ;input='\0'; n--;} } input='\0'; if (strcmp(password,input)==0) break; else {putchar(7); window(30,14,50,14); textbackground(15); textcolor(132); clrscr(); cprintf("password error!" ;getch();} } } main() {look(); pass(); } |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |