Shrinking the DLL
The self-deleting DLL doesn't use any C runtime functions, so you can make it a lot smaller by removing the C runtime library code. Using Visual Studio .NET to build the DLL, change the DLL project options under Linker/Input to set "Ignore All Default Libraries" to Yes. This passes /NODEFAULTLIB to the linker and so prevents the inclusion of the runtime code. Since the runtime library normally provides the entry point for the DLL, you have to explicitly change project options under Linker/Advanced to set "Entry Point" to DllMain.
If you now try to build the DLL, you'll get two unresolved externals, __security_cookie and @__security_check_cookie@4. Change the project options under C/C++/Code Generation to set "Buffer Security Check" to No. This prevents the /GS flag from being passed to the compiler and gets rid of the unresolved externals.
The resulting DLL is just 2.5K.
A.T.