I have used the following code snippet to encrypt a file.
Everything is going fine. According to the concept I have successfully encrypted the file.
But when I open this file in Notepad it still opens and text is still readable
CString sTest= "Are you here? I wanna talk to you. This is a pretty Serious issue.";
Myfile.Open ("C:\\Test.fen",CFile ::modeCreate |CFile::modeWrite );
Myfile.Write (sTest ,sTest.GetAllocLength ());
Myfile .Close ();
/*EncryptFile function is an inbuilt function to Encrypt the file*/
int ret = EncryptFile ("C:\\Test.fen");
int lastError = GetLastError ();
/* Checking the file status whether it got encrypted or not*/
DWORD ATT = GetFileAttributes ("C:\\test.fen");
if (ATT & FILE_ATTRIBUTE_ENCRYPTED )
lastError = GetLastError ();
.This is the trouble.
If it is to remain readable, then what is fun of EncryptFile()
provided by Platform SDK.