From 64f66e48afcead5b172a883d14f5984a1aa185c5 Mon Sep 17 00:00:00 2001 From: JaniruTEC Date: Tue, 5 May 2020 18:24:07 +0200 Subject: [PATCH] Added multiple Enums to wrap native bitmasks Added DokanFileInfoFlag to aid in creating a wrapper ("DokanFileHandle") for DokanFileInfo's getters (e.g. isDirectory()) Added FileShareAccess to wrap paramter rawShareAccess of DokanyFileSystem#zwCreateFile to aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem Added MicrosoftReparsePointTag to wrap field dwReserved0 of WinBase.WIN32_FIND_DATA to aid in creating a wrappe ("FindFileInfo") for WinBase.WIN32_FIND_DATA (used by DokanyFileSystem#findFiles) This commit is part of my effort to fix dokan-java's issue 32 (https://github.com/dokan-dev/dokan-java/issues/32): Adding wrappers for high-level programming --- gradle.properties | 2 +- .../constants/dokany/DokanFileInfoFlag.java | 27 ++++++++++++++++ .../constants/microsoft/FileShareAccess.java | 21 ++++++++++++ .../microsoft/MicrosoftReparsePointTag.java | 32 +++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/main/java/dev/dokan/dokan_java/constants/dokany/DokanFileInfoFlag.java create mode 100644 src/main/java/dev/dokan/dokan_java/constants/microsoft/FileShareAccess.java create mode 100644 src/main/java/dev/dokan/dokan_java/constants/microsoft/MicrosoftReparsePointTag.java diff --git a/gradle.properties b/gradle.properties index 90386a6..1bad6f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ name=dokan-java -version=1.1.1 +version=1.2.0-SNAPSHOT group=dev.dokan artifact=dokan-java description=A Java wrapper for Dokany (https://dokan-dev.github.io/) diff --git a/src/main/java/dev/dokan/dokan_java/constants/dokany/DokanFileInfoFlag.java b/src/main/java/dev/dokan/dokan_java/constants/dokany/DokanFileInfoFlag.java new file mode 100644 index 0000000..4dc080b --- /dev/null +++ b/src/main/java/dev/dokan/dokan_java/constants/dokany/DokanFileInfoFlag.java @@ -0,0 +1,27 @@ +package dev.dokan.dokan_java.constants.dokany; + +import dev.dokan.dokan_java.constants.EnumInteger; + +/** + * [TO BE REPLACED WITH LICENSE NOTE] + */ +public enum DokanFileInfoFlag implements EnumInteger { + + DELETE_ON_CLOSE(1), + IS_DIRECTORY(2), + NO_CACHE(4), + PAGING_IO(8), + SYNCHRONOUS_IO(16), + WRITE_TO_END_OF_FILE(32); + + private final int mask; + + DokanFileInfoFlag(int mask) { + this.mask = mask; + } + + @Override + public int getMask() { + return this.mask; + } +} diff --git a/src/main/java/dev/dokan/dokan_java/constants/microsoft/FileShareAccess.java b/src/main/java/dev/dokan/dokan_java/constants/microsoft/FileShareAccess.java new file mode 100644 index 0000000..3efc96b --- /dev/null +++ b/src/main/java/dev/dokan/dokan_java/constants/microsoft/FileShareAccess.java @@ -0,0 +1,21 @@ +package dev.dokan.dokan_java.constants.microsoft; + +import dev.dokan.dokan_java.constants.EnumInteger; + +public enum FileShareAccess implements EnumInteger { + + FILE_SHARE_READ(1), + FILE_SHARE_WRITE(2), + FILE_SHARE_DELETE(4); + + private final int mask; + + FileShareAccess(int mask) { + this.mask = mask; + } + + @Override + public int getMask() { + return this.mask; + } +} diff --git a/src/main/java/dev/dokan/dokan_java/constants/microsoft/MicrosoftReparsePointTag.java b/src/main/java/dev/dokan/dokan_java/constants/microsoft/MicrosoftReparsePointTag.java new file mode 100644 index 0000000..0e68e06 --- /dev/null +++ b/src/main/java/dev/dokan/dokan_java/constants/microsoft/MicrosoftReparsePointTag.java @@ -0,0 +1,32 @@ +package dev.dokan.dokan_java.constants.microsoft; + +import dev.dokan.dokan_java.constants.EnumInteger; + +/** + * [TO BE REPLACED WITH LICENSE NOTE] + */ +public enum MicrosoftReparsePointTag implements EnumInteger { + + IO_REPARSE_TAG_CSV(0x80000009), + IO_REPARSE_TAG_DEDUP(0x80000013), + IO_REPARSE_TAG_DFS(0x8000000A), + IO_REPARSE_TAG_DFSR(0x80000012), + IO_REPARSE_TAG_HSM(0xC0000004), + IO_REPARSE_TAG_HSM2(0x80000006), + IO_REPARSE_TAG_MOUNT_POINT(0xA0000003), + IO_REPARSE_TAG_NFS(0x80000014), + IO_REPARSE_TAG_SIS(0x80000007), + IO_REPARSE_TAG_SYMLINK(0xA000000C), + IO_REPARSE_TAG_WIM(0x80000008); + + private final int mask; + + MicrosoftReparsePointTag(int mask) { + this.mask = mask; + } + + @Override + public int getMask() { + return this.mask; + } +}