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.

41 lines
1.0 KiB

  1. #include "std.hxx"
  2. DWORD MainProc(DWORD dwArgC, PCWSTR pcszArgV[], PCWSTR pcszEnvV[]);
  3. extern "C" int __cdecl wmain(int argc, PCWSTR argv[], PCWSTR envv[])
  4. {
  5. ENABLE_MEMORY_EXCEPTIONS;
  6. ENABLE_STRUCTURED_EXCEPTIONS;
  7. try
  8. {
  9. return (int)MainProc(argc, argv, envv);
  10. }
  11. catch (CApiExcept& e)
  12. {
  13. wprintf(L"Unhandled API failure: %s failed with GLE=%u.\n",
  14. e.GetDescription(),
  15. e.GetError());
  16. }
  17. catch (CStructuredExcept& e)
  18. {
  19. wprintf(
  20. L"Unhandled exception (0x%08x) encountered.\n"
  21. L"Program will now terminate.\n",
  22. e.GetExceptionCode());
  23. }
  24. catch (CMemoryExcept& e)
  25. {
  26. wprintf(
  27. L"Unable to allocate %u bytes of memory.\n"
  28. L"Program will now terminate.\n",
  29. e.GetSize());
  30. }
  31. catch (...)
  32. {
  33. wprintf(
  34. L"An unhandled typed exception of unknown type has been encountered."
  35. L"Program will now terminate.\n");
  36. }
  37. }