mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
tst: passthrough-dotnet: include in test suite
This commit is contained in:
parent
739eb80cfb
commit
a29390412b
@ -12,6 +12,7 @@ if X!ProjDir!==X (echo usage: build-sample Config Arch Sample ProjDir >&2 & goto
|
|||||||
|
|
||||||
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
|
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
|
||||||
|
|
||||||
|
if X!FSP_SAMPLE_DIR!==X (
|
||||||
set RegKey="HKLM\SOFTWARE\WinFsp"
|
set RegKey="HKLM\SOFTWARE\WinFsp"
|
||||||
set RegVal="InstallDir"
|
set RegVal="InstallDir"
|
||||||
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
||||||
@ -23,9 +24,14 @@ if !ERRORLEVEL! equ 0 (
|
|||||||
if not exist "!InstallDir!" (echo cannot find WinFsp installation >&2 & goto fail)
|
if not exist "!InstallDir!" (echo cannot find WinFsp installation >&2 & goto fail)
|
||||||
if not exist "!InstallDir!samples\!Sample!" (echo cannot find WinFsp sample !Sample! >&2 & goto fail)
|
if not exist "!InstallDir!samples\!Sample!" (echo cannot find WinFsp sample !Sample! >&2 & goto fail)
|
||||||
|
|
||||||
|
set SampleDir=!InstallDir!samples
|
||||||
|
) else (
|
||||||
|
set SampleDir=!FSP_SAMPLE_DIR!
|
||||||
|
)
|
||||||
|
|
||||||
if exist "!ProjDir!" rmdir /s/q "!ProjDir!"
|
if exist "!ProjDir!" rmdir /s/q "!ProjDir!"
|
||||||
mkdir "!ProjDir!"
|
mkdir "!ProjDir!"
|
||||||
xcopy /s/e/q/y "!InstallDir!samples\!Sample!" "!ProjDir!"
|
xcopy /s/e/q/y "!SampleDir!\!Sample!" "!ProjDir!"
|
||||||
|
|
||||||
devenv "!ProjDir!\!Sample!.sln" /build "!Config!|!Arch!"
|
devenv "!ProjDir!\!Sample!.sln" /build "!Config!|!Arch!"
|
||||||
if !ERRORLEVEL! neq 0 goto :fail
|
if !ERRORLEVEL! neq 0 goto :fail
|
||||||
|
@ -505,7 +505,8 @@ if !ERRORLEVEL! neq 0 goto fail
|
|||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
:sample-passthrough-dotnet
|
:sample-passthrough-dotnet
|
||||||
call :__run_sample_test passthrough-dotnet anycpu passthrough-dotnet winfsp-tests-x64
|
call :__run_sample_test passthrough-dotnet anycpu passthrough-dotnet winfsp-tests-x64 ^
|
||||||
|
"-create_backup_test -create_restore_test -create_namelen_test -delete_access_test"
|
||||||
if !ERRORLEVEL! neq 0 goto fail
|
if !ERRORLEVEL! neq 0 goto fail
|
||||||
exit /b 0
|
exit /b 0
|
||||||
|
|
||||||
@ -536,7 +537,7 @@ L:
|
|||||||
"%ProjRoot%\build\VStudio\build\%Configuration%\%4.exe" ^
|
"%ProjRoot%\build\VStudio\build\%Configuration%\%4.exe" ^
|
||||||
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
--external --resilient --case-insensitive-cmp --share-prefix="\%1\%TMP::=$%\%1\test" ^
|
||||||
-create_allocation_test -getfileinfo_name_test -rename_flipflop_test -rename_mmap_test -exec_rename_dir_test ^
|
-create_allocation_test -getfileinfo_name_test -rename_flipflop_test -rename_mmap_test -exec_rename_dir_test ^
|
||||||
-reparse* -stream*
|
-reparse* -stream* %~5
|
||||||
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
||||||
popd
|
popd
|
||||||
echo net use L: /delete
|
echo net use L: /delete
|
||||||
|
@ -197,6 +197,11 @@ namespace passthrough
|
|||||||
ThrowIoExceptionWithHResult(ex.HResult);
|
ThrowIoExceptionWithHResult(ex.HResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void Rename(String FileName, String NewFileName, Boolean ReplaceIfExists)
|
||||||
|
{
|
||||||
|
if (!MoveFileExW(FileName, NewFileName, ReplaceIfExists ? 1U/*MOVEFILE_REPLACE_EXISTING*/ : 0))
|
||||||
|
ThrowIoExceptionWithWin32(Marshal.GetLastWin32Error());
|
||||||
|
}
|
||||||
|
|
||||||
/* interop */
|
/* interop */
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||||
@ -243,6 +248,11 @@ namespace passthrough
|
|||||||
Int32 FileInformationClass,
|
Int32 FileInformationClass,
|
||||||
ref FILE_DISPOSITION_INFO lpFileInformation,
|
ref FILE_DISPOSITION_INFO lpFileInformation,
|
||||||
UInt32 dwBufferSize);
|
UInt32 dwBufferSize);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
private static extern Boolean MoveFileExW(
|
||||||
|
[MarshalAs(UnmanagedType.LPWStr)] String lpExistingFileName,
|
||||||
|
[MarshalAs(UnmanagedType.LPWStr)] String lpNewFileName,
|
||||||
|
UInt32 dwFlags);
|
||||||
[DllImport("advapi32.dll", SetLastError = true)]
|
[DllImport("advapi32.dll", SetLastError = true)]
|
||||||
private static extern Boolean SetFileSecurityW(
|
private static extern Boolean SetFileSecurityW(
|
||||||
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
|
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
|
||||||
@ -590,21 +600,9 @@ namespace passthrough
|
|||||||
String NewFileName,
|
String NewFileName,
|
||||||
Boolean ReplaceIfExists)
|
Boolean ReplaceIfExists)
|
||||||
{
|
{
|
||||||
FileDesc FileDesc = (FileDesc)FileDesc0;
|
|
||||||
FileName = ConcatPath(FileName);
|
FileName = ConcatPath(FileName);
|
||||||
NewFileName = ConcatPath(NewFileName);
|
NewFileName = ConcatPath(NewFileName);
|
||||||
if (null != FileDesc.Stream)
|
FileDesc.Rename(FileName, NewFileName, ReplaceIfExists);
|
||||||
{
|
|
||||||
if (ReplaceIfExists)
|
|
||||||
File.Delete(NewFileName);
|
|
||||||
File.Move(FileName, NewFileName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ReplaceIfExists)
|
|
||||||
throw new UnauthorizedAccessException();
|
|
||||||
Directory.Move(FileName, NewFileName);
|
|
||||||
}
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
protected override Int32 GetSecurity(
|
protected override Int32 GetSecurity(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user