Source code of Windows XP (NT5)
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.

91 lines
2.1 KiB

  1. // Spewview: remote debug spew monitor
  2. //
  3. // Copyright (c) 1999 Microsoft Corp.
  4. //
  5. // 9 November 1999 sburns
  6. #include "headers.hxx"
  7. #include "resource.h"
  8. #include "MainDialog.hpp"
  9. // The general idea is this: The machine running spewview.exe is the observer
  10. // of a spewing application running remotely. This machine is the server.
  11. // The machine running the application that is spewing is the client.
  12. //
  13. // The server should start spewview before the client starts the spewing app.
  14. //
  15. // The server does the following:
  16. // - creates a local pipe object
  17. //
  18. // - sets the ACL on the pipe object to allow everyone write access
  19. //
  20. // - connects to the client machine's registry, creates a volatile reg key
  21. // that contains the name of the server machine, and the name of the
  22. // pipe object.
  23. //
  24. // - spawns a separate thread to read the pipe and forward messages
  25. // to the edit control
  26. //
  27. // The client does the following:
  28. // - reads the registry for the reg values created by the server
  29. //
  30. // - calls CreateFile on \\<server>\pipe\<pipe name> to get a
  31. // handle to the pipe
  32. //
  33. // - spews to the pipe handle
  34. //
  35. // The client is implemented in burnslib\src\log.cpp
  36. HINSTANCE hResourceModuleHandle = 0;
  37. const wchar_t* RUNTIME_NAME = L"spewview";
  38. const wchar_t* HELPFILE_NAME = 0;
  39. DWORD DEFAULT_LOGGING_OPTIONS = OUTPUT_TYPICAL;
  40. Popup popup(IDS_APP_TITLE);
  41. int WINAPI
  42. WinMain(
  43. HINSTANCE hInstance,
  44. HINSTANCE /* hPrevInstance */ ,
  45. LPSTR /* lpszCmdLine */ ,
  46. int /* nCmdShow */ )
  47. {
  48. hResourceModuleHandle = hInstance;
  49. ::CoInitialize(0);
  50. try
  51. {
  52. HMODULE m = 0;
  53. HRESULT hr = Win::LoadLibrary(L"riched32.dll", m);
  54. ASSERT(SUCCEEDED(hr));
  55. ::InitCommonControls();
  56. MainDialog().ModalExecute(Win::GetDesktopWindow());
  57. }
  58. catch (std::bad_alloc&)
  59. {
  60. popup.Error(
  61. Win::GetDesktopWindow(),
  62. L"Memory Allocation failure caught");
  63. }
  64. catch (...)
  65. {
  66. popup.Error(
  67. Win::GetDesktopWindow(),
  68. L"Unhandled Exception.");
  69. }
  70. return 0;
  71. }