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

misc std/os for windows #549

Open
timotheecour opened this issue Jan 21, 2021 · 2 comments
Open

misc std/os for windows #549

timotheecour opened this issue Jan 21, 2021 · 2 comments

Comments

@timotheecour
Copy link
Owner

timotheecour commented Jan 21, 2021

links

improve windows support for symlinks · Issue #16784 · nim-lang/Nim

@timotheecour timotheecour changed the title std/os for windows misc std/os for windows Jan 21, 2021
@timotheecour
Copy link
Owner Author

timotheecour commented Jan 21, 2021

  • symbolic links

But Windows Vista and up have a different softlink called a symbolic link, and that is recommended over Junctions any day. – unixman83 Oct 27 '11 at 16:51

https://github.com/googleprojectzero/symboliclink-testing-tools/blob/master/CommonUtils/ReparsePoint.cpp

bool ReparsePoint::IsSymlink(const std::wstring& path)
{
	return IsReparseTag(path, IO_REPARSE_TAG_SYMLINK);
}

2.1.2.4 Symbolic Link Reparse Data Buffer

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/b41f1cbf-10df-4a47-98d4-1c52a833d913

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c8e77b37-3909-4fe6-a4ea-2b9d423b1ee4

https://stackoverflow.com/questions/1447575/symlinks-on-windows

Symlinks as they were introduced in Vista are implemented as reparse points and thus closer to symlinks in POSIX. Hardlinks got nothing to do with that. – 0xC0000022L Nov 11 '14 at 13:56

Starting with Windows 10 Insiders build 14972, symlinks can be created without needing to elevate the console as administrator. This will allow developers, tools and projects, that previously struggled to work effectively on Windows due to symlink issues, to behave just as efficiently and reliably as they do on Linux or OSX.

Now in Windows 10 Creators Update, a user (with admin rights) can first enable Developer Mode, and then any user on the machine can run the mklink command without elevating a command-line console.

SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE 0x2 Specify this flag to allow creation of symbolic links when the process is not elevated
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE0x2 Specify this flag to allow creation of symbolic links when the process is not elevated. Developer Mode must first be enabled on the machine before this option will function.

https://en.wikipedia.org/wiki/Symbolic_link

https://stackoverflow.com/questions/43355180/windows-command-line-dectect-if-there-is-symlink-folder-in-path

https://en.cppreference.com/w/cpp/filesystem/is_symlink

dotnet/runtime#24271

https://stackoverflow.com/questions/32525393/finding-where-a-symbolic-link-points-to-windows

https://docs.microsoft.com/en-us/windows/win32/fileio/symbolic-link-effects-on-file-systems-functions

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil

@timotheecour
Copy link
Owner Author

void realpath(const char *filename, wchar_t *pathbuf, int size)
{
    OFSTRUCT of;
    HANDLE file = (HANDLE)OpenFile(filename,&of,OF_READ);
    GetFinalPathNameByHandle(file,pathbuf,size,FILE_NAME_OPENED);
    CloseHandle(file);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant