Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error writing files of exact size 0xffffffff on Windows #2282

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Closed

Error writing files of exact size 0xffffffff on Windows #2282

Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Test.written

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: Hostilefork

The GetFileSize API returns two DWORDs worth of size, for the low and high 32-bits of the file's actual 64-bit size. For some reason, errors are indicated by returning a low size of 0xffffffff and using SetLastError() to something other than NO_ERROR. But if the last error is NO_ERROR, that means the file really is 0xffffffff bytes long.

R3-Alpha doesn't check the error condition, hence it conflates errors with a legitimate size for a file to have (especially if it is growing incrementally bytes by bytes, to pass through such a size at some point).

https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/os/win32/dev-file.c#L348

(Pointing it out as a curiosity of API design more than anything. Issue is resolved in Ren-C by checking the error status, and if it is NO_ERROR then not reporting an error.)


Imported from: metaeducation#2282

Comments:


Hostilefork added the Ren.resolved on Nov 28, 2017


@Oldes Oldes added Test.written Oldes.resolved Bugs/wishes with Oldes' fixes/features labels Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Oldes.resolved Bugs/wishes with Oldes' fixes/features Ren.resolved Test.written
Projects
None yet
Development

No branches or pull requests

2 participants