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,20 +12,26 @@ if X!ProjDir!==X (echo usage: build-sample Config Arch Sample ProjDir >&2 & goto
|
||||
|
||||
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
|
||||
|
||||
set RegKey="HKLM\SOFTWARE\WinFsp"
|
||||
set RegVal="InstallDir"
|
||||
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
||||
if !ERRORLEVEL! equ 0 (
|
||||
if X!FSP_SAMPLE_DIR!==X (
|
||||
set RegKey="HKLM\SOFTWARE\WinFsp"
|
||||
set RegVal="InstallDir"
|
||||
reg query !RegKey! /v !RegVal! /reg:32 >nul 2>&1
|
||||
if !ERRORLEVEL! equ 0 (
|
||||
for /f "tokens=2,*" %%i in ('reg query !RegKey! /v !RegVal! /reg:32 ^| findstr !RegVal!') do (
|
||||
set InstallDir=%%j
|
||||
)
|
||||
)
|
||||
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)
|
||||
|
||||
set SampleDir=!InstallDir!samples
|
||||
) else (
|
||||
set SampleDir=!FSP_SAMPLE_DIR!
|
||||
)
|
||||
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 exist "!ProjDir!" rmdir /s/q "!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!"
|
||||
if !ERRORLEVEL! neq 0 goto :fail
|
||||
|
@ -505,7 +505,8 @@ if !ERRORLEVEL! neq 0 goto fail
|
||||
exit /b 0
|
||||
|
||||
: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
|
||||
exit /b 0
|
||||
|
||||
@ -536,7 +537,7 @@ L:
|
||||
"%ProjRoot%\build\VStudio\build\%Configuration%\%4.exe" ^
|
||||
--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 ^
|
||||
-reparse* -stream*
|
||||
-reparse* -stream* %~5
|
||||
if !ERRORLEVEL! neq 0 set RunSampleTestExit=1
|
||||
popd
|
||||
echo net use L: /delete
|
||||
|
@ -197,6 +197,11 @@ namespace passthrough
|
||||
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 */
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
@ -243,6 +248,11 @@ namespace passthrough
|
||||
Int32 FileInformationClass,
|
||||
ref FILE_DISPOSITION_INFO lpFileInformation,
|
||||
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)]
|
||||
private static extern Boolean SetFileSecurityW(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
|
||||
@ -590,21 +600,9 @@ namespace passthrough
|
||||
String NewFileName,
|
||||
Boolean ReplaceIfExists)
|
||||
{
|
||||
FileDesc FileDesc = (FileDesc)FileDesc0;
|
||||
FileName = ConcatPath(FileName);
|
||||
NewFileName = ConcatPath(NewFileName);
|
||||
if (null != FileDesc.Stream)
|
||||
{
|
||||
if (ReplaceIfExists)
|
||||
File.Delete(NewFileName);
|
||||
File.Move(FileName, NewFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ReplaceIfExists)
|
||||
throw new UnauthorizedAccessException();
|
||||
Directory.Move(FileName, NewFileName);
|
||||
}
|
||||
FileDesc.Rename(FileName, NewFileName, ReplaceIfExists);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
protected override Int32 GetSecurity(
|
||||
|
Loading…
x
Reference in New Issue
Block a user