| 1046 | } |
| 1047 | |
| 1048 | static NTSTATUS DOKAN_CALLBACK CryptDeleteFile(LPCWSTR FileName, |
| 1049 | PDOKAN_FILE_INFO DokanFileInfo) { |
| 1050 | |
| 1051 | FileNameEnc filePath(DokanFileInfo, FileName); |
| 1052 | HANDLE handle = (HANDLE)DokanFileInfo->Context; |
| 1053 | |
| 1054 | DbgPrint(L"DeleteFile %s - %d\n", FileName, DokanFileInfo->DeletePending); |
| 1055 | |
| 1056 | if (can_delete_file(filePath)) { |
| 1057 | |
| 1058 | DWORD dwAttrib = GetFileAttributes(filePath); |
| 1059 | |
| 1060 | if (dwAttrib != INVALID_FILE_ATTRIBUTES && |
| 1061 | (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) |
| 1062 | return STATUS_ACCESS_DENIED; |
| 1063 | |
| 1064 | if (handle && handle != INVALID_HANDLE_VALUE) { |
| 1065 | FILE_DISPOSITION_INFO fdi; |
| 1066 | fdi.DeleteFile = DokanFileInfo->DeletePending; |
| 1067 | if (!SetFileInformationByHandle(handle, FileDispositionInfo, &fdi, |
| 1068 | sizeof(FILE_DISPOSITION_INFO))) |
| 1069 | return DokanNtStatusFromWin32(GetLastError()); |
| 1070 | } |
| 1071 | |
| 1072 | return STATUS_SUCCESS; |
| 1073 | } else { |
| 1074 | DWORD error = GetLastError(); |
| 1075 | if (error == 0) |
| 1076 | error = ERROR_ACCESS_DENIED; |
| 1077 | DbgPrint(L"\tDeleteFile error code = %d\n\n", error); |
| 1078 | return ToNtStatus(error); |
| 1079 | } |
| 1080 | } |
| 1081 | |
| 1082 | static NTSTATUS DOKAN_CALLBACK |
| 1083 | CryptDeleteDirectory(LPCWSTR FileName, PDOKAN_FILE_INFO DokanFileInfo) { |
nothing calls this directly
no test coverage detected