File attributes don't get set correctly

102 views
Skip to first unread message

phpeter

unread,
Jan 20, 2021, 2:03:55 PM1/20/21
to Dokan
I am trying to get desktop.ini and autorun.inf files to work on my Dokan drive. To do this, I set the following attributes on fileinfo on the "GetFileInformation()" function:

FileAttributes.Hidden | FileAttributes.System | FileAttributes.Archive

I have stepped through this code to confirm that it is indeed setting these attributes, but when I right-click and select "Properties->Details" it displays the attributes for that file as N (Normal).

Is there something else I have to change so that these attributes get set properly?

Thank you,
Peter

Adrien JUND

unread,
Jan 21, 2021, 1:58:17 AM1/21/21
to do...@googlegroups.com
Hi,

This looks to be correct.
Have you tried to look at what the dokan sample returns in the function when the system is ready the desktop.ini ?

--
You received this message because you are subscribed to the Google Groups "Dokan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dokan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dokan/782c0a9e-ccc0-43ec-8d86-4e88b834fcadn%40googlegroups.com.

phpeter

unread,
Jan 22, 2021, 11:13:25 AM1/22/21
to Dokan
I attempted to use the Dokan Mirror example to test desktop.ini, it returns the proper attributes (Hidden, System, Archive), but then when I change the code to hardcode the "Normal" attribute (see my code below), it is still returning the Hidden/System/Archive attribute (see screenshot). I have tried restarting explorer, remounting, etc. but it still seems to be getting the "old" attributes. Why isn't it retrieving my hardcoded "Normal" attribute? What am I missing?

```
        public NtStatus GetFileInformation(string fileName, out FileInformation fileInfo, IDokanFileInfo info)
        {
            // may be called with info.Context == null, but usually it isn't

            fileInfo = new FileInformation
            {
                FileName = fileName,
                Attributes = FileAttributes.Normal,
                CreationTime = null,
                LastAccessTime = null,
                LastWriteTime = null,
                Length = 116,
            };
            return Trace(nameof(GetFileInformation), fileName, info, DokanResult.Success);
        }

Screenshot 2021-01-22 111311.png

Adrien JUND

unread,
Jan 22, 2021, 4:06:08 PM1/22/21
to do...@googlegroups.com
Please see du code of memfs for the attributes in createfiles and getfileinformations. That might help you to see how normal attribute is working.

Reply all
Reply to author
Forward
0 new messages