/*************************************/
#include
#include
#include
static char Pass_w[20];
static char Chang[20];
static char new1[20];
static char new2[20];
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[20];
char new2[20];
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[1]={0};
printf("\t\tWELCOME TO BLUEEVIL'S PERSONAL COMPUTER"
loop:printf("\n\t\t[1].Login\t\t[2].Change The Password\nPlease Choose:\n\n"
wel[0]=getch();
if (wel[0]=='1')
login();
else
if (wel[0]=='2') {gai();goto loop;}
else
{printf("Please Choose [1] Or [2]\n"
goto loop;}
}
/**********************************************/
main()
{clrscr();
printf("<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>"
printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
juage();
red();
welcome();
} 作者: imp 时间: 2002-12-7 00:00 作者:小草
开机密码程序,运行一次自动把程序添加到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[25],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[23]='\0';