Team Fortress 2 Source Code as on 22/4/2020
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.

64 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Finds debug DLLs
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "unitlib/unitlib.h"
  8. #include "tier0/dbg.h"
  9. #include "tier1/strtools.h"
  10. #include <stdio.h>
  11. #include <windows.h>
  12. #pragma warning (disable:4100)
  13. SpewRetval_t FindDbgDLLSpew( SpewType_t type, char const *pMsg )
  14. {
  15. printf( "%s", pMsg );
  16. OutputDebugString( pMsg );
  17. return SPEW_CONTINUE;
  18. }
  19. /*
  20. ============
  21. main
  22. ============
  23. */
  24. int main (int argc, char **argv)
  25. {
  26. printf( "Valve Software - finddbgdll.exe (%s)\n", __DATE__ );
  27. // Install a special Spew handler that ignores all assertions and lets us
  28. // run for as long as possible
  29. SpewOutputFunc( FindDbgDLLSpew );
  30. // Very simple... just iterate over all .DLLs in the current directory and call
  31. // LoadLibrary on them; check to see if they define the BuiltDebug symbol. I
  32. WIN32_FIND_DATA findFileData;
  33. HANDLE hFind = FindFirstFile("*.dll", &findFileData);
  34. while (hFind != INVALID_HANDLE_VALUE)
  35. {
  36. // Ignore 360 DLLs, can't load them on the PC
  37. if ( !Q_strstr( findFileData.cFileName, "360" ) )
  38. {
  39. HMODULE hLib = LoadLibrary(findFileData.cFileName);
  40. if ( GetProcAddress( hLib, "BuiltDebug" ) )
  41. {
  42. Msg( "Module %s is a debug build\n", findFileData.cFileName );
  43. }
  44. FreeLibrary( hLib );
  45. }
  46. if (!FindNextFile( hFind, &findFileData ))
  47. break;
  48. }
  49. return 0;
  50. }