mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 17:03:12 -05:00
sys: IRP_MJ_SET_INFORMATION: FileDispositionInformation: testing
This commit is contained in:
parent
4cdbdb5682
commit
4648ace652
@ -79,7 +79,7 @@ FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem,
|
||||
if (0 != FileSystem->Interface->CanDelete)
|
||||
if (Request->Req.SetInformation.Info.Disposition.Delete)
|
||||
Result = FileSystem->Interface->CanDelete(FileSystem, Request,
|
||||
(PVOID)Request->Req.Close.UserContext);
|
||||
(PVOID)Request->Req.SetInformation.UserContext);
|
||||
else
|
||||
Result = STATUS_SUCCESS;
|
||||
break;
|
||||
|
@ -772,7 +772,7 @@ static NTSTATUS FspFsvolSetDispositionInformationSuccess(
|
||||
FspIopRequestContext(Request, RequestFileNode) = 0;
|
||||
FspIopRequestContext(Request, RequestDeviceObject) = 0;
|
||||
FspFileNodeReleaseOwner(FileNode, Full, Request);
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
FspFsvolDeviceFileRenameReleaseOwner(FsvolDeviceObject, Request);
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
@ -935,7 +935,7 @@ static NTSTATUS FspFsvolSetRenameInformationSuccess(
|
||||
FspIopRequestContext(Request, RequestFileNode) = 0;
|
||||
FspIopRequestContext(Request, RequestDeviceObject) = 0;
|
||||
FspFileNodeReleaseOwner(FileNode, Full, Request);
|
||||
FspFsvolDeviceFileRenameRelease(FsvolDeviceObject);
|
||||
FspFsvolDeviceFileRenameReleaseOwner(FsvolDeviceObject, Request);
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
|
||||
|
@ -221,6 +221,71 @@ void setfileinfo_test(void)
|
||||
}
|
||||
}
|
||||
|
||||
void delete_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
|
||||
{
|
||||
void *memfs = memfs_start_ex(Flags, FileInfoTimeout);
|
||||
|
||||
HANDLE Handle;
|
||||
BOOL Success;
|
||||
WCHAR Dir1Path[MAX_PATH];
|
||||
WCHAR FilePath[MAX_PATH];
|
||||
|
||||
StringCbPrintfW(Dir1Path, sizeof Dir1Path, L"%s%s\\dir1",
|
||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||
|
||||
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\dir1\\file0",
|
||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||
|
||||
Success = CreateDirectoryW(Dir1Path, 0);
|
||||
ASSERT(Success);
|
||||
|
||||
Handle = CreateFileW(FilePath,
|
||||
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
|
||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||
CloseHandle(Handle);
|
||||
|
||||
Success = RemoveDirectoryW(Dir1Path);
|
||||
ASSERT(!Success);
|
||||
ASSERT(ERROR_DIR_NOT_EMPTY == GetLastError());
|
||||
|
||||
Success = DeleteFileW(FilePath);
|
||||
ASSERT(Success);
|
||||
|
||||
Success = DeleteFileW(FilePath);
|
||||
ASSERT(!Success);
|
||||
ASSERT(ERROR_FILE_NOT_FOUND == GetLastError());
|
||||
|
||||
Success = RemoveDirectoryW(Dir1Path);
|
||||
ASSERT(Success);
|
||||
|
||||
Success = RemoveDirectoryW(Dir1Path);
|
||||
ASSERT(!Success);
|
||||
ASSERT(ERROR_FILE_NOT_FOUND == GetLastError());
|
||||
|
||||
memfs_stop(memfs);
|
||||
}
|
||||
|
||||
void delete_test(void)
|
||||
{
|
||||
if (NtfsTests)
|
||||
{
|
||||
WCHAR DirBuf[MAX_PATH] = L"\\\\?\\";
|
||||
GetCurrentDirectoryW(MAX_PATH - 4, DirBuf + 4);
|
||||
delete_dotest(-1, DirBuf, 0);
|
||||
}
|
||||
if (WinFspDiskTests)
|
||||
{
|
||||
delete_dotest(MemfsDisk, 0, 0);
|
||||
delete_dotest(MemfsDisk, 0, 1000);
|
||||
}
|
||||
if (WinFspNetTests)
|
||||
{
|
||||
delete_dotest(MemfsNet, L"\\\\memfs\\share", 0);
|
||||
delete_dotest(MemfsNet, L"\\\\memfs\\share", 1000);
|
||||
}
|
||||
}
|
||||
|
||||
void getvolinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
|
||||
{
|
||||
void *memfs = memfs_start_ex(Flags, FileInfoTimeout);
|
||||
@ -286,5 +351,6 @@ void info_tests(void)
|
||||
{
|
||||
TEST(getfileinfo_test);
|
||||
TEST(setfileinfo_test);
|
||||
TEST(delete_test);
|
||||
TEST(getvolinfo_test);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user