| 27 | } |
| 28 | |
| 29 | HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle) { |
| 30 | TUtf16String wstr; |
| 31 | LPCWSTR wname = UTF8ToWCHAR(fName, wstr); |
| 32 | if (!wname) { |
| 33 | ::SetLastError(ERROR_INVALID_NAME); |
| 34 | return INVALID_HANDLE_VALUE; |
| 35 | } |
| 36 | SECURITY_ATTRIBUTES secAttrs; |
| 37 | secAttrs.bInheritHandle = inheritHandle ? TRUE : FALSE; |
| 38 | secAttrs.lpSecurityDescriptor = nullptr; |
| 39 | secAttrs.nLength = sizeof(secAttrs); |
| 40 | return ::CreateFileW(wname, accessMode, shareMode, &secAttrs, createMode, attributes, nullptr); |
| 41 | } |
| 42 | |
| 43 | bool WinRename(const TString& oldPath, const TString& newPath) { |
| 44 | TUtf16String op, np; |
no test coverage detected