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.

70 lines
1.1 KiB

  1. // ***************************************************************************
  2. // Copyright (C) 2000- Microsoft Corporation.
  3. // @File: snapsql.cpp
  4. //
  5. // PURPOSE:
  6. //
  7. // Implement the SQLServer Volume Snapshot Writer.
  8. //
  9. // NOTES:
  10. //
  11. //
  12. // HISTORY:
  13. //
  14. // @Version: Whistler/Shiloh
  15. // 66601 srs 10/05/00 NTSNAP improvements
  16. //
  17. //
  18. // @EndHeader@
  19. // ***************************************************************************
  20. class CLogMsg
  21. {
  22. public:
  23. CLogMsg() :
  24. m_cwc(0),
  25. m_bEof(false)
  26. {
  27. m_rgwc[0] = L'\0';
  28. }
  29. LPCWSTR GetMsg()
  30. {
  31. return m_rgwc;
  32. }
  33. void Add(LPCWSTR wsz)
  34. {
  35. if (m_bEof)
  36. return;
  37. UINT cwc = (UINT) wcslen(wsz);
  38. if (cwc + m_cwc + 5 > x_MAX_MSG_SIZE)
  39. {
  40. wcscpy(m_rgwc + m_cwc, L" ...");
  41. m_cwc += 4;
  42. m_bEof = TRUE;
  43. }
  44. else
  45. {
  46. wcscpy(m_rgwc + m_cwc, wsz);
  47. m_cwc += cwc;
  48. }
  49. }
  50. private:
  51. enum
  52. {
  53. x_MAX_MSG_SIZE = 2048
  54. };
  55. // size of string
  56. UINT m_cwc;
  57. // string
  58. WCHAR m_rgwc[x_MAX_MSG_SIZE];
  59. // end of string encountered
  60. bool m_bEof;
  61. };