use _wstat instead of GetFileAttributesW due to failure to check system files.
rt: add comments
std: remove unused consts and an extern function.