MCPcopy Create free account
hub / github.com/InoriRus/Kyty / sys_file_open_rw

Function sys_file_open_rw

source/lib/Sys/src/SysWindowsFileIO.cpp:269–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269sys_file_t* sys_file_open_rw(const String& file_name, sys_file_cache_type_t cache_type)
270{
271 auto* ret = new sys_file_t;
272
273 HANDLE h_file = nullptr;
274 h_file = CreateFileW(reinterpret_cast<LPCWSTR>(file_name.utf16_str().GetData()),
275 static_cast<DWORD>(GENERIC_READ) | static_cast<DWORD>(GENERIC_WRITE), 0, nullptr, OPEN_EXISTING,
276 get_cache_access_type(cache_type), nullptr);
277
278 if (h_file == KYTY_INVALID_HANDLE_VALUE())
279 {
280 ret->type = SYS_FILE_ERROR;
281 } else
282 {
283 ret->type = SYS_FILE_FILE;
284 }
285
286 ret->handle = h_file;
287
288 return ret;
289}
290
291void sys_file_close(sys_file_t* f)
292{

Callers 1

OpenMethod · 0.85

Calls 4

get_cache_access_typeFunction · 0.85
utf16_strMethod · 0.80
GetDataMethod · 0.45

Tested by

no test coverage detected