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.

72 lines
2.2 KiB

  1. // CheckSymbols.cpp : Implementation of CCheckSymbols
  2. #include "stdafx.h"
  3. #include "CheckSymbolsLib.h"
  4. #include "CheckSymbols.h"
  5. #include "..\symutil.h"
  6. /////////////////////////////////////////////////////////////////////////////
  7. // CCheckSymbols
  8. STDMETHODIMP CCheckSymbols::CheckSymbols(BSTR FilePath, BSTR SymPath, BSTR StripSym, BSTR *OutputString)
  9. {
  10. // TODO: Add your implementation code here
  11. /* ATL release builds has a macro defined that prevents crt functions from being
  12. included. If you need to call any c runtime functions you'll need to remove the macro
  13. _ATL_MIN_CRT first.
  14. */
  15. TCHAR MyOutputString[MAX_SYM_ERR];
  16. TCHAR MySymPath[_MAX_PATH];
  17. TCHAR MyFilePath[_MAX_PATH];
  18. CComBSTR bstrFilePath = FilePath;
  19. CComBSTR bstrSymPath = SymPath;
  20. CComBSTR bstrStripSym = StripSym;
  21. CComBSTR bstrOutputString;
  22. USES_CONVERSION;
  23. //Make sure buffer is big enough. CComBSTR.Length() doesn't include terminating NULL.
  24. if (bstrFilePath.Length() >= _MAX_PATH)
  25. {
  26. //Path too long...
  27. Error("The specified file path is too long");
  28. return E_FAIL;
  29. }
  30. if (bstrSymPath.Length() >= _MAX_PATH)
  31. {
  32. //Path too long...
  33. Error("The specified symbol path is too long");
  34. return E_FAIL;
  35. }
  36. //Might want to validate StripSym parameter here...
  37. lstrcpyn(MyFilePath, OLE2T(bstrFilePath), bstrFilePath.Length() + 1);
  38. lstrcpyn(MySymPath, OLE2T(bstrSymPath), bstrSymPath.Length() + 1);
  39. // Input values:
  40. // MySymPath Full path to directory where symbols are located
  41. // MyFilePath Full path and name of file to verify symbols for.
  42. //
  43. // Return values:
  44. // MyOutputString= empty string => Symbol checking passed.
  45. // MyOutputString!= empty string => Symbol checking failed. String has the binary name
  46. // followed by spaces, and then the text reason.
  47. MyCheckSymbols( MyOutputString, MySymPath, MyFilePath, NULL, 0, 0 );
  48. bstrOutputString = T2OLE(MyOutputString);
  49. *OutputString = bstrOutputString.Copy();
  50. return S_OK;
  51. }