EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ACCESS_MASK passed into openfile

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#6283
Posted: 05/15/2008 18:09:09
by Vijay Mani (Standard support level)
Joined: 03/09/2008
Posts: 29

Hi all,
I'm having some issues with the accessMask that is passed into the openfile callback. Upon opening the root folder of the mounted drive, the openfile call passes in an access mask for (0x80 & then 0x00100001). I've looked in the CreateFile api and I can't find what rights these correspond to.

For the other files that are enumerated, openfile gets called with 0x00120089 which has STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE access and this works.

I am however having issues with files that are readonly. I'm made sure that the attributes for the file is set as read-only, and that the getfileinfo callback returns the attributes including read-only. However openfile gets called with just 0x00120089 accessmask. I tried throwing an ECBFSError and also just returning, and neither approach works.
Any suggestions?
#6285
Posted: 05/16/2008 02:03:26
by Eugene Mayevski (EldoS Corp.)

"read-only" is just the file attribute, which the application is safe to ignore. It's a leftover from old MS DOS and FAT12 times.

So you should expect requests to open the file in write mode even when your file has read-only attribute.

I believe, that you can report ERROR_FILE_READ_ONLY (#define ERROR_FILE_READ_ONLY 6009L) error code using ECBFSError and this should work.


Sincerely yours
Eugene Mayevski
#6313
Posted: 05/19/2008 09:22:54
by Volodymyr Zinin (EldoS Corp.)

BTW: The accessmask 0x00120089 is
SYNCHRONIZE | READ_CONTROL | FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA
#6318
Posted: 05/19/2008 15:58:25
by Vijay Mani (Standard support level)
Joined: 03/09/2008
Posts: 29

Yeah, I should have updated this post sooner.
But throwing the ERR0R_FILE_READ_ONLY works fine.

Right. I think STANDARD_RIGHTS_READ AND STANDARD_RIGHTS_WRITE are set to same value as READ_CONTROL. Hence my initial assumption.

But the correct masks to check against are FILE_WRITE_DATA AND FILE_READ_DATA, (along with the ones u mentioned.)

For whomeever else that cares.
0x80 = FILE_READ_ATTRIBUTES
0x00100001 = SYNCHRONIZE | FILE_READ_DATA.

Reply

Statistics

Topic viewed 3483 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!