www.pudn.com > FileGuard.zip > ComDef.h


////////////////////////////////////////////////////////////////////////////////////// 
//ComDef.h 
// 
//Common definition in Both device and user interface programme. 
 
 
#if !defined(FG_COMDEF_H_1_1) 
#define FG_COMDEF_H_1_1 
 
#define MAXLEN MAX_PATH 
#define CIPHER_LEN  32 
#define DEF_MAX_BAK_NUM  1 
 
//types of protection: 
#define PT_DELETE  	0x1 
#define PT_WRITE	0x2 
#define PT_READ		 0x4 
#define PT_HIDE		  0x8 
 
//DeviceIOControl codes: 
#define	FG_DIOC_INSTALL_HOOK	32001 
#define	FG_DIOC_UNINSTALL_HOOK	32002 
#define	FG_DIOC_FLUSH_PROTECTED_FILE_INFO	32004 
#define	FG_DIOC_READ_PROTECTED_FILE_INFO	FG_DIOC_FLUSH_PROTECTED_FILE_INFO 
#define	FG_DIOC_ADD_PROTECTED_FILE	32005 
#define FG_DIOC_SAVE_PROTECTED_FILE_INFO	32006		//Unused. 
#define FG_DIOC_REMOVE_PROTECTED_FILE	32007 
#define FG_DIOC_GET_HWND	32008 
#define FG_DIOC_DEBUG		32009 
#define FG_DIOC_EXTRA_INFO		32010 
#define FG_SET_DEVICE_BUSY		32011 
 
//Shell message:                  
#define	SM_DEVICE_FATAL_ERROR	(0x0450+0xE1) 
#define SM_DEVICE_ERROR		(0x0450+0xE2) 
#define SM_SHOW_WINDOW	 (0x0450+0xE3) 
 
#ifdef FG_VXD 
 
struct FSD_PATH		 
{ 
	int drive;					//the drive volume. 
	ParsedPath *ppath;		//the Canonicalized Path which FSD receives. 
	int flag;						//file flag. 
}; 
 
#endif 
	 
extern	WORD defProtectionType; 
 
//Struct PROTECTED_FILE: 
struct PROTECTED_FILE 
{ 
		char *PF_pPath; 
		WORD PF_type; 
		BYTE PF_priority; 
 
#ifdef  FG_VXD 
		FSD_PATH PF_fsdPath;		//used only in vxd 
#endif 
 
		PROTECTED_FILE() 
		{ 
			PF_pPath=NULL; 
			PF_type=defProtectionType; 
#ifdef FG_VXD 
			PF_fsdPath.ppath=NULL; 
#endif 
		} 
 
		PROTECTED_FILE(const char *pPath, WORD type) 
		{ 
			PF_pPath=(char *)pPath; 
			PF_type=type; 
#ifdef FG_VXD 
			PF_fsdPath.ppath=NULL; 
#endif 
		} 
 
		//when destroy the object , the destroyed is always obliged to  
		//free the memory PF_pPath pointed to. 
}; 
 
//Gobal functions: 
int ErrorHandler(unsigned int err, int severity=1); 
int StringToFileInfo(const char *buf, PROTECTED_FILE *pProtFile, char *path); 
int GetDir(char *pPath); 
//BOOL PatternMatchW(WCHAR *uniPattern, WCHAR *uniMatcher, unsigned int patternLen, unsigned int matcherLen); 
template  BOOL PatternMatch(PCHAR_T pattern, PCHAR_T matcher, unsigned int patternLen, unsigned int matcherLen); 
 
//Other definitions: 
#define RECORD_LEN	11		//length of an record containing protected file information, excluding path length. 
 
#endif //!defined(FG_COMDEF_H_1_1)