EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SolFSStorage.SetFileAttributes method

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#7047
Posted: 07/24/2008 14:37:01
by tagnal (Standard support level)
Joined: 03/18/2008
Posts: 20

I am having a problem with setting file attributes using this function. After I have imported a file into the SolFSStorage object, I am trying to set the file attributes that it had in windows.

As an example, I just imported a Thumbs.db file which has the Hidden file attribute set and am now trying to set its file attributes within the storage.

Code
if (hidden)
{
   MyVault.SetFileAttributes(fullStoragePath, 256);
}


fullStoragePath is the path of Thumbs.db in the storage object, "\\Thumbs.db"
265 is the int value specified in the documentation for attrHidden.

Doing this, I get an exception:
Quote
SolFS.ESolFSError: SolFS Error: Invalid parameter
at SolFS.?A0x3695e58c.CheckStorageResult(Int32 StorageResult)
at SolFS.SolFSStorage.SetFileAttributes(String fileName, Int32 attributes)
at Myproject.Myclass.Import_file(myParams)


Any help as to what I am doing wrong would be appreciated.

#7050
Posted: 07/25/2008 02:16:32
by Alexander Plas (EldoS Corp.)

Hello.

Your operation not only set attrHidden but also clear all other attributes including attrFile. Please use following code to set or clear attributes

Code
  LongWord Attr = MyVault.GetFileAttributes(fullStoragePath);
  if (hidden)
  {
    Attr |= attrHidden;
  }
  else
  {
    Attr &= ~attrHidden;
  }
  MyVault.SetFileAttributes(fullStoragePath, Attr);
#7061
Posted: 07/25/2008 19:28:49
by tagnal (Standard support level)
Joined: 03/18/2008
Posts: 20

Thanks for the reply. I was able to get this working with your suggestion. =)

Reply

Statistics

Topic viewed 2465 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!