Closed TekuSP closed 3 years ago
@TekuSP Hi,
Are you able to reproduce the issue with the sample ? Does the filled buffer size param is correctly set ? Like the read ask for 200bytes, you only set 190 bytes but you set the read field done to 200 still
Well, I am trusting Stream to read correctly. I can double check bytesRead value.
bytesRead = cryptoStream.Read(buffer, 0, buffer.Length);
Nope. bytesRead is correctly set.
I tried testing with Debug.WriteLine($"Bytes read for file {fileName} were: {bytesRead}");
And it returned Bytes read for file \test.txt were: 3
Which is correct, but result file is:
@TekuSP Could it be that the file size returned to the file informations is the size of the encrypted data while the plain data is smaller in reality? And then the diff would be filled with nul.
That is possible, and I will double check that.
Yes that was the case! Thank you!
Greetings,
I have problems with NULs appearing in files, corrupting them this way.
I tried everything in my code, to remove trailing zeros, to check WriteFile... Nothing worked. How does the buffer system work with WinApi?
Can ReadFile create trailing zeros? Anyone had ever before such issue?