中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 01:48
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS软件下载 & 游戏分享 (下载室) » [Repost] Boot Password
Printable Version  1,821 / 1
Floor1 imp Posted 2002-12-07 00:00
银牌会员 Posts 309 Credits 1,001
Floor2 imp Posted 2002-12-07 00:00
银牌会员 Posts 309 Credits 1,001
Author: 小草
A boot password program. Run it once and it will automatically add itself to autoexec.bat. The next time you boot, you will have to enter the password to get through.
The program is as follows:
#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); /*if there is an error, you cannot get through the program*/
}

void look()
{FILE *fauto,*fbak;
char *pass="c:\\windows\\password.exe"; /*location of this program*/
char a,ch;
char *au="autoexec.bat",*bname="hecfback.^^^"; /*bname is the backup of 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); /*read the first 23 characters of autoexec.bat*/
a='\0';

if (strcmp(a,pass)==0) /*if what was read is the same as the pass pointer then close the file, otherwise add it*/
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;} /*if there are more than 58 characters, end this input*/
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();
}
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023