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

Function DOKAN_CALLBACK CryptSetEndOfFile

cppcryptfs/dokan/cryptdokan.cpp:1432–1463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430}
1431
1432static NTSTATUS DOKAN_CALLBACK CryptSetEndOfFile(
1433 LPCWSTR FileName, LONGLONG ByteOffset, PDOKAN_FILE_INFO DokanFileInfo) {
1434 FileNameEnc filePath(DokanFileInfo, FileName);
1435 HANDLE handle;
1436
1437 DbgPrint(L"SetEndOfFile %s, %I64d\n", FileName, ByteOffset);
1438
1439 handle = (HANDLE)DokanFileInfo->Context;
1440 if (!handle || handle == INVALID_HANDLE_VALUE) {
1441 DbgPrint(L"\tinvalid handle\n\n");
1442 return STATUS_INVALID_HANDLE;
1443 }
1444
1445 CryptFile *file = CryptFile::NewInstance(GetContext());
1446
1447 if (file->Associate(GetContext(), handle, FileName, true)) {
1448 if (!file->SetEndOfFile(ByteOffset)) {
1449 DWORD error = GetLastError();
1450 DbgPrint(L"\tSetEndOfFile error code = %d\n\n", error);
1451 delete file;
1452 return ToNtStatus(error);
1453 }
1454 } else {
1455 delete file;
1456 DbgPrint(L"\tSetEndOfFile unable to associate handle %I64x\n", handle);
1457 return STATUS_ACCESS_DENIED;
1458 }
1459
1460 delete file;
1461
1462 return STATUS_SUCCESS;
1463}
1464
1465static NTSTATUS DOKAN_CALLBACK CryptSetAllocationSize(
1466 LPCWSTR FileName, LONGLONG AllocSize, PDOKAN_FILE_INFO DokanFileInfo) {

Callers

nothing calls this directly

Calls 4

DbgPrintFunction · 0.85
ToNtStatusFunction · 0.85
AssociateMethod · 0.80
SetEndOfFileMethod · 0.45

Tested by

no test coverage detected