-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFOLDERLO.C
More file actions
executable file
·595 lines (560 loc) · 11 KB
/
FOLDERLO.C
File metadata and controls
executable file
·595 lines (560 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
#include<stdio.h>
#include<conio.h>
#include<dir.h>
#include<io.h>
#include<dos.h>
#include<string.h>
#include<process.h>
void start(void);
#pragma startup start
char oldname[7]="locker", newname[7]="lock";
char pass1[20];
char encde[20];
char pass2[20];
char choice1;
char choice2;
void main();
int file_exists(char *filename)
{
return (access(filename, 0) == 0);
}
folder_lock(){
int stat;
if(file_exists("lock")==1){
textcolor(10);
gotoxy(25,10);
cprintf("locker is already locked");
getch();
}
else{
stat = mkdir("locker");
if (!stat){
textcolor(10);
gotoxy(25,10);
cprintf("Directory named locker is created\n");
getch();
}
else{
gotoxy(25,10);
cprintf("R U Sure u Want to lock(Y/N)");
choice1=getch();
switch(choice1){
case 'y':
case 'Y':
if (rename(oldname,newname) == 0){
system("attrib +r +a +s +h lock");
system("cacls lock /e /d everyone");
_setcursortype(_NOCURSOR);
cprintf("Folder is lock");
}
break;
default:
return 0;
}
}
}
return 0;
}
folder_unlock(){
if(file_exists("lock")==0 && file_exists("locker")==0){
textcolor(10);
gotoxy(20,10);
cprintf("Create a Directory By using LOCK FOLDER option");
gotoxy(20,12);
cprintf(" press any key to go to Main Menu...");
getch();
}
if(file_exists("locker")==1 && file_exists("lock")==0){
textcolor(10);
gotoxy(25,10);
cprintf("Folder is not lock");
gotoxy(20,12);
cprintf("press any key to go to Main Menu...");
getch();
}
if(file_exists("lock")==1){
gotoxy(25,10);
cprintf("R U sure u Want to Unlock(Y/N):");
choice2=getch();
switch(choice2){
case 'y':
case 'Y':
system("cacls lock /e /g everyone:f");
system("attrib -r -s -a -h lock");
_setcursortype(_NOCURSOR);
if(rename(newname,oldname)==0){
printf("not Done");
}
break;
default:
return 0;
}
}
return 0;
}
void soft()
{
clrscr();
textcolor(10);
cprintf(" ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r\n");
cprintf(" º -------FOLDER LOCK------- º\r\n");
cprintf(" º Copyright (C): Rahul Malik. º\r\n");
cprintf(" º 2008 :) º\r\n");
cprintf(" ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\r\n");
textcolor(WHITE);
}
size(ssl,esl)
int ssl,esl;
{
union REGS i,o;
i.h.ah=1;
i.h.ch=ssl;
i.h.cl=esl;
i.h.bh=0;
int86(16,&i,&o);
return 0;
}
void setvidio(int k)
{
if(k==0)
return;
textcolor(YELLOW);
textbackground(20);
return;
}
void resetvidio(int k)
{
if(k==0)
return;
textcolor(WHITE);
textbackground(BLACK);
return;
}
//Function for getting key value
int getkey()
{
union REGS i,o;
while(!kbhit());
i.h.ah=0;
int86(22,&i,&o);
return(o.h.ah);
}
int menu()
{
int i=16,r=17,j=0,k=0,l=0,m=0,w=0,x=0,y=0,z=0,hit,ans=1;
clrscr();
_setcursortype(_NOCURSOR);
do{
clrscr();
soft();
gotoxy(38,9);
printf("Main Menu");
gotoxy(38,10);
printf("---------");
gotoxy(32,12);
printf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»");
gotoxy(32,13);
printf("º º");
gotoxy(32,14);
printf("º º");
gotoxy(32,15);
printf("º º");
gotoxy(32,16);
printf("º º");
gotoxy(32,17);
printf("º º");
gotoxy(32,18);
printf("º º");
gotoxy(32,19);
printf("º º");
gotoxy(32,20);
printf("º º");
gotoxy(32,21);
printf("º º");
gotoxy(32,22);
printf("º º");
gotoxy(32,23);
printf("º º");
gotoxy(32,24);
printf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ");
gotoxy(34,14);
printf("%c",i);
gotoxy(36,14);
setvidio(i);
cprintf("SOFTWARE INFO");
printf(" %c",r);
resetvidio(1);
size(32,1);
gotoxy(34,16);
printf("%c",j);
gotoxy(36,16);
setvidio(j);
cprintf("PASSWORD CHNG");
printf(" %c",w);
resetvidio(1);
size(32,2);
gotoxy(34,18);
printf("%c",k);
gotoxy(36,18);
setvidio(k);
cprintf(" LOCK FOLDER ");
printf(" %c",x);
resetvidio(1);
size(32,3);
gotoxy(34,20);
printf("%c",l);
gotoxy(36,20);
setvidio(l);
cprintf("UNLOCK FOLDER");
printf(" %c",y);
resetvidio(1);
size(32,4);
gotoxy(34,22);
printf("%c",m);
gotoxy(36,22);
setvidio(m);
cprintf(" EXIT ");
printf(" %c",z);
resetvidio(1);
hit=getkey();
if(hit==80){
switch(ans){
case 1:
ans=2;
j=16;
w=17;
i=k=l=m=r=x=y=z=0;
break;
case 2:
ans=3;
k=16;
x=17;
i=j=l=m=r=w=y=z=0;
break;
case 3:
ans=4;
l=16;
y=17;
i=j=k=m=w=x=z=r=0;
break;
case 4:
ans=5;
m=16;
z=17;
i=j=k=l=r=w=x=y=0;
break;
case 5:
ans=1;
i=16;
r=17;
j=k=l=m=w=x=y=z=0;
break;
}
}
if(hit==72){
switch(ans){
case 1:
ans=5;
m=16;
z=17;
i=j=k=l=r=w=x=y=0;
break;
case 2:
ans=1;
i=16;
r=17;
j=k=l=m=w=x=y=z=0;
break;
case 3:
ans=2;
j=16;
w=17;
i=k=l=m=r=x=y=z=0;
break;
case 4:
ans=3;
k=16;
x=17;
i=j=l=m=r=w=y=z=0;
break;
case 5:
ans=4;
l=16;
y=17;
i=j=k=m=w=x=z=r=0;
break;
}
}
}while(hit!=28);
return(ans);
}
void about()
{
soft();
printf("%c FOLDERLOCK:\n",3);
printf("----------\n\n");
printf(" This is a basically easy folder locking program used to hide\n");
printf(" files from unauthorized access to that file.\n\n");
printf("%c HOW TO USE:\n",3);
printf("----------\n\n");
printf(" First u just hav to go to %c LOCK FOLDER %c option\n",16,17);
printf(" Then folder name locker will be created by this software\n");
printf(" Then again u have to go to %c LOCK FOLDER %c option \n",16,17);
printf(" Then it will lock that locker\n");
printf(" Then to unlock u have to go to %c UNLOCK FOLDER %c option \n",16,17);
printf("\n%c Program:\n",3);
printf("-----------\n\n");
printf(" This program is implimented in TURBO C++ v3.0 enviroment. It cannot be run\n");
printf(" in LINUX . I realy Dont get time to check it out\n");
printf("\n%c Contact:\n",3);
printf("----------\n\n");
printf(" E Mail: rahul.send89@gmail.com\n");
printf("\n\n\n\nPress ENTER to return.....");
getch();
}
void border(int color)
{
union REGS i,o;
clrscr();
i.h.ah=0x0B;
i.x.bx=color;
int86(0x10,&i,&o);
}
void invalid(){
_setcursortype(_NOCURSOR);
border(3);
soft();
textcolor(RED);
gotoxy(22,20);
cprintf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r\n");
gotoxy(22,21);
cprintf("º Invalid Password. º\r\n");
gotoxy(22,22);
cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\r\n");
getch();
_setcursortype(_SOLIDCURSOR);
printf("\n\n EXIT? <y/n>: ");
if(getch()=='y')
exit(1);
}
void match(){
_setcursortype(_NOCURSOR);
border(3);
soft();
textcolor(BLUE);
textbackground(10);
gotoxy(22,20);
cprintf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r\n");
gotoxy(22,21);
cprintf("º Password Match º\r\n");
gotoxy(22,22);
cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\r\n");
getch();
textcolor(YELLOW);
textbackground(BLACK);
}
void first(){
_setcursortype(_NOCURSOR);
border(3);
soft();
textcolor(GREEN);
gotoxy(22,20);
cprintf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r\n");
gotoxy(22,21);
cprintf("º This is your first Password º\r\n");
gotoxy(22,22);
cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\r\n");
getch();
}
void disp(){
border(3);
soft();
textcolor(51);
gotoxy(22,20);
cprintf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\r\n");
gotoxy(22,21);
cprintf("º Enter Password: º\r\n");
gotoxy(22,22);
cprintf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ\r\n");
textcolor(WHITE);
gotoxy(40,21);
//getch();
}
void pas()
{
int i=0,a,l=40;
char j;
_setcursortype(_SOLIDCURSOR);
disp();
while((j=getch())!=13){
a=j;
if(a==8&&l>40){
l--;
gotoxy(l,21);
printf(" ");
gotoxy(l,21);
i--;
}
else if(a!=8 && l<48){
gotoxy(l,21);
printf("*");
l++;
pass1[i]=j;
i++;
}
}
pass1[i]=NULL;
}
void encode(){
FILE *fp;
char ch;
int i=0,a,j=1,b;
fp=fopen("C:\\windows\\system32\\system.sys","r+");
if(fp==NULL)
fp=fopen("C:\\windows\\system32\\system.sys","w");
a=pass1[0];
ch=a;
fputc(ch*2,fp);
i++;
while(pass1[i]!=NULL){
b=pass1[i];
encde[j]=(a+b);
i++;
j++;
}
encde[j]=NULL;
i=1;
while(encde[i]!=NULL){
fputc(encde[i],fp);
i++;
}
fclose(fp);
}
void dcode(){
int a,b,j=1;
char ch;
FILE *fp;
fp=fopen("C:\\windows\\system32\\system.sys","r");
a=fgetc(fp);
a=a/2;
encde[0]=a;
while((b=fgetc(fp))!=EOF){
b=b-a;
encde[j]=b;
j++;
}
encde[j]=NULL;
fclose(fp);
}
int chk(void)
{
FILE *out;
int flag=0;
char c,str[20]="rahul";
if ((out = fopen("C:\\windows\\system32\\system.sys", "rb+"))== NULL)
{
pas();
if(strcmp(pass1,str)==0){
first();
encode();
return 1;
}
else{
invalid();
return 0;
}
}
else{
pas();
dcode();
if(strcmp(pass1,encde)!=0)
flag=1;
if(flag==1){
clrscr();
gotoxy(12,12);
invalid();
fclose(out);
return 0;
}
else{
match();
return 1;
}
}
}
void start(){
int ch1;
clrscr();
_setcursortype(_SOLIDCURSOR); //for eye comfort
do{
ch1=chk();
}while(ch1!=1);
}
void password()
{
int ch,x,i,j,k,nz,ch1;
FILE *fp;
clrscr();
_setcursortype(_SOLIDCURSOR); //for eye comfort
ch1=chk();
if(ch1==1){
clrscr();
textcolor(51);
gotoxy(10,16);
printf("Enter New Password.");
pas();
fp=fopen("C:\\windows\\system32\\system.sys","w");
fclose(fp);
encode();
}
else {
invalid();
main();
}
textcolor(7);
}
void main()
{
int choice,ch,jnz,cnt;
char fle[20];
choice=menu();
switch(choice){
case 1:
about();
main();
break;
case 2:
soft();
// out();
textcolor(10);
gotoxy(25,10);
cprintf("First enter old password");
gotoxy(25,12);
cprintf("Second Enter the new password");
gotoxy(25,14);
cprintf("press any key continue......");
getch();
password();
main();
break;
case 3:
soft();
folder_lock();
main();
break;
case 4:
soft();
folder_unlock();
main();
break;
case 5:
clrscr();
soft();
printf("\n\n\n\n\n THANKS FOR USING FOLDERLOCK");
system("attrib +h +s c:\\windows\\system32\\system.sys");
textcolor(7);//return normal color
getch();
exit(1);
break;
}
}