How to check whether a given file exists in the given path ?

Using Win32 API FindFirstFile we can find whether a given file exists in the given path (szFilePath) or not.
BOOL IsFileExists( LPCTSTR szFilePath) method shown below serves our purpose.

BOOL IsFileExists( LPCTSTR szFilePath) // szFilePath in | file path
{
   BOOL bFileExists;
   WIN32_FIND_DATA FindFileData;;
   HANDLE hFind;

   hFind = FindFirstFile(szFilePath, &FindFileData);
   if (hFind == INVALID_HANDLE_VALUE)
   {
	  bFileExists = FALSE;
   }
   else
   {
	 FindClose(hFind);
	 bFileExists  = TRUE;
   }

	return bFileExists;
}

Hash Data using Win32 API through a CHashDataProvider class

Cryptography is the use of codes to convert data so that only a specific recipient will be able to read it.
Microsoft provide win32 API to Hash Data/string. The class CHashDataProvider developed to provides simple function HashData(ALG_ID algorithmID, LPCTSTR plainText, LPTSTR hashedText); which takes algorithmID and inputText to convert plainText to hashedText

ALG_ID algorithmID – Algorithm ID to be used
LPCTSTR plainText – plainText that to be converted to hashedText
LPTSTR hashedText – Hashed Test using the input algorithmID

Continue reading