Last active
February 13, 2025 10:36
-
-
Save 0xbadfca11/4ababeff1e3eaa2bb7dcb95b0a89b8ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WIN32_LEAN_AND_MEAN | |
#define WIL_SUPPRESS_EXCEPTIONS | |
#include <windows.h> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <wil/resource.h> | |
int wmain(int, PWSTR argv[]) | |
{ | |
wil::unique_hfile d(CreateFileW(argv[1], FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, nullptr)); | |
if (!d) | |
{ | |
fprintf(stderr, "CreateFile %08lx\n", GetLastError()); | |
return EXIT_FAILURE; | |
} | |
FILE_CASE_SENSITIVE_INFORMATION file_cs = { FILE_CS_FLAG_CASE_SENSITIVE_DIR }; | |
if (!SetFileInformationByHandle(d.get(), FileCaseSensitiveInfo, &file_cs, sizeof file_cs)) | |
{ | |
fprintf(stderr, "SetFileInformationByHandle %08lx\n", GetLastError()); | |
return EXIT_FAILURE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment