I admit not understanding the Windows code. I did some trivial testing on Windows and it appeared to work (raise an exception if the file exists). I couldn't get the whole Windows test suite running on Windows because of some issue with ffi gem, but I could try harder on that.

> If O_CREAT and O_EXCL are set, open() shall fail if the file exists. The check for the existence of the file and the creation of the file if it does not exist shall be atomic with respect to other threads executing open() naming the same filename in the same directory with O_EXCL and O_CREAT set. If O_EXCL and O_CREAT are set, and path names a symbolic link, open() shall fail and set errno to [EEXIST], regardless of the contents of the symbolic link. If O_EXCL is set and O_CREAT is not set, the result is undefined.