X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fwindows%2Ffile.cpp;h=90c5bb5e6b50bdd840ee3482dd4ee8c585c04582;hp=f6943adb3cb397cf3be67c8f76f4a9989cd9a2d2;hb=41363aed34382386f915f17c1a961750b4fdcb14;hpb=ea8bf8f588310b0d7fd3297d74907602705bba1d diff --git a/source/io/windows/file.cpp b/source/io/windows/file.cpp index f6943ad..90c5bb5 100644 --- a/source/io/windows/file.cpp +++ b/source/io/windows/file.cpp @@ -35,14 +35,14 @@ void File::platform_init(const string &fn, CreateMode cm) SECURITY_ATTRIBUTES sec_attr; sec_attr.nLength = sizeof(SECURITY_ATTRIBUTES); - sec_attr.lpSecurityDescriptor = 0; + sec_attr.lpSecurityDescriptor = nullptr; sec_attr.bInheritHandle = !!(mode&M_INHERIT); - *handle = CreateFile(fn.c_str(), flags, share_flags, 0, create_flags, FILE_ATTRIBUTE_NORMAL, 0); + *handle = CreateFile(fn.c_str(), flags, share_flags, nullptr, create_flags, FILE_ATTRIBUTE_NORMAL, &sec_attr); if(!handle) { int err = GetLastError(); - if(err==ERROR_FILE_NOT_FOUND) + if(err==ERROR_FILE_NOT_FOUND || err==ERROR_PATH_NOT_FOUND) throw file_not_found(fn); else if(err==ERROR_FILE_EXISTS) throw file_already_exists(fn);