为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

自动关机程序

2017-10-27 6页 doc 17KB 17阅读

用户头像

is_105949

暂无简介

举报
自动关机程序自动关机程序 #include #include #include #include #include #define OK 0 #define FALSE 1 int tm_set(struct time *set_time) { char ch; int hour,min,curr_hour,curr_min; struct time curr_time; gettime(&curr_time); system("cls"); printf("set shutdown_os time(for e...
自动关机程序
自动关机程序 #include #include #include #include #include #define OK 0 #define FALSE 1 int tm_set(struct time *set_time) { char ch; int hour,min,curr_hour,curr_min; struct time curr_time; gettime(&curr_time); system("cls"); printf("set shutdown_os time(for example : 12:00)=="); scanf("%d:%d",&hour,&min); if(curr_time.ti_hour>=hour&&curr_time.ti_min>=min) { system("cls"); printf("Failed!"); sleep(3); exit(FALSE); } set_time->ti_hour=hour; set_time->ti_min=min; return OK; } int tmcontrol(struct time *set_time) { int hour,min; struct time curr_time; gettime(&curr_time); hour=curr_time.ti_hour; min=curr_time.ti_min; if(hour==set_time->ti_hour&&min==set_time->ti_min) {shutdown_os(); return OK;} else return FALSE; } int shutdown_os(void) { char *ch="shutdown -s -t 60"; system("cmd /c a.vbs"); sleep(5); system(ch); return OK; } int set_pwd() { char pwd[16]; char data; int i; FILE *fp; clrscr(); printf("set password:"); for(i=0;i<16;i++) { if((data=getch())=='\r') break; pwd=data; putchar('*'); } pwd='\0'; system("cls"); printf("password is: "); puts(pwd); getch(); system("cls"); if((fp=fopen("pwd.dat","wb+"))==NULL) return FALSE; else { fprintf(fp,"%s",pwd);fclose(fp);} return OK; } int pwd_verify() { char ch={0}; char rd[16]={0}; FILE *fp; if((fp=fopen("pwd.dat","r"))==NULL) { set_pwd(); return OK; } else { fgets(rd,16,fp); printf("your password:"); scanf("%s",ch); } if(strcmp(ch,rd)==0) return OK; else { system("cls"); printf("\n wrong password!"); sleep(3); return FALSE; } } int hidpro(void) { char *srch="cpy.bat"; char *path; char *hid; if((path=searchpath(srch))==NULL) return FALSE; system(path); hid="cmdow @ /hid"; system(hid); return OK; } int main() { struct time *set_time; int work=1; system("cls"); if(pwd_verify()==OK) tm_set(set_time); else return FALSE; if(hidpro()==OK) { while(work==1) { if(tmcontrol(set_time)==OK) break; sleep(30); } } else { printf("File lost!"); return FALSE; } return OK; }
/
本文档为【自动关机程序】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索