Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- int main()
- {
- HANDLE handle = CreateFile ("P:\\", GENERIC_READ, 0, 0,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- if (handle == INVALID_HANDLE_VALUE) {
- LPTSTR pcMsg = 0;
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_ALLOCATE_BUFFER, 0, GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&pcMsg, 0, 0);
- printf("Bad handle: %s (0x%x)\n", pcMsg, GetLastError());
- return 0;
- }
- DWORD attributes = GetFileAttributes (handle);
- if (attributes != (DWORD) -1
- && (attributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
- char buf[32000];
- DWORD len;
- if (!DeviceIoControl(handle,
- FSCTL_GET_REPARSE_POINT, NULL, 0,
- buf, 32000, &len, NULL)) {
- printf("error %u\n", GetLastError());
- }
- else {
- printf("No error\n");
- }
- }
- else {
- printf("Reparse flag not set\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement