hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
713 stars 180 forks source link

On FileAttributes of FileBasicInformation #570

Closed zhongshao closed 4 years ago

zhongshao commented 4 years ago

FileBasicInformation current = share.getFileInformation(path, FileBasicInformation.class); current.getFileAttributes What do you mean () equals 34 and 38,or Where can I find FileAttributes worth defining?

ecki commented 4 years ago

Please rephrase your question, it is hard to comprehend.

zhongshao commented 4 years ago

Please rephrase your question, it is hard to comprehend.

FileBasicInformation current = share.getFileInformation(path, FileBasicInformation.class); current.getFileAttributes=34; What does 34 mean here?

current.getFileAttributes=38; What does 38 mean here?

I don't know what 34, 38 means here。

ecki commented 4 years ago

The values are described in the protocol spec here, https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca28ec38-f155-4768-81d6-4bfeb8586fc9

34 looks like hidden+archive, and +4 is system.

The values are also defined as constants in FileAttributes https://www.javadoc.io/static/com.hierynomus/smbj/0.0.5/com/hierynomus/msfscc/FileAttributes.html#FILE_ATTRIBUTE_SYSTEM

hierynomus commented 4 years ago

You can check whether an attribute is set (or convert it to a set of attributes using):

boolean isHidden = EnumWithValue.EnumUtils.isSet(current.getFileAttributes(), FileAttributes.FILE_ATTRIBUTE_HIDDEN);
Set<FileAttributes> attrs = EnumWithValue.EnumUtils.toEnumSet(current.getFileAttributes(), FileAttributes.class);
zhongshao commented 4 years ago

The values are described in the protocol spec here, https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ca28ec38-f155-4768-81d6-4bfeb8586fc9

34 looks like hidden+archive, and +4 is system.

The values are also defined as constants in FileAttributes https://www.javadoc.io/static/com.hierynomus/smbj/0.0.5/com/hierynomus/msfscc/FileAttributes.html#FILE_ATTRIBUTE_SYSTEM

Your answer is helpful to me. Thank you for your answer.

zhongshao commented 4 years ago

You can check whether an attribute is set (or convert it to a set of attributes using):

boolean isHidden = EnumWithValue.EnumUtils.isSet(current.getFileAttributes(), FileAttributes.FILE_ATTRIBUTE_HIDDEN);
Set<FileAttributes> attrs = EnumWithValue.EnumUtils.toEnumSet(current.getFileAttributes(), FileAttributes.class);

Your answer is helpful to me. Thank you for your answer.

hierynomus commented 4 years ago

I'll close the issue as the question has been answered.