| 1394 | } |
| 1395 | |
| 1396 | static 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 | |
| 1432 | static NTSTATUS DOKAN_CALLBACK CryptSetEndOfFile( |
| 1433 | LPCWSTR FileName, LONGLONG ByteOffset, PDOKAN_FILE_INFO DokanFileInfo) { |
nothing calls this directly
no test coverage detected