GameCrashUploader_windows.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/PlatformIncl.h>
  9. #include <AzCore/std/string/conversions.h>
  10. #include <CrashReporting/GameCrashUploader.h>
  11. #include <CrashSupport.h>
  12. namespace O3de
  13. {
  14. bool GameCrashUploader::CheckConfirmation(const crashpad::CrashReportDatabase::Report& report)
  15. {
  16. if (!m_noConfirmation)
  17. {
  18. #if AZ_TRAIT_USE_SECURE_CRT_FUNCTIONS
  19. char noConfirmation[64]{};
  20. size_t variableSize = 0;
  21. getenv_s(&variableSize, noConfirmation, AZ_ARRAY_SIZE(noConfirmation), "LY_NO_CONFIRM");
  22. if (variableSize == 0)
  23. #else
  24. const char* noConfirmation = getenv("LY_NO_CONFIRM");
  25. if (noConfirmation == nullptr)
  26. #endif
  27. {
  28. AZStd::wstring sendDialogMessage;
  29. AZStd::to_wstring(sendDialogMessage, m_executableName.c_str());
  30. sendDialogMessage += L" has encountered a fatal error. We're sorry for the inconvenience.\n\nA crash debugging file has been created at:\n";
  31. sendDialogMessage += report.file_path.value().c_str();
  32. sendDialogMessage += L"\n\nIf you are willing to submit this file to Amazon it will help us improve the Lumberyard experience. We will treat this report as confidential.\n\nWould you like to send the error report?";
  33. int msgboxID = MessageBoxW(
  34. nullptr,
  35. sendDialogMessage.data(),
  36. L"Send Error Report",
  37. (MB_ICONEXCLAMATION | MB_YESNO | MB_SYSTEMMODAL)
  38. );
  39. if (msgboxID == IDNO)
  40. {
  41. return false;
  42. }
  43. }
  44. }
  45. return true;
  46. }
  47. }