A lightweight Windows utility for managing file locks on the local machine, built with Pure C and Win32 API.
- System Theme Support: Automatically detects and respects Windows dark/light mode settings
- Auto-Start: Automatically displays open files on the local machine when launched
- Multi-Select: Select and release multiple file locks at once (Ctrl+Click, Shift+Click)
- Search/Filter: Real-time filtering as you type
- DPI-Aware: Crisp display on high-resolution monitors (PerMonitorV2)
- Lightweight: ~134KB executable, no dependencies required
- Fast: Instant launch, no runtime overhead
- Windows 7 or later
- Administrator privileges (required for NetFileEnum/NetFileClose)
- Visual Studio 2022 Build Tools (MSVC compiler) for building
- Install Visual Studio 2022 Build Tools with C++ support:
- Download from visualstudio.microsoft.com
- Or use winget:
winget install Microsoft.VisualStudio.2022.BuildTools - Select "Desktop development with C++" workload
- Ensure
vcvars64.batis accessible (build script will locate it automatically)
- Open PowerShell or Command Prompt in the project directory
- Build:
.\build_msvc.bat
The executable HandleHunter.exe will be created with:
- Application manifest embedded (UAC elevation + DPI awareness)
- Visual styles enabled (modern themed controls)
- Application icon embedded
- Fully CRT-free implementation (except minimal WinMain startup)
To remove all build artifacts:
.\build_msvc.bat clean
- Run as Administrator: Right-click
HandleHunter.exe→ "Run as administrator" - The application automatically displays all open files on the local machine
- Search: Use the search box to filter results by filename, path, or username
- Refresh: Click "Refresh (F5)" or press F5 to update the list
- Multi-Select: Use Ctrl+Click to select multiple files, Shift+Click for ranges
- Release Locks: Select one or more files and click "Release Selected Lock(s)", press Del, or double-click
- Navigate: Use Tab key to move between controls (search box, buttons, list)
- F5: Refresh file list
- Del: Release selected lock(s) (with confirmation)
- Ctrl+Click: Select multiple individual files
- Shift+Click: Select range of files
- Ctrl+A: Select all files
- Tab: Navigate between controls
- Double-click: Release selected lock(s) (with confirmation)
- Ensure you're running as Administrator
- Check Windows Firewall settings
- This should not occur with properly embedded manifest
- Try rebuilding: delete all .obj files and rebuild with
build_msvc.bat
HandleHunter/
├── main.c # Application entry point (WinMain)
├── gui.c # GUI creation and window management
├── gui.h # GUI function declarations
├── modern_ui.c # Windows theme detection and styling
├── modern_ui.h # Theme detection function declarations
├── netapi.c # Windows NetAPI wrapper functions
├── netapi.h # NetAPI function declarations
├── lockinfo.c # Dynamic array implementation (CRT-free)
├── lockinfo.h # Data structures (FileLockInfo, LockArray, AppState)
├── utilities.c # CRT-free utility functions (MemCopy, StrSearch, etc.)
├── utilities.h # CRT-free utility function declarations
├── resource.h # Control IDs and resource identifiers
├── HandleHunter.rc # Resource script (embeds manifest & icon)
├── manifest.xml # UAC elevation and DPI awareness manifest
├── icon.ico # Application icon
├── build_msvc.bat # MSVC build script (VS Build Tools required)
└── README.md # This file
- Language: Pure C (C99)
- Compiler: Microsoft Visual C++ (MSVC) from VS 2022 Build Tools
- API: Win32 API (no frameworks)
- Libraries: kernel32.lib, user32.lib, gdi32.lib, advapi32.lib, netapi32.lib, comctl32.lib, dwmapi.lib, uxtheme.lib
- Unicode: Full Unicode support (UTF-16)
- Memory Management: Windows Heap API (HeapAlloc/HeapFree) - completely CRT-free
- String Operations: Manual implementations (StrLen, StrSearch, StrToLower, StrCopyN, MemCopy, MemZero)
- Formatting: Windows API wsprintfW (user32.lib) instead of stdio.h swprintf
- Binary Size: ~137 KB with all features and optimizations
- DPI Aware: PerMonitorV2 (Windows 10+) with fallback
- Visual Styles: Uses standard Windows controls with system theme detection
- Modern Features: Conditional dark mode title bar (based on Windows theme), rounded corners (Windows 11)
This project is provided as-is for educational and practical use.
Feel free to submit issues or pull requests for improvements!