AssetBuilderApplication_windows.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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 <AssetBuilderApplication.h>
  9. #include "shlobj.h"
  10. namespace AssetBuilderApplicationPrivate
  11. {
  12. BOOL WINAPI CtrlHandlerRoutine(DWORD dwCtrlType)
  13. {
  14. (void)dwCtrlType;
  15. // Terminate the process when CTRL+C is pressed
  16. // Builder processes load user-code and we couldn't expect that every single gem
  17. // written by every single external developer be able to shut down cleanly.
  18. TerminateProcess(GetCurrentProcess(), UINT(-1)); // dont ever return a success error code from a terminated process.
  19. return TRUE;
  20. }
  21. }
  22. void AssetBuilderApplication::QueryApplicationType(AZ::ApplicationTypeQuery& appType) const
  23. {
  24. appType.m_maskValue = AZ::ApplicationTypeQuery::Masks::Tool | AZ::ApplicationTypeQuery::Masks::AssetProcessor;
  25. }
  26. void AssetBuilderApplication::InstallCtrlHandler()
  27. {
  28. ::SetConsoleCtrlHandler(AssetBuilderApplicationPrivate::CtrlHandlerRoutine, TRUE);
  29. }