WarFsysDll.h
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:5k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // any countries. This includes the government, departments, police,
- // military etc.
- // ---
- // This file is intended for use with Tab space = 2
- // Created and maintained in MSVC Developer Studio
- // ---
- // NAME : WarFsysDll.h
- // PURPOSE : Header file for the simple File system dll (WarFsys.dll)
- // PROGRAM :
- // DATE : March 11 1997
- // AUTHOR : Jarle Aase
- // ---
- //
- // Overview:
- // This dll provides the higher levels in the server with file system calls.
- // The file system support UNIX/VFsys file attributes, VFsys and Win95/NT 4
- // soft-links and true multithread/multiprocess access.
- //
- // Exports are done in the .def file.
- //
- // REVISION HISTORY
- //
- // This file is for the dll itself only. It does not contain any
- // manifests or classes for export.
- // Shared memory header for all threads/processes using the dll.
- struct WAR_FSYS_HDR
- {
- BOOL IsInitialized;
- DWORD NumOpenHandles;
- DWORD NumOpenFiles;
- char PrivateIndexPath[MAX_PATH]; // Private .index.txt files
- char PrivateIniPath[MAX_PATH]; // .ini file for fsys
- };
- class CWarFsysFileHandle : public CObject
- {
- private:
- CWarFsysFileHandle();
- ~CWarFsysFileHandle();
- public:
- HANDLE m_DOShandle; // DOS handle to the file
- CWarFsysHandle *m_pFsysHandle; // Pointer to owner
- };
- class CWarFsysFileInfo : public CFileInfo
- {
- SMEM m_strComment;
- SMEM m_Son; // CWarFsysFileInfo Link to subdirectory node
- SMEM m_CopyPath; // LPCSTR name of path where copy reside
- unsigned m_OpenCnt : 16; // Number of open handles
- unsigned m_NumLinks: 8; // Number of links
- unsigned m_Deleted : 1; // Deleted
- unsigned m_Locked : 1; // Exclusive lock
- unsigned m_UseCopy: 1; // Use the copy for normal file access
- unsigned m_UseHome: 1; // Use original for nornal file access
- unsigned m_CopyToHome : 1; // Uploaded file needs to be copyed to home
- };
- // Directory node.
- // Uses shared memory.
- class CWarFsysDirNode : public CObject
- {
- DWORD m_Flags;
- SMEM m_Father; // CWarFsysDirNode Pointer to the (real) father
- SMEM m_Generic; // Pointer to the 'real' directory entry
- // Pointer to the DOS directory name
- CWarTimer m_Timer; // Timeout for rescan
- DWORD m_NumEntries; // Number of files/dirs
- DWORD m_NumReferences; // Number of open references
- CWarFsysFileInfo[1]; // Array of files
- SMEM m_EventChain;
- enum
- {
- DIRTY = 0x0001, // Node must be flushed
- USERNODE = 0x0002, // This node is for one user only
- CPYFILES = 0x0004, // Copy files prior to open for read
- // This flag is recursive until
- RESCANNING = 0x0008, // Directory is being scanned
- COPYING = 0x00100, // One or more files is being copyed
- };
- }
- class CWarFsysFindHandle : public CObject
- {
- public:
- CWarFsysFindHandle();
- ~CWarFsysFindHandle();
- HANDLE FindFirstFile(LPCTSTR lpFileName, CFileInfo& FileInfo);
- BOOL FindNextFile(CFileInfo& FileInfo);
- void FindClose();
- HANDLE m_DOShandle; // DOS handle to the file
- CWarFsysHandle *m_pFsysHandle; // Pointer to owner
- HANDLE m_SecurityHandle; // Handle to security descriptior for dir
- CCmdArgs *m_PathsQueued; // VfSys links and drive letters
- CString m_Pattern;
- CString m_DOSpath;
- int m_Argc;
- };
- class CWarFsysHandle : public CObject
- {
- public:
- CWarFsysHandle()
- ~CWarFsysHandle();
- // Entry points
- HANDLE OpenFsys(
- LPCSTR RootPath,
- LPCSTR Maps,
- LPCSTR HomeDir,
- USER User,
- USER Class,
- BOOL IsAdmin,
- HANDLE hNTsec);
- void CloseFsys();
- BOOL ChDir(LPCSTR Path);
- BOOL CanAccess(LPCSTR Path, int AccessMode);
- BOOL CreateDirectory(LPCSTR Path);
- BOOL DeleteFile(LPCSTR Path);
- FLEN GetDiskFreeSpace(LPCSTR Path);
- BOOL MoveFile(LPCTSTR ExistingFileName, LPCTSTR NewFileName);
- void CloseHandle();
- HANDLE FindFirstFile(LPCTSTR lpFileName, CFileInfo& FileInfo);
- BOOL FindNextFile(CFileInfo& FileInfo);
- void FindClose();
- GetCWD(HANDLE hFsys)
- // Support functions
- // Member variables
- WAR_FSYS_HDR *m_pFsysHdr;
- CString m_RootPath; // Primary root dir
- CString m_Maps; // Extra root dirs, mapped to the users physical root
- CString m_HomeDir;
- int m_NumRootDirs; // Number of root dirs, including maps.
- USER m_User;
- USER m_Class;
- BOOL m_IsAdmin; // Is administrator - override security
- HANDLE m_hNTsec; // Use NT security if present
- CString m_CWD; // Logical dir for cwd, including links
- CString m_PhysicalCWD; // Physical dir for cwd.
- CLinkedList m_OpenFiles; // CWarFsysFileHandle
- CLinkedList m_OpenFinds; // CWarFsysFindHandle
- static CSharedBlksMem *m_pSM;
- static int m_NumObjects;
- };
- void FsysLogMsg(int flag, LPCSTR Format, ...);
- #ifdef _DEBUG
- #define DEBUG_TAG "-debug"
- #else
- #define DEBUG_TAG
- #endif
- #define WAR_FSYS_SHARED_LOCK "WarFsysSharedLock"DEBUG_TAG