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.

98 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 2000
  6. //
  7. // File: filedata.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // FileData.h: interface for the CFileData class.
  11. //
  12. //////////////////////////////////////////////////////////////////////
  13. #if !defined(AFX_FILEDATA_H__A7830023_AF56_11D2_83E6_000000000000__INCLUDED_)
  14. #define AFX_FILEDATA_H__A7830023_AF56_11D2_83E6_000000000000__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. #ifndef NO_STRICT
  19. #ifndef STRICT
  20. #define STRICT 1
  21. #endif
  22. #endif /* NO_STRICT */
  23. #include <windows.h>
  24. #include <tchar.h>
  25. #include <time.h>
  26. // Forward Declarations
  27. class CProcesses;
  28. class CProcessInfo;
  29. class CModules;
  30. class CModuleInfoCache;
  31. class CFileData
  32. {
  33. public:
  34. CFileData();
  35. virtual ~CFileData();
  36. bool OpenFile(DWORD dwCreateOption = CREATE_NEW, bool fReadOnlyMode = false);
  37. bool CreateFileMapping();
  38. bool CloseFile();
  39. bool EndOfFile();
  40. void PrintLastError();
  41. // Filepath methods
  42. bool SetFilePath(LPTSTR tszFilePath);
  43. LPTSTR GetFilePath();
  44. bool VerifyFileDirectory();
  45. // Checksym output methods...
  46. bool WriteFileHeader();
  47. bool WriteTimeDateString(time_t Time);
  48. bool WriteFileTimeString(FILETIME ftFileTime);
  49. bool WriteTimeDateString2(time_t Time);
  50. bool WriteFileTimeString2(FILETIME ftFileTime);
  51. bool WriteString(LPTSTR tszString, bool fHandleQuotes = false);
  52. bool WriteDWORD(DWORD dwNumber);
  53. // Checksym input methods...
  54. bool ReadFileHeader();
  55. bool ReadFileLine();
  56. DWORD ReadString(LPSTR szStringBuffer = NULL, DWORD iStringBufferSize = 0);
  57. bool ResetBufferPointerToStart();
  58. bool ReadDWORD(LPDWORD lpDWORD);
  59. bool DispatchCollectionObject(CProcesses ** lplpProcesses, CProcessInfo ** lplpProcess, CModules ** lplpModules, CModules ** lplpKernelModeDrivers, CModuleInfoCache * lpModuleInfoCache, CFileData * lpOutputFile);
  60. // Define a constant for our "private" buffer...
  61. enum {LINE_BUFFER_SIZE = 4096};
  62. char m_szLINEBUFFER[LINE_BUFFER_SIZE]; // This saves us tons of create/free stuff...
  63. protected:
  64. bool CopyCharIfRoom(DWORD iStringBufferSize, LPSTR szStringBuffer, LPDWORD piBytesCopied, bool * pfFinished);
  65. LPSTR m_lpCurrentLocationInLINEBUFFER;
  66. LPSTR m_lpCurrentFilePointer;
  67. LPVOID m_lpBaseAddress;
  68. HANDLE m_hFileMappingObject;
  69. // Error methods
  70. inline DWORD GetLastError() { return m_dwGetLastError; };
  71. inline void SetLastError() { m_dwGetLastError = ::GetLastError(); };
  72. LPTSTR m_tszFilePath;
  73. HANDLE m_hFileHandle;
  74. DWORD m_dwGetLastError;
  75. };
  76. #endif // !defined(AFX_FILEDATA_H__A7830023_AF56_11D2_83E6_000000000000__INCLUDED_)