Files
go-winio/pkg
Gabriel dd5de6900b Add some basic bind filter functions (#274)
* Add some basic bind filter functions

This change adds the ability to mount a a single folder or a volume
inside another folder, using the bind filter API.

While the API allows mounting multiple sources inside a single mount
point, acting as an overlay, we disable this functionality in the ApplyFileBinding
function.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Add some tests

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Move bind filter to different package

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Use string in signature and fix getFinalPath

  * Properly close handle in getFinalPath()
  * Use string in function signature. mksyscall generates proper code to
    convert to utf16
  * Enable TestRemoveFileBinding on Windows Server 2019

Windows Server 2019 only exposes 2 function in bindfltapi.dll:

  * BfRemoveMapping
  * BfSetupFilter

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Use windows.UTF16ToString to decode string

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Optimize bfGetMappings signature

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Skip unsupported tests on ltsc2019

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Fix typo, add testcase

  * Additionally check if we can write to a read-only mount point, not
    just delete from it
  * No need to set FILE_FLAG_OPEN_REPARSE_POINT when opening a file

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Remove extra flags

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

* Add test to account for symlinks as sources

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>

---------

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-02-28 11:37:19 -05:00
..
2022-08-29 16:27:34 -04:00