MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / open

Method open

Engine/source/platformWin32/winVolume.cpp:413–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413bool Win32File::open(AccessMode mode)
414{
415 close();
416
417 if (mName.isEmpty())
418 return mStatus;
419
420 struct Mode
421 {
422 DWORD mode,share,open;
423 } Modes[] =
424 {
425 { GENERIC_READ,FILE_SHARE_READ,OPEN_EXISTING }, // Read
426 { GENERIC_WRITE,0,CREATE_ALWAYS }, // Write
427 { GENERIC_WRITE | GENERIC_READ,0,OPEN_ALWAYS }, // ReadWrite
428 { GENERIC_WRITE,0,OPEN_ALWAYS } // WriteAppend
429 };
430
431 Mode& m = (mode == Read)? Modes[0]: (mode == Write)? Modes[1]:
432 (mode == ReadWrite)? Modes[2]: Modes[3];
433
434 mHandle = (void*)::CreateFileW(PathToOS(mName).utf16(),
435 m.mode, m.share,
436 NULL, m.open,
437 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
438 NULL);
439
440 if ( mHandle == INVALID_HANDLE_VALUE || mHandle == NULL )
441 {
442 _updateStatus();
443 return false;
444 }
445
446 mStatus = Open;
447 return true;
448}
449
450bool Win32File::close()
451{

Callers 10

dumpMethod · 0.45
countUnflaggedAllocsFunction · 0.45
initLogFunction · 0.45
logAllocFunction · 0.45
logReallocFunction · 0.45
logFreeFunction · 0.45
platformMemory.cppFile · 0.45
TESTFunction · 0.45
getRenderModelTextureMethod · 0.45
CreateMiniDumpFunction · 0.45

Calls 4

PathToOSFunction · 0.85
_IsDirectoryFunction · 0.85
isEmptyMethod · 0.45
utf16Method · 0.45

Tested by 1

TESTFunction · 0.36