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.

82 lines
1.9 KiB

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name :
  4. ilogfile.hxx
  5. Abstract:
  6. This module defines the classes and functions for file buffering
  7. used by File logger.
  8. Author:
  9. Murali R. Krishnan ( MuraliK ) 21-Feb-1996
  10. Environment:
  11. User Mode - Win32
  12. Project:
  13. Internet Server DLL
  14. Revision History:
  15. --*/
  16. # ifndef _ILOGFILE_HXX_
  17. # define _ILOGFILE_HXX_
  18. // 20 is for 2^20 that is one meg
  19. #define GRANULARITY_OF_FILE_SIZE_REPORT_SHIFT (20)
  20. #define FILE_SIZE_LOW_MAX (0xFFFFFFFF)
  21. class ILOG_FILE {
  22. public:
  23. ILOG_FILE(VOID);
  24. ~ILOG_FILE(VOID);
  25. BOOL Write( IN PCHAR pvData, IN DWORD cbData);
  26. BOOL Open( IN LPCSTR pszFileName,
  27. IN DWORD dwTruncationSize,
  28. IN BOOL fLogEvent);
  29. VOID QueryFileSize(ULARGE_INTEGER *qwSize)
  30. {
  31. qwSize->QuadPart = m_qwFilePos.QuadPart;
  32. }
  33. BOOL CloseFile(VOID);
  34. private:
  35. BOOL PositionToEOF(ULARGE_INTEGER *pFilePos);
  36. BOOL CreateMapping(VOID);
  37. VOID DestroyMapping(VOID);
  38. BOOL ExpandMapping( );
  39. BOOL OpenFile( IN LPCSTR pszFileName,
  40. IN BOOL fLogEvent);
  41. private:
  42. HANDLE m_hFile; // handle for current log file.
  43. HANDLE m_hMemFile;
  44. DWORD m_nGranules;
  45. DWORD m_dwAllocationGranularity;
  46. LPVOID m_pvBuffer; // buffer for batched up records
  47. DWORD m_cbBufferUsed;
  48. ULARGE_INTEGER m_qwFilePos;
  49. ULARGE_INTEGER m_qwTruncateSize;
  50. ULARGE_INTEGER m_mapSize;
  51. STR m_strFileName; // Log file name
  52. }; // class ILOG_FILE
  53. typedef ILOG_FILE * PILOG_FILE;
  54. # endif // _ILOGFILE_HXX_