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.

80 lines
1.8 KiB

  1. #ifndef __COMMALOG_HPP__
  2. #define __COMMALOG_HPP__
  3. /*---------------------------------------------------------------------------
  4. File: CommaLog.hpp
  5. Comments: TError based log file with optional security.
  6. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  7. Proprietary and confidential to Mission Critical Software, Inc.
  8. REVISION LOG ENTRY
  9. Revision By: Christy Boles
  10. Revised on 02/15/99 10:49:50
  11. 09/05/01 Mark Oluper - use Windows File I/O API
  12. ---------------------------------------------------------------------------
  13. */
  14. #include <stdio.h>
  15. #include <tchar.h>
  16. class CommaDelimitedLog
  17. {
  18. public:
  19. CommaDelimitedLog()
  20. {
  21. m_hFile = INVALID_HANDLE_VALUE;
  22. }
  23. virtual ~CommaDelimitedLog()
  24. {
  25. LogClose();
  26. }
  27. BOOL IsOpen() const
  28. {
  29. return (m_hFile != INVALID_HANDLE_VALUE);
  30. }
  31. BOOL LogOpen(PCTSTR filename, BOOL protect, int mode = 0); // mode 0=overwrite, 1=append
  32. virtual void LogClose()
  33. {
  34. if (m_hFile != INVALID_HANDLE_VALUE)
  35. {
  36. CloseHandle(m_hFile);
  37. m_hFile = INVALID_HANDLE_VALUE;
  38. }
  39. }
  40. BOOL MsgWrite(const _TCHAR msg[], ...) const;
  41. protected:
  42. BOOL LogWrite(PCTSTR msg, int len) const;
  43. protected:
  44. HANDLE m_hFile;
  45. };
  46. //----------------------------------------------------------------------------
  47. // Password Log Class
  48. //
  49. // Overrides LogOpen to attempt to open specified file and then default file
  50. // if different.
  51. //----------------------------------------------------------------------------
  52. class CPasswordLog : public CommaDelimitedLog
  53. {
  54. public:
  55. CPasswordLog() {}
  56. BOOL LogOpen(PCTSTR pszPath);
  57. };
  58. PSID GetWellKnownSid(DWORD wellKnownAccount);
  59. #endif //__COMMALOG_HPP__