I'm doing a file hasher, I'm starting with MD5, I'm following this example but I didn't want to use window's function, I'm using normal md5 functions.
It compiles fine but I get an error while running it. Aditionally I would like to know if is there a function that would take the number given by GetLastError() and convert it into the description of the error.Code:LPSTR lpOut[40]; HANDLE hFile = NULL; BOOL bResult = FALSE; BYTE rgbFile[BUFSIZE]; DWORD cbRead = 0; unsigned char* md5; hFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (hFile == INVALID_HANDLE_VALUE) { wsprintf(lpOut, "Error opening file! Error: %d\0", GetLastError()); MessageBox(hwnd, lpOut, "Error", MB_OK | MB_ICONERROR); break; } MD5_CTX context; MD5Init(&context); while (bResult = ReadFile(hFile, rgbFile, BUFSIZE, &cbRead, NULL)) { if (cbRead == 0) { break; } MD5Update(&context, rgbFile, BUFSIZE); } CloseHandle(hFile); MD5Final(md5, &context); SetDlgItemText(hwnd, HSH_MD5, md5);



LinkBack URL
About LinkBacks


