Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.8 KiB

  1. #include "pch.h"
  2. #include <delayimp.h>
  3. FARPROC WINAPI DliHook(unsigned dliNotify, PDelayLoadInfo pdli)
  4. {
  5. #ifdef DEBUG
  6. switch (dliNotify) {
  7. case dliStartProcessing: // used to bypass or note helper only
  8. OutputDebugString(TEXT("dliStartProcessing reported from DliHook"));
  9. break;
  10. case dliNotePreLoadLibrary: // called just before LoadLibrary, can
  11. OutputDebugString(TEXT("dliNotePreLoadLibrary reported from DliHook")); // override w/ new HMODULE return val
  12. break;
  13. case dliNotePreGetProcAddress: // called just before GetProcAddress, can
  14. OutputDebugString(TEXT("dliNotePreGetProcAddress reported from DliHook")); // override w/ new FARPROC return value
  15. break;
  16. case dliFailLoadLib: // failed to load library, fix it by
  17. OutputDebugString(TEXT("dliFailLoadLib reported from DliHook")); // returning a valid HMODULE
  18. break;
  19. case dliFailGetProc: // failed to get proc address, fix it by
  20. OutputDebugString(TEXT("dliFailGetProc reported from DliHook")); // returning a valid FARPROC
  21. break;
  22. case dliNoteEndProcessing: // called after all processing is done, no
  23. OutputDebugString(TEXT("dliNoteEndProcessing reported from DliHook")); // no bypass possible at this point except
  24. // by longjmp()/throw()/RaiseException.
  25. break;
  26. default:
  27. break;
  28. }
  29. #endif
  30. return 0;
  31. }
  32. PfnDliHook __pfnDliFailureHook = DliHook;