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

Function DOKAN_CALLBACK CryptUnlockFile

cppcryptfs/dokan/cryptdokan.cpp:1576–1608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1574}
1575
1576static NTSTATUS DOKAN_CALLBACK CryptUnlockFile(LPCWSTR FileName,
1577 LONGLONG ByteOffset,
1578 LONGLONG Length,
1579 PDOKAN_FILE_INFO DokanFileInfo) {
1580 FileNameEnc filePath(DokanFileInfo, FileName);
1581 HANDLE handle;
1582
1583 DbgPrint(L"UnlockFile %s\n", FileName);
1584
1585 handle = (HANDLE)DokanFileInfo->Context;
1586 if (!handle || handle == INVALID_HANDLE_VALUE) {
1587 DbgPrint(L"\tinvalid handle\n\n");
1588 return STATUS_INVALID_HANDLE;
1589 }
1590
1591 CryptFile *file = CryptFile::NewInstance(GetContext());
1592
1593 if (file->Associate(GetContext(), handle, FileName, false)) {
1594
1595 if (!file->UnlockFile(ByteOffset, Length)) {
1596 DWORD error = GetLastError();
1597 DbgPrint(L"\terror code = %d\n\n", error);
1598 delete file;
1599 return ToNtStatus(error);
1600 }
1601 } else {
1602 delete file;
1603 return STATUS_ACCESS_DENIED;
1604 }
1605 delete file;
1606 DbgPrint(L"\tsuccess\n\n");
1607 return STATUS_SUCCESS;
1608}
1609
1610static NTSTATUS DOKAN_CALLBACK CryptGetFileSecurity(
1611 LPCWSTR FileName, PSECURITY_INFORMATION SecurityInformation,

Callers

nothing calls this directly

Calls 4

DbgPrintFunction · 0.85
ToNtStatusFunction · 0.85
AssociateMethod · 0.80
UnlockFileMethod · 0.45

Tested by

no test coverage detected