This document provides detailed instructions for building and developing the File Organizer Shell Extension.
- Visual Studio 2022 (Community Edition or higher)
- Windows 10 SDK (10.0.19041.0 or later)
- C++17 compiler support
- Administrator privileges for testing
- Open
ShellExt.sln
in Visual Studio 2022 - Select the desired configuration:
- Debug or Release
- x86 or x64 platform
- Build the solution (F7 or Build > Build Solution)
The compiled DLL will be placed in:
x64\FileOrganizerExt.dll
for 64-bit buildsx86\FileOrganizerExt.dll
for 32-bit builds
ShellExt/
├── ShellExt.h # Main header file with class definitions
├── ShellExt.cpp # Implementation of shell extension functionality
├── dllmain.cpp # DLL entry point and registration functions
├── ShellExt.def # Module definition file for exports
├── resource.h # Resource definitions
├── ShellExt.rc # Resource file (strings, version info)
├── register.bat # Registration script
└── unregister.bat # Unregistration script
- Build the project in Debug configuration
- Run
register.bat
as administrator - Open Windows Explorer to test the context menu
- Use Debug > Attach to Process to attach to explorer.exe
- Set breakpoints in Visual Studio for debugging
- Run
unregister.bat
when finished testing
Note: You must unregister the DLL before rebuilding, as Windows keeps it locked while registered.
-
Use OutputDebugString for logging:
OutputDebugString(L"Debug message\n");
-
View debug output using DebugView from Sysinternals:
- Download from Microsoft's website
- Run as administrator
- Filter for your messages
-
Common issues:
- DLL not registering: Check administrator privileges
- Context menu not showing: Verify file type registration
- Explorer crashes: Check COM reference counting
- Always implement proper reference counting
- Handle out-of-memory conditions
- Validate input parameters
- Use secure string functions (StringCch*)
- Clean up resources in destructors
- Follow COM threading rules
- Update interface definitions in
ShellExt.h
- Implement new functionality in
ShellExt.cpp
- Add any new resources to
ShellExt.rc
- Update version information
- Document changes in README.md
- Update version numbers in:
- resource.h
- ShellExt.rc
- Build both x86 and x64 in Release configuration
- Test on clean Windows installation
- Create release package:
- DLLs for both architectures
- Registration scripts
- Documentation
- Tag the release in source control
- Use consistent indentation (4 spaces)
- Follow Microsoft's COM naming conventions
- Comment complex logic and public interfaces
- Use RAII where possible
- Handle all error conditions