GetFileAttributes returns FILE_ATTRIBUTE_DIRECTORY for invalid input
<p>I am puzzled with the behavior of this piece of code.</p>

<pre><code>const char* file_name = "/  /";
auto attributes = GetFileAttributes(TEXT(file_name)); // same result without TEXT macro
if (attributes == INVALID_FILE_ATTRIBUTES)
{
  //error
}
else if (attributes == FILE_ATTRIBUTE_DIRECTORY)
{
  //directory
}    
</code></pre>

<p>This is invalid name for a file or a directory, so I would expect this to return INVALID_FILE_ATTRIBUTES. 
Compiled with VS2015 running on win8.
Maybe this is because of a forward char? And maybe there is a winAPI function to validate the input?</p>

<p>thanks</p>