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.
- Atomic Purging: Leverages
SHEmptyRecycleBinWfor a clean, system-level clearing process across all logical drives. - Shell Namespace Awareness: Enumerates items using
IShellFolderandIEnumIDList, bypassing NTFS-level$Recycle.Binobfuscation. - 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.
The core logic interfaces with the Shell32 and Ole32 subsystems:
- COM Initialization: Enforces
COINIT_APARTMENTTHREADEDfor reliable Shell UI interaction. - PIDL Resolution: Translates virtual folder entries to human-readable strings via
StrRetToStrW. - Sync Notification: Triggers
SHChangeNotifywithSHCNE_ASSOCCHANGEDto force an immediate refresh of the Explorer view-state post-operation.
The production-ready executable is available in the Releases section.
- Release:
v1.0.0 - Binary:
main.exe
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 -luuidWe 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()orCoTaskMemFree(). - Update the
README.mdif your PR introduces new Shell flags or behavioral changes.
This project is licensed under the MIT License - see the LICENSE file for details.