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.

94 lines
3.1 KiB

  1. /*
  2. Copyright 1999 Microsoft Corporation
  3. Logging for MessageBoxes and the comment button (aka the "lame" button).
  4. Walter Smith (wsmith)
  5. */
  6. #pragma once
  7. #include "simplexml.h"
  8. // Stack trace passed by USER to our hook
  9. struct STACKTRACEDATA {
  10. ULONG nCallers;
  11. PVOID callers[1];
  12. };
  13. typedef STACKTRACEDATA* PSTACKTRACEDATA;
  14. // Data we log for MessageBoxes
  15. struct MSGBOXLOGDATA {
  16. OSVERSIONINFO versionInfo; // OS version
  17. LPCTSTR szOwnerClass; // Owner window class (from RealGetWindowClass)
  18. LPCTSTR szOwnerTitle; // Owner window title
  19. PSTACKTRACEDATA pStackTrace; // Stack trace of creation site
  20. DWORD dwResult; // Return value of MessageBox (IDxxx)
  21. // The rest are as defined in MSGBOXPARAMS
  22. LPCTSTR szText;
  23. LPCTSTR szCaption;
  24. DWORD dwStyle;
  25. DWORD dwContextHelpId;
  26. };
  27. typedef MSGBOXLOGDATA* PMSGBOXLOGDATA;
  28. // Data we log for comments
  29. #define MSGBOX_TEXT_SIZE 512
  30. #define COMMENT_TEXT_SIZE 2000
  31. #define CLASS_SIZE 64
  32. #define TITLE_SIZE 64
  33. #define MAX_BUF_SIZE 512
  34. #define MAX_EMAIL_ADDRESS_SIZE 255
  35. #define MAX_BETA_ID_SIZE 6
  36. #define MSGBOX_CLASS _T("#32770")
  37. struct LAMELOGDATA {
  38. DWORD dwSeverity; // User's severity selection
  39. DWORD dwEventCategory; // User's event category selection
  40. PBYTE pbImage; // GIF image of the window
  41. DWORD cbImage; // Size of pbImage data in bytes
  42. PSTACKTRACEDATA pStackTrace; // Stack trace of creation site
  43. OSVERSIONINFO versionInfo; // OS version
  44. TCHAR szClass[CLASS_SIZE]; // Window class (from RealGetWindowClass)
  45. TCHAR szTitle[TITLE_SIZE]; // Window title
  46. TCHAR szComment[COMMENT_TEXT_SIZE + 1]; // User's comment
  47. TCHAR szMsgBoxText[MSGBOX_TEXT_SIZE]; // Message Box text
  48. TCHAR szEmailAddress[MAX_EMAIL_ADDRESS_SIZE + 1]; // User's email address
  49. TCHAR szBetaID[MAX_BETA_ID_SIZE + 1]; // User's beta ID
  50. WCHAR szMiniDumpPath[MAX_PATH+1]; // Path to a file containing a minidump to upload.
  51. };
  52. typedef LAMELOGDATA* PLAMELOGDATA;
  53. void LogMessageBox(PMSGBOXLOGDATA pData);
  54. int LogLameButton(PLAMELOGDATA pData);
  55. // XML helpers
  56. void GetISO8601DateTime(LPTSTR buf);
  57. wstring Hexify(DWORD dwValue);
  58. wstring Decimalify(DWORD dwValue);
  59. // stack.cpp
  60. void GenerateXMLStackTrace(PSTACKTRACEDATA pstd,
  61. SimpleXMLNode* pTopElt);
  62. // upload.cpp
  63. enum ENUM_UPLOAD_TYPES { UPLOAD_MESSAGEBOX, UPLOAD_LAMEBUTTON };
  64. int QueueXMLDocumentUpload(ENUM_UPLOAD_TYPES type, SimpleXMLDocument& doc);
  65. typedef TCHAR GUIDSTR[39];
  66. void GetMachineSignature(GUIDSTR szGUID);
  67. // image.cpp
  68. void GetWindowImage(HWND hwnd, BYTE** ppData, DWORD* pcbData);