Last active
September 4, 2025 14:05
-
-
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
#include <windows.h> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <wil/filesystem.h> | |
#include <wil/resource.h> | |
int wmain(int, PWSTR argv[]) | |
{ | |
const auto [d, e] = wil::try_open_file(argv[1], FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_FLAG_BACKUP_SEMANTICS); | |
if (!d) | |
{ | |
fprintf(stderr, "CreateFile %08lx\n", e); | |
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