MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / DOKAN_CALLBACK CryptLockFile

Function DOKAN_CALLBACK CryptLockFile

cppcryptfs/dokan/cryptdokan.cpp:1396–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1394}
1395
1396static NTSTATUS DOKAN_CALLBACK CryptLockFile(LPCWSTR FileName,
1397 LONGLONG ByteOffset,
1398 LONGLONG Length,
1399 PDOKAN_FILE_INFO DokanFileInfo) {
1400 FileNameEnc filePath(DokanFileInfo, FileName);
1401 HANDLE handle;
1402
1403 DbgPrint(L"LockFile %s\n", FileName);
1404
1405 handle = (HANDLE)DokanFileInfo->Context;
1406 if (!handle || handle == INVALID_HANDLE_VALUE) {
1407 DbgPrint(L"\tinvalid handle\n\n");
1408 return STATUS_INVALID_HANDLE;
1409 }
1410
1411 CryptFile *file = CryptFile::NewInstance(GetContext());
1412
1413 if (file->Associate(GetContext(), handle, FileName, false)) {
1414
1415 if (!file->LockFile(ByteOffset, Length)) {
1416 DWORD error = GetLastError();
1417 DbgPrint(L"\tfailed(%d)\n", error);
1418 delete file;
1419 return ToNtStatus(error);
1420 }
1421 } else {
1422 delete file;
1423 return STATUS_ACCESS_DENIED;
1424 }
1425
1426 delete file;
1427
1428 DbgPrint(L"\tsuccess\n\n");
1429 return STATUS_SUCCESS;
1430}
1431
1432static NTSTATUS DOKAN_CALLBACK CryptSetEndOfFile(
1433 LPCWSTR FileName, LONGLONG ByteOffset, PDOKAN_FILE_INFO DokanFileInfo) {

Callers

nothing calls this directly

Calls 4

DbgPrintFunction · 0.85
ToNtStatusFunction · 0.85
AssociateMethod · 0.80
LockFileMethod · 0.45

Tested by

no test coverage detected