mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-25 09:52:23 -05:00
Major refactoring: testing
This commit is contained in:
parent
ea09e3a57b
commit
0d74769c07
@ -81,7 +81,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
if ((0 == RelatedFileObject || RelatedFileObject->FsContext) && 0 == FileName.Length)
|
if ((0 == RelatedFileObject || RelatedFileObject->FsContext) && 0 == FileName.Length)
|
||||||
{
|
{
|
||||||
if (0 != FsvolDeviceExtension->FsvrtDeviceObject)
|
if (0 != FsvolDeviceExtension->FsvrtDeviceObject)
|
||||||
IrpSp->FileObject->Vpb = FsvolDeviceExtension->FsvrtDeviceObject->Vpb;
|
FileObject->Vpb = FsvolDeviceExtension->FsvrtDeviceObject->Vpb;
|
||||||
|
|
||||||
Irp->IoStatus.Information = FILE_OPENED;
|
Irp->IoStatus.Information = FILE_OPENED;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -74,7 +74,6 @@ void mount_create_volume_test(void)
|
|||||||
mount_create_volume_dotest(L"WinFsp.Net");
|
mount_create_volume_dotest(L"WinFsp.Net");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static unsigned __stdcall mount_volume_cancel_dotest_thread(void *FilePath)
|
static unsigned __stdcall mount_volume_cancel_dotest_thread(void *FilePath)
|
||||||
{
|
{
|
||||||
FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath);
|
FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath);
|
||||||
@ -92,17 +91,21 @@ void mount_volume_cancel_dotest(PWSTR DeviceName)
|
|||||||
{
|
{
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
FSP_FSCTL_VOLUME_PARAMS Params = { 0 };
|
FSP_FSCTL_VOLUME_PARAMS VolumeParams = { 0 };
|
||||||
WCHAR VolumePath[MAX_PATH];
|
WCHAR VolumePath[MAX_PATH];
|
||||||
WCHAR FilePath[MAX_PATH];
|
WCHAR FilePath[MAX_PATH];
|
||||||
HANDLE VolumeHandle;
|
HANDLE VolumeHandle;
|
||||||
HANDLE Thread;
|
HANDLE Thread;
|
||||||
DWORD ExitCode;
|
DWORD ExitCode;
|
||||||
|
|
||||||
Params.SectorSize = 16384;
|
VolumeParams.SectorSize = 16384;
|
||||||
Params.SerialNumber = 0x12345678;
|
VolumeParams.SerialNumber = 0x12345678;
|
||||||
Result = FspFsctlCreateVolume(DeviceName, &Params, 0, VolumePath, sizeof VolumePath);
|
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), L"\\\\winfsp-tests");
|
||||||
|
Result = FspFsctlCreateVolume(DeviceName, &VolumeParams,
|
||||||
|
VolumePath, sizeof VolumePath, &VolumeHandle);
|
||||||
ASSERT(STATUS_SUCCESS == Result);
|
ASSERT(STATUS_SUCCESS == Result);
|
||||||
|
ASSERT(0 == wcsncmp(L"\\Device\\Volume{", VolumePath, 15));
|
||||||
|
ASSERT(INVALID_HANDLE_VALUE != VolumeHandle);
|
||||||
|
|
||||||
StringCbPrintfW(FilePath, sizeof FilePath, L"\\\\?\\GLOBALROOT%s\\file0", VolumePath);
|
StringCbPrintfW(FilePath, sizeof FilePath, L"\\\\?\\GLOBALROOT%s\\file0", VolumePath);
|
||||||
Thread = (HANDLE)_beginthreadex(0, 0, mount_volume_cancel_dotest_thread, FilePath, 0, 0);
|
Thread = (HANDLE)_beginthreadex(0, 0, mount_volume_cancel_dotest_thread, FilePath, 0, 0);
|
||||||
@ -110,12 +113,6 @@ void mount_volume_cancel_dotest(PWSTR DeviceName)
|
|||||||
|
|
||||||
Sleep(1000); /* give some time to the thread to execute */
|
Sleep(1000); /* give some time to the thread to execute */
|
||||||
|
|
||||||
Result = FspFsctlOpenVolume(VolumePath, &VolumeHandle);
|
|
||||||
ASSERT(STATUS_SUCCESS == Result);
|
|
||||||
|
|
||||||
Result = FspFsctlDeleteVolume(VolumeHandle);
|
|
||||||
ASSERT(STATUS_SUCCESS == Result);
|
|
||||||
|
|
||||||
Success = CloseHandle(VolumeHandle);
|
Success = CloseHandle(VolumeHandle);
|
||||||
ASSERT(Success);
|
ASSERT(Success);
|
||||||
|
|
||||||
@ -134,6 +131,7 @@ void mount_volume_cancel_test(void)
|
|||||||
mount_volume_cancel_dotest(L"WinFsp.Net");
|
mount_volume_cancel_dotest(L"WinFsp.Net");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static unsigned __stdcall mount_volume_transact_dotest_thread(void *FilePath)
|
static unsigned __stdcall mount_volume_transact_dotest_thread(void *FilePath)
|
||||||
{
|
{
|
||||||
FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath);
|
FspDebugLog(__FUNCTION__ ": \"%S\"\n", FilePath);
|
||||||
@ -257,8 +255,8 @@ void mount_tests(void)
|
|||||||
TEST(mount_invalid_test);
|
TEST(mount_invalid_test);
|
||||||
TEST(mount_open_device_test);
|
TEST(mount_open_device_test);
|
||||||
TEST(mount_create_volume_test);
|
TEST(mount_create_volume_test);
|
||||||
#if 0
|
|
||||||
TEST(mount_volume_cancel_test);
|
TEST(mount_volume_cancel_test);
|
||||||
|
#if 0
|
||||||
TEST(mount_volume_transact_test);
|
TEST(mount_volume_transact_test);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user