EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Not supporting recycle bin

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 01/11/2008 08:21:04
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

We do not want to support the recycle bin in Windows, files should always be deleted, not moved to the "Recycled" folder. What would be the correct way to handle this in CallbackFS?

The system calls CbFsCreateFile to create the folder but we do not allow it, what should we do to handle this?
Posted: 01/11/2008 08:28:34
by Franck Bonin (Standard support level)
Joined: 09/21/2007
Posts: 27

try ::SetStorageCharacteristics(scRemovableMedia)
As for any removable media, explorer doesn't create the trash folder.
Posted: 01/11/2008 08:30:20
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

Thanks for the idea but we need to appear as a local disk rather than removeable.
Posted: 01/11/2008 09:30:10
by Volodymyr Zinin (EldoS Corp.)

Either return an error (ERROR_NOT_SUPPORTED, ERROR_ACCESS_DENIED, etc) when the system tries to create the "recycle bin" folders or disable it for your storages in the system (but I don't know how to do it).
Posted: 03/26/2015 23:26:08
by Jacky Lee (Standard support level)
Joined: 10/24/2014
Posts: 11


Either return an error (ERROR_NOT_SUPPORTED, ERROR_ACCESS_DENIED, etc) when the system tries to create the "recycle bin" folders or disable it for your storages in the system.

It works fine! I just add below code snippet to CreateFile callback
if (IsDirectory(fileAttributes)) { // directory
      if ( (fileName == L"\\$RECYCLE.BIN") || (fileName == L"\\RECYCLER") ) {
         throw ECBFSError(lastErr);
    // Other logic
Posted: 06/17/2015 15:19:05
by CODe (Basic support level)
Joined: 06/04/2015
Posts: 7

Sorry to resurrect this thread, but my question directly ties into this conversation. Is the last response still the approved way to disable support for the recycle bin?

Like the original poster, our drive must appear as a local disk, changing it to removable is not an option.

I'm currently receiving multiple error messages when I interact with the virtual mapped drive: "The Recycle Bin on Z:\ is corrupted. Do you want to empty the Recycle Bin for this drive?"

How do I disable recycle bin support so this error message goes away? My solution below is unfortunately not working...

In CbFsCreateFile, I've added the following to the top of the method:
if ((FileAttributes & (uint)CbFsFileAttributes.CBFS_FILE_ATTRIBUTE_DIRECTORY) != 0)
     if (FileName.Contains("$RECYCLE.BIN") || FileName.Contains("RECYCLER"))
          // throw error not supported

Posted: 06/17/2015 15:37:18
by Eugene Mayevski (EldoS Corp.)

Shooting at the foot because it aches is not the optimal solution. So is disabling the recycle bin if it gives you an error.

We don't know how to disable the Recycle Bin other than in the way Volodymyr has described. So there are two ways available:
1) find out why your recycle bin doesn't work
2) find out, what exactly doesn't work when you try to block the recycle bin.

Once you decide which way to go, we can discuss, what exactly doesn't work.

Sincerely yours
Eugene Mayevski
Posted: 06/17/2015 16:08:20
by CODe (Basic support level)
Joined: 06/04/2015
Posts: 7

I'm not disabling the recycle bin because it's giving me an error, my attempt to disable it for my own needs is now resulting in the error. For our use case, we cannot allow support of the recycle bin in our mapped virtual drive, as in we cannot allow deleted files to be recovered via the recycle bin.

We recently changed to using the CBFS_SYMLINK_MOUNT_MANAGER access mask flag and because mount points made with this flag support the recycle bin, we're now running into the error message I previously mentioned. Throwing ERROR_NOT_SUPPORTED when the recycle bin folders are being created seems to cause this message, as explorer is looking for the recycle bin folder when it isn't present and assumes it's corrupted.

I had hoped that you may have a solution on how to hide this error message or had provided a different solution in a software update since Volodymyr's answer from 2008.

Regardless, thanks very much for any help you can provide. I'll also check back in if I come up with a solution that can benefit others looking to do the same.
Posted: 06/17/2015 16:36:49
by Eugene Mayevski (EldoS Corp.)

I am sorry for misunderstanding you. I thought that your implementation caused the error you've specified, and then the attempt to suppress the recycle bin caused some other not specified error. Hence my comments.

It can be the option to let the system see the recycle bin, but handle it locally:
a) let the system create the folder itself and helper files if it needs to, but not store those files on the server
b) when the OS asks the filesystem to move the files to the recycle bin, discard (delete from the backend) the files and not move them.

Sincerely yours
Eugene Mayevski
Posted: 06/17/2015 16:48:19
by CODe (Basic support level)
Joined: 06/04/2015
Posts: 7

No worries about the misunderstanding, I can certainly see why you would have thought that by the way I phrased my question. I'll give your solutions a try. Thanks very much for the quick responses and assistance!
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.



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