answersLogoWhite

0


Best Answer

#include<iostream>#include<fstream>#include<windows.h>usingnamespace std;void lockfolder();void unlockfolder();void setcolour(unsignedint colour);int main(){unsignedint choice=0;SetConsoleTitle("Folder Lock"); system("CLS"); setcolour(14); cout <<"\t\t\t\t"<<"- Evil Genious\n"; cout <<"\t\t\t\t"<<"-----------------\n"; setcolour(15); setcolour(30); cout <<"\n\n"<<"Options:\t\t\t\n"; cout <<"\t======================\n"; cout <<"\t1. - Lock Folder.\n"; cout <<"\t2. - Unlock Folder.\n"; cout <<"\t3. - Exit.\n"; cout <<"\t====================== \n"; setcolour(128); cout <<"\nEnter your choice: "; cin >> choice;switch(choice){case1: lockfolder();break;case2: unlockfolder();break;case3:exit(0);break;default: cout <<"\nError. Unknown Option Entered. Quitting ....\n";break;}return0;}void setcolour(unsignedint colour){ HANDLE handle =GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleTextAttribute(handle, colour);}void lockfolder(){charpass[15]=""; ofstream lfolder;char folder[200]={0};char tempfolder[200]={'0'};char attributes[50]={'0'}; setcolour(13); cout <<"\nEnter the complete path to the Folder: "; cin >> folder; strcpy(tempfolder, folder); strcat(folder,"\\Desktop.ini"); lfolder.open(folder, ios::out); lfolder <<"[.shellClassInfo]"<< endl; lfolder <<"CLSID = {63E23168-BFF7-4E87-A246-EF024425E4EC}"<< endl; lfolder.close(); strcpy(attributes,"attrib +h +s "); strcat(attributes, tempfolder);WinExec(attributes, NULL); lfolder.open("C:\\windows\\db.dat", ios::app); lfolder <<"Folder Locked: "<< tempfolder << endl; lfolder.close(); cout <<"\n\n"<< tempfolder <<" has been locked successfully!\n";}void unlockfolder(){char folder[255];char tempfolder[255];char attributes[50];chardel[50]; ofstream lfolder; setcolour(14); cout <<"\nEnter the complete path to the Folder: "; cin >> folder; strcpy(tempfolder, folder); strcat(folder,"\\Desktop.ini"); strcpy(del,"del "); strcat(del, folder); system(del); strcpy(attributes,"attrib -h -s "); strcat(attributes, tempfolder);WinExec(attributes, NULL); lfolder.open("C:\\windows\\db.dat", ios::app); lfolder <<"! Folder Unlocked: "<< tempfolder << endl; lfolder.close(); cout <<"\n\n"<< tempfolder <<" has been unlocked successfully!\n";}

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in c to lock a folder?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

In what folder to you install a program?

That would be the "Program Files" folder. It is usually on C: drive. With a 64 bit system you will have a "Program Files" folder, and a "(x86) Program files" folder. The program itself will usually be in a separate folder in the "Program file" folder. It will either have the name of the program or the name of the program Company. If the folder is named after the company then the program will be in a separate folder inside the company folder.


In what folder are 32-bit programs stored by a 64-bit edition of windows vista?

C:\Program Files (x86)\ is the default folder for 32-bit applications on 64-bit Windows.


What is the path name of program files folder which you get in c drive?

cookies


Where is the the program files folder located?

The Program Files folder is located in the Local Drive C. To access it, go to Start and My Computer or just Computer, depending upon which version of Windows you are using.


Write a c program for creating a virus?

a c program for creat a virus


In the program arcsoft funhouse does anybody know where the 'my templates' files are saved?

You can find the 'My Templates' files within the Arcsoft Funhouse folder. The folder will either be on your desktop, or within the C or D drives. The folder can also be located within your Program files folder.


How do you deleate a profile on cod2?

Delete your folder from the players folder c:/program files (86x)/activision/call of duty 2


Your batch is not copying the file to the mapped drives?

If you are trying to copy files from a location or to a location whose name has spaces, you will need to put the " " around the location for it to work. For example: copy C:\Users\Noah\Desktop\File.txt "C:\Program Files\Folder\File.txt" or copy "C:\Users\Noah\My Music\Music.mp3" C:\Program Files\Folder\Music.mp3 OR copy "C:\Users\Noah\My Pictures\Picture.jpg" "C:\Program Files\Folder\Picture.jpg


Why Folder c does not open?

make sure its not :[a] a hidden folder[b] read/write protected -i.e. check its privileges[c] that its your computer :)[d] doesnt have a virus


Where do we write main function in a c program?

Into the source program.


Where are new programs installed on the computer?

Mostly, they are in a folder called Program Files in C:\\ drive.


Write a c program to find Volume and surface area of cube?

Write a c program to compute the surface area and volume of a cube