BOOL (*ChangeWindowMessageFilter)(UINT,DWORD) = NULL;
Your function pointer declaration is wrong. Winapi functions are always __stdcall. Your compiler no doubt uses the default, __cdecl. The stack imbalance you get when you make the call through the function pointer can have many side effects. If you use MSVC++ and run the Debug build then you'll always get an immediate diagnostic. Fix:
BOOL (WINAPI * ChangeWindowMessageFilter)(UINT,DWORD) = NULL;
Fwiw, if this is meant to enable drag+drop into an elevated program then just remove all this, it won't work. D+D is COM based, it doesn't use messages.