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.

102 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name: filemgr.hxx
  4. Abstract:
  5. Manages cache file & directory creation/deletion.
  6. Author:
  7. Adriaan Canter (adriaanc) 04-02-97
  8. Modifications:
  9. Ahsan Kabir (akabir) 25-Sept-97 made minor alterations.
  10. --*/
  11. #ifndef _FILEMGR_HXX
  12. #define _FILEMGR_HXX
  13. class URL_CONTAINER;
  14. /*-----------------------------------------------------------------------------
  15. Base file manager class
  16. ---------------------------------------------------------------------------*/
  17. class CFileMgr
  18. {
  19. public:
  20. CFileMgr(MEMMAP_FILE* mmFile, DWORD dwOptions);
  21. ~CFileMgr();
  22. virtual BOOL Init();
  23. virtual DWORD GetDirLen(DWORD nKey);
  24. virtual DWORD CreateUniqueFile(LPCSTR UrlName, DWORD ExpectedLength, LPTSTR FileName, LPTSTR Extension,
  25. HANDLE *phfHandle, BOOL fCreatePerUser = FALSE);
  26. virtual BOOL NotifyCommit(DWORD);
  27. virtual BOOL Cleanup();
  28. static BOOL DeleteCache(LPSTR);
  29. static VOID SetFileSize(HANDLE hfHandle, DWORD dwExpectedLength);
  30. virtual BOOL GetDirIndex(LPSTR, LPDWORD);
  31. virtual BOOL GetFilePathFromEntry(URL_FILEMAP_ENTRY*, LPSTR, LPDWORD);
  32. virtual BOOL DeleteOneCachedFile (LPSTR lpszFileName, DWORD dostEntry, DWORD nIndex);
  33. virtual BOOL CreateDirWithSecureName( LPSTR);
  34. protected:
  35. DWORD _cbBasePathLen;
  36. MEMMAP_FILE* _mmFile;
  37. DWORD _dwOptions;
  38. DWORD CreateUniqueFile(LPCSTR UrlName, DWORD ExpectedLength, LPTSTR Path,
  39. LPTSTR FileName, LPTSTR Extension, HANDLE* phfHandle, BOOL fCreatePerUser = FALSE);
  40. DWORD MakeRandomFileName(LPCSTR UrlName,
  41. LPTSTR FileName, LPTSTR Extension);
  42. BOOL MapStoreKey(LPSTR szPath, LPDWORD pcbPath,
  43. LPDWORD dwKey, DWORD dwFlag);
  44. BOOL GetStoreDirectory(LPSTR szPath, LPDWORD pcbPath);
  45. DWORD GetOptions() { return _dwOptions; }
  46. };
  47. /*-----------------------------------------------------------------------------
  48. Secure file manager class
  49. ---------------------------------------------------------------------------*/
  50. class CSecFileMgr : public CFileMgr
  51. {
  52. public:
  53. CSecFileMgr(MEMMAP_FILE* mmFile, DWORD dwOptions);
  54. ~CSecFileMgr();
  55. BOOL Init();
  56. DWORD GetDirLen(DWORD nKey);
  57. DWORD CreateUniqueFile(LPCSTR UrlName, DWORD ExpectedLength, LPTSTR FileName, LPTSTR Extension,
  58. HANDLE *phfHandle, BOOL fCreatePerUser);
  59. BOOL NotifyCommit(DWORD);
  60. BOOL Cleanup();
  61. BOOL GetDirIndex(LPSTR, LPDWORD);
  62. BOOL GetFilePathFromEntry(URL_FILEMAP_ENTRY*, LPSTR, LPDWORD);
  63. BOOL DeleteOneCachedFile (LPSTR lpszFileName, DWORD dostEntry, DWORD nIndex);
  64. protected:
  65. BOOL CreateRandomDirName(LPSTR);
  66. BOOL CreateAdditionalSubDirectories(DWORD);
  67. BOOL CreateSubDirectory(DWORD);
  68. BOOL FindMinFilesSubDir(DWORD&, DWORD&);
  69. };
  70. #endif // _FILEMGR_HXX