I wrote a simple test, but it's not working. Why CreateFile
with FILE_FLAG_POSIX_SEMANTICS
flag allows me to open the file named "stamp.oS" on an NTFS disk in the second case?
#include "stdafx.h"
#include <windows.h>
#include <iostream>
int main()
{
auto h = CreateFileA("c:\\stamp.oS", GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_FLAG_POSIX_SEMANTICS, NULL);
if (h == INVALID_HANDLE_VALUE)
std::cout << "bad first try" << std::endl;
else
{
std::cout << "yeah first" << std::endl;
CloseHandle(h);
}
h = CreateFileA("c:\\stamp.os", GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_FLAG_POSIX_SEMANTICS, NULL);
if (h == INVALID_HANDLE_VALUE)
std::cout << "bad second try" << std::endl;
else
{
std::cout << "yeah second" << std::endl;
CloseHandle(h);
}
system("pause");
return 0;
}
Output:
yeah first
yeah second