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

home_dir returns Some("") instead of None on NT 3.51 #1

Open
seritools opened this issue Apr 21, 2022 · 0 comments
Open

home_dir returns Some("") instead of None on NT 3.51 #1

seritools opened this issue Apr 21, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@seritools
Copy link
Member

Environment variables in general should probably be checked a bit closer. GetEnvironmentVariableW might behave slightly differently on old Windows versions.

MSDN VC6:

If the function succeeds, the return value is the number of characters stored into the buffer pointed to by lpBuffer, not including the terminating null character.
If the specified environment variable name was not found in the environment block for the current process, the return value is zero.
If the buffer pointed to by lpBuffer is not large enough, the return value is the buffer size, in characters, required to hold the value string and its terminating null character.

MSDN 2005:

If the function succeeds, the return value is the number of characters stored in the buffer pointed to by lpBuffer, not including the terminating null character.
If lpBuffer is not large enough to hold the data, the return value is the buffer size, in characters, required to hold the string and its terminating null character.
If the function fails, the return value is zero. If the specified environment variable was not found in the environment block, GetLastError returns ERROR_ENVVAR_NOT_FOUND.

It might be that ERROR_ENVVAR_NOT_FOUND didn't exist yet. On NT 3.51, HOME/USERPROFILE didn't exist yet, but HOMEDRIVE (only drive letter) and HOMEPATH do.

@seritools seritools added the bug Something isn't working label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant