This code part is from a simple md5 hash generator.But here i can only give a file name to generate the md5.
LPCWSTR NameOfTheFile = L"Test.txt"; //Name of the file that user is scanning
But i want to give a file path here instead of the file name..Is there any way to do that.?
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
#define BUFSIZE 1024
#define MD5LEN 16
using namespace std;
DWORD main()
{
MaximizeOutputWindow();
DWORD cryptStatus = 0;
BOOL hashResult = FALSE;
BYTE fileSizeToHash[BUFSIZE];
HCRYPTPROV cryptProv = 0;
HCRYPTHASH hash = 0;
HANDLE file = 0;
DWORD hashNumbCount = 0;
DWORD hashRead = 0;
BYTE getHashValue[MD5LEN];
CHAR numberConvert[] = "0123456789abcdef"; //hex decimal conversion
LPCWSTR NameOfTheFile = L"Test.txt"; //Name of the file that user is scanning
// Logic to check usage goes here.
file = CreateFile(NameOfTheFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);