www.pudn.com > warsrc.rar > FsysSecurity.h


// This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase 
// Copyright 1996 by Jarle Aase. All rights reserved. 
// See the "War Software Series Licende Agreement" for details concerning  
// use and distribution. 
// --- 
// This source code, executables and programs containing source code or 
// binaries or proprietetary technology from the War Software Series are 
// NOT alloed used, viewed or tested by any governmental agencies in 
// 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			:	FsysSecurity.h 
// PURPOSE	:	File System security 
// PROGRAM	:  
// DATE			:	Oct. 9 1996 
// AUTHOR		:	Jarle Aase 
// --- 
// REVISION HISTORY 
//  
 
#ifndef _FSYSSECURITYH 
#define _FSYSSECURITYH 
 
#define SECFILE ".WarFsysPerms" 
 
struct SFsysSecurityExtra 
{ 
	int User; // User number this applies for 
	int Perms; // NODE_AREAD NODE_AWRITE NODE_AEXEC 
}; 
 
class DLL_WAR_SOFTWARE_ CFsysSecurityNode 
{ 
public: 
	DWORD Perms; // Basic file permissions 
	USER Owner; // Owner user # 
	USER Class; // Class user # (UNIX group) 
	DWORD DlCnt; // Download counter 
	CString Comment;  
	CString FileName; 
	DWORD SpecialNewFilePerms; 
 
public: 
	~CFsysSecurityNode(); 
}; 
 
class DLL_WAR_SOFTWARE_ CFsysSecurityGrp 
{ 
public: 
	CFsysSecurityGrp(); 
	 
	DWORD DefaultPermFiles; 
	DWORD DefaultPermDirs; 
	CLinkedList m_Nodes; 
	CString m_Path; 
	FILE *m_fp; // Only used to update a directory 
 
public: 
	~CFsysSecurityGrp(); 
	void DeleteAllNodes(); 
}; 
 
class DLL_WAR_SOFTWARE_ CFsysSecurity 
{ 
public: 
 
public: 
	static BOOL GetFsysSecurityProperties(HANDLE hGrp, CFileInfo& FileInfo); 
	static void LogMsg(int flag, LPCSTR Format, ...); 
	static HANDLE LoadSecurityGroup(LPCSTR Path, BOOL DoScanNodes = TRUE); 
	static HANDLE GetSecurityDescriptor(HANDLE pGrp, LPCSTR FileName); 
	static HANDLE GetSecurityGroupFromPath(int User, int Class, LPCSTR Path); 
	static BOOL CloseSecurityGroup(HANDLE pGrp); 
	static int GetPermissions(int User, int Class,  
		HANDLE pGrp, LPCSTR FileName, BOOL IsDir, int *Mask = NULL, 
		CFsysSecurityNode **pFsn = NULL, BOOL ShowRealPerms = TRUE); 
	static HANDLE CreateNode(int User, HANDLE pGrp,  
		BOOL IsDir, LPCSTR FileName); 
	static BOOL FlushGroup(HANDLE pGrp); 
	static HANDLE OpenSecurityGroupForUpdate( 
		LPCSTR Path,  
		DWORD DefaultPermFiles = 0xffffffff, 
		DWORD DefaultPermDirs = 0xffffffff); 
	static void CFsysSecurity::FlushNode( 
		HANDLE hSecGrp, 
		LPCSTR FileName, 
		DWORD Perms, 
		int Owner, 
		int Class, 
		int DlCnt, 
		LPCSTR Comment, 
		DWORD SpecialNewFilePerms); 
 
protected: 
	static FILE *OpenSecurityGroupFile(LPCSTR Path, LPCSTR Mode); 
	static FILE *fopen(LPCSTR DosPath, LPCSTR Mode); 
}; 
 
#endif _FSYSSECURITYH