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

Function DOKAN_CALLBACK CryptDeleteFile

cppcryptfs/dokan/cryptdokan.cpp:1048–1080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1046}
1047
1048static 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
1082static NTSTATUS DOKAN_CALLBACK
1083CryptDeleteDirectory(LPCWSTR FileName, PDOKAN_FILE_INFO DokanFileInfo) {

Callers

nothing calls this directly

Calls 3

DbgPrintFunction · 0.85
can_delete_fileFunction · 0.85
ToNtStatusFunction · 0.85

Tested by

no test coverage detected