Skip to content

ra1nyxin/ShellTrashCleanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

ShellTrashCleanner

License: MIT Version

ShellTrashCleanner is a minimalist, high-performance Win32-native utility engineered for deterministic enumeration and atomic purging of the Windows Recycle Bin. Unlike standard file-system scanners, this tool operates directly on the Windows Shell Namespace via COM interfaces, ensuring accurate handling of cross-drive SID-mapped artifacts and virtualized objects.


Key Features

  • Atomic Purging: Leverages SHEmptyRecycleBinW for a clean, system-level clearing process across all logical drives.
  • Shell Namespace Awareness: Enumerates items using IShellFolder and IEnumIDList, bypassing NTFS-level $Recycle.Bin obfuscation.
  • Zero-Dependency Static Build: Compiled with MinGW-w64 for a standalone, side-effect-free execution environment.
  • Interactive Safeguard: Built-in Y/N confirmation logic to prevent accidental data loss in automated workflows.

Technical Implementation

The core logic interfaces with the Shell32 and Ole32 subsystems:

  1. COM Initialization: Enforces COINIT_APARTMENTTHREADED for reliable Shell UI interaction.
  2. PIDL Resolution: Translates virtual folder entries to human-readable strings via StrRetToStrW.
  3. Sync Notification: Triggers SHChangeNotify with SHCNE_ASSOCCHANGED to force an immediate refresh of the Explorer view-state post-operation.

Installation & Usage

Pre-compiled Binary

The production-ready executable is available in the Releases section.

  • Release: v1.0.0
  • Binary: main.exe

Build from Source

Ensure you have a GCC/MinGW-w64 environment configured.

# Clone the repository
git clone https://github.com/ra1nyxin/ShellTrashCleanner.git
cd ShellTrashCleanner

# Compile using the hardened link order
gcc -static -fdiagnostics-color=always main.c -o main.exe -lshlwapi -lshell32 -lole32 -luuid

Contribution (PRs & Issues)

We welcome high-quality contributions from the systems engineering and security community.

  • Bug Reports & Feature Requests: Please use the Issues tracker. Be specific about your Windows build version (e.g., Win10 22H2).
  • Pull Requests:
    • Maintain the minimalist C coding style (no external frameworks).
    • Ensure all COM pointers are strictly managed via Release() or CoTaskMemFree().
    • Update the README.md if your PR introduces new Shell flags or behavioral changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A high-performance, Win32-native C utility for deterministic Recycle Bin enumeration and atomic metadata-aware purging.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages