?? kprotectedfilelist.h
字號:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//KProtectedFileList.h
#if !defined(FG_KPROTECTEDFILELIST_H_1_1)
#define FG_KPROTECTEDFILELIST_H_1_1
#include "..\hookshr\comdef.h"
#define MAX_DRIVE 16
//drive numbers larger than MAX_DRIVE will change to 0.
#define GetSafeEntry(i) ( ((i)>=0 && (i)<=MAX_DRIVE)? i: 0)
//Convert drive to index in hash table. Drive A is drive 1, and drive numbers larger than MAX_DRIVE will to convert to 0.
#define DriveToIndex(drive) GetSafeEntry(drive-'A'+1)//(((drive)-'A'+1>=0 && (drive)-'A'+1<=MAX_DRIVE)? (drive)-'A'+1: 0)
#define PathToIndex(path) (DriveToIndex(*(path)))
/////////////////////////////////////////////////////////////
struct FILE_NODE
{
PROTECTED_FILE protFile;
struct FILE_NODE *pNextFile;
FILE_NODE() { pNextFile=NULL; }
//debug
//Don't do this! you never know whether PF_pPath is pointing to a valid heap block.
//The destroyer is always olidged to free PF_pPath.
//~FILE_NODE() { free(protFile.PF_pPath); } //in most cases the object is destroy by calling free(). In that case the destroyer should free protFile.PF_pPath.
};
class KProtectedFileList //class to manipulate protected file.
{
public:
static BYTE GetPriority(char *path);
BOOL Add(const char *pBCSPath, WORD protectionType);
FILE_NODE* IsInList(const char *pBCSPath);
BOOL IsHide(char *pBCSPath);
BOOL IsUnderDeleteProtection(char *pBCSPath);
BOOL IsUnderReadProtection(char *pBCSPath);
BOOL IsUnderWriteProtection(char *pBCSPath);
KProtectedFileList();
~KProtectedFileList();
BOOL Add(const char *pBCSPath);
//BOOL Add(ParsedPath *pParsedPath);
BOOL Add(PROTECTED_FILE *pProtFileNode);
BOOL Remove(const char *pBCSPath);
//BOOL Remove(ParsedPath *pParsedPath);
PROTECTED_FILE* IsUnderProtection(const char *pBCSPath, WORD filter=0xFFFF); //todo: modify this function to return PROTECTED_FILE * .
PROTECTED_FILE *FindFirst();
PROTECTED_FILE *FindNext();
void Empty();
#ifdef FG_VXD
PROTECTED_FILE* IsUnderProtection(int drive, ParsedPath *pPPath, WORD filter=0xFFFF);
BOOL IsHide(int drive, ParsedPath *pPPath);
BOOL IsUnderWriteProtection(int drive, ParsedPath *pPPath);
BOOL IsUnderReadProtection(int drive, ParsedPath *pPPath);
BOOL IsUnderDeleteProtection(int drive, ParsedPath *pPPath);
#endif
protected:
void ChangeProtNum(WORD typeOld, WORD typeNew);
struct FILE_NODE *m_pHead[MAX_DRIVE+1];
struct FILE_NODE m_headNode[MAX_DRIVE+1];
struct FILE_NODE *m_pFindIndex;
static char driveList[(MAX_DRIVE+1)*2];
public:
int bIsDelOn, bIsReadOn, bIsWriteOn, bIsHideOn;
//Protection options:
BOOL bDelBak; //back up on delete.
BOOL bWriteBak; //back up on writting.
};
//deleted:
/*
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
struct PROTECTED_DIR
{
char *PD_pDir;
UINT PD_priority;
struct PROTECTED_DIR *PF_pNextDir;
};
class KProtectedDirList
{
public:
KProtectedDirList();
~KProtectedDirList();
BOOL Add(char *pDir);
BOOL Remove(char *pDir);
BOOL IsUnderProtection(char *pDir);
void Empty();
char *FindFirst();
char *FindNext();
protected:
struct PROTECTED_DIR *m_pHead;
UINT m_pFindIndex;
};
*/
#endif //!defined(FG_KPROTECTEDFILELIST_H_1_1)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -