Hello...
As soon as this function returns the Debug Window in VisualC++ reports this error:
"Run-Time Check Failure #2 - Stack around the variable 'fBuffer' was corrupted."
Why??Code:int cFile::GetType(LPCWSTR filename) { HANDLE hFile = NULL; char fBuffer[3]; DWORD nread = 0; hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == NULL) return -1; ZeroMemory(fBuffer, sizeof(char) * 4); ::ReadFile(hFile, fBuffer, 4, &nread, NULL); if (nread < 4) return -1; if (fBuffer[0] == 82 && fBuffer[1] == 73 && fBuffer[2] == 70 && fBuffer[3] == 70) return FILE_TYPE_AUDIO; if (fBuffer[0] == 77 && fBuffer[1] == 84 && fBuffer[1] == 104 && fBuffer[1] == 100) return FILE_TYPE_MIDI; return 0; }



LinkBack URL
About LinkBacks



