Created
June 2, 2014 21:42
-
-
Save tyranid/27dd557ed04c6b980f8a to your computer and use it in GitHub Desktop.
Test Case for Illegal NTFS Names
This file contains 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 <stdio.h> | |
#include <tchar.h> | |
#include <Windows.h> | |
#include <string> | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
for (int i = 1; i < 128; ++i) | |
{ | |
std::wstring name = L".\a"; | |
name += (WCHAR)i; | |
name += L"a"; | |
HANDLE hFile = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL); | |
if (hFile == INVALID_HANDLE_VALUE) | |
{ | |
printf("Illegal Char: %d\n", i); | |
} | |
else | |
{ | |
CloseHandle(hFile); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment