📄 global.h
字号:
// Global.h
//
#ifndef __global_h__
#define __global_h__
#include <string>
#include <list>
#include <vector>
#include <map>
#include <shlwapi.h>
#include <wininet.h>
#include <UrlHist.h>
#include <Mshtml.h>
#include "RWLock.h"
#include "flag.h"
#pragma warning(disable : 4192)
#import <shdocvw.dll>
#ifndef LVS_EX_LABELTIP
#define LVS_EX_LABELTIP 0x00004000
#endif
#define APP_NAME _T("SurfHelper")
#define SURFHELPER_EVENT _T("SurfHelper_Event")
#define NEW_LINE _T("\r\n")
#define PT_URL_BLACKLIST _T("[UrlBlacklist]")
#define PT_URL_EXCLUSION _T("[UrlExclusion]")
#define PT_TITLE_BLACKLIST _T("[TitleBlacklist]")
#define PT_TITLE_EXCLUSION _T("[TitleExclusion]")
//custom message
#define WM_TRAY_NOTIFY WM_USER + 100
#define WM_ADD_LOG_NOTIFY WM_USER + 101
//hot key
#define HOTKEY_HIDE_IE 1
#define HOTKEY_SHOW_IE 2
#define HOTKEY_DISABLE 3
//min size of main frame window
#define FRAME_MIN_WIDTH 360
#define FRAME_MIN_HEIGHT 450
//clear flag
#define CLEAR_URL_HISTORY 0x00000001
#define CLEAR_TYPED_URL 0x00000002
#define CLEAR_CACHE 0x00000004
#define CLEAR_COOKIES 0x00000008
#define CLEAR_AUTOCOMPLETE_FORMS 0x00000010
#define CLEAR_AUTOCOMPLETE_PWDS 0x00000020
#define CLEAR_FAVORITES 0x00000040
#define CLEAR_RAS_AUTODIAL 0x00000080
#define CLEAR_TEMP 0x00001000
#define CLEAR_RUN_HISTORY 0x00002000
#define CLEAR_RECENT_DOCUMENTS 0x00004000
#define CLEAR_LAST_LOGON_USER 0x00008000
#define CLEAR_FIND_FILES_HISTORY 0x00010000
#define CLEAR_FIND_COMPUTER_HISTORY 0x00020000
#define CLEAR_NETWORK_HISTORY 0x00040000
#define CLEAR_TELNET_HISTORY 0x00080000
#define CLEAR_RECYCLEBIN 0x00100000
//popup killed type
#define KILLED_BY_SIZE 0
#define KILLED_BY_TITLE 1
#define KILLED_BY_URL 2
#define POPUP_SIZE_RANGE 20
#define SWEEP_BUFFER_SIZE 10000
typedef std::basic_string<TCHAR> tstring;
class CFilterSource
{
public:
CString m_sTitle;
CString m_sUrl;
BOOL m_bAddToExclusions;
BOOL m_bExclusionsOnly;
};
class CPopupLog
{
public:
CString m_sTitle;
CString m_sUrl;
CString m_sFilter;
long m_lKillType;
SYSTEMTIME m_timeOccur;
};
typedef std::vector<CPopupLog*> VEC_POPUP_LOG;
typedef std::map<CString, BOOL> MAP_FILTER;
enum DEL_CACHE_TYPE
{
File,
Cookie
};
class CGlobal
{
public:
CString m_sModuleFilePath;
CString m_sIniFilePath;//configurations
CString m_sFilterFilePath;//popup filter
CString m_sLogFilePath;
CString m_sWorkDir;
int m_nVScroolWidth;
int m_nBorderWidth;
BOOL m_bDisable;
BOOL m_bAutorun;
BOOL m_bEnableSound;
BOOL m_bClearAtExit;
long m_lWindowSizeThreshold;
UINT m_nKeyDisable;
UINT m_nKeyHideIE;
UINT m_nKeyShowIE;
DWORD m_dwIeWindowSettings;
DWORD m_dwFilterSettings;
DWORD m_dwClearSettings;
MAP_FILTER m_mapUrlBlacklist;
MAP_FILTER m_mapUrlExclusion;
MAP_FILTER m_mapTitleBlacklist;
MAP_FILTER m_mapTitleExclusion;
VEC_POPUP_LOG m_vecPopupLog;
CRWLock m_lockUrlBlacklist;
CRWLock m_lockUrlExclusion;
CRWLock m_lockTitleBlacklist;
CRWLock m_lockTitleExclusion;
CRWLock m_lockPopupLog;
CFilterSource m_FilterSource;
CGlobal();
~CGlobal();
void ReadConfig(LPCTSTR pszFilePath);
void WriteConfig(LPCTSTR pszFilePath);
BOOL ReadFilter(LPCTSTR pszFilePath, CString* psErrorMsg = NULL);
BOOL WriteFilter(LPCTSTR pszFilePath, CString* psErrorMsg = NULL);
void LoadFilter(LPTSTR pszData, MAP_FILTER* pmapFilter, LPCTSTR pszType);
void SaveFilter(HANDLE hFile, MAP_FILTER* pmapFilter, LPCTSTR pszType);
BOOL AddFilter(MAP_FILTER* pmapFilter, CRWLock* pLock, LPCTSTR pszFilter, BOOL bEnable);
BOOL RemoveFilter(MAP_FILTER* pmapFilter, CRWLock* pLock, LPCTSTR pszFilter);
BOOL ChangeFilter(MAP_FILTER* pmapFilter, CRWLock* pLock, LPCTSTR pszFilter, BOOL bEnable);
BOOL SaveLog(LPCTSTR pszFilePath, CString* psErrorMsg = NULL);
void ClearLog();
void ClearHistory();
BOOL UpdateAutorun();
BOOL EmptyDirectory(LPCTSTR szPath, BOOL bDeleteDesktopIni = FALSE, BOOL bWipeIndexDat = FALSE);
BOOL DeleteUrlCache(DEL_CACHE_TYPE type);
BOOL GetOldSD(HKEY hKey, LPCTSTR pszSubKey, BYTE** pSD);
BOOL CreateNewSD(PSID pSid, SECURITY_DESCRIPTOR* pSD, PACL* ppDacl);
BOOL RegSetPrivilege(HKEY hKey, LPCTSTR pszSubKey, SECURITY_DESCRIPTOR* pSD, BOOL bRecursive);
};
BOOL WriteLog(LPCTSTR pszMsg);
BOOL WipeFile(LPCTSTR szDir, LPCTSTR szFile);
void GetErrorMessage(DWORD dwErrorCode, CString* psErrorMsg);
BOOL GetUserSid(PSID* ppSid);
void GetSidString(PSID pSid, LPTSTR pszBuffer);
BOOL IsWindowsNT();
BOOL IsWindows2k();
//BOOL IsIE5();
void HexString2Char(const TCHAR* string, TCHAR* pchar);
void UnEscape(const TCHAR* string, tstring* pstrResult);
void CreateUrlFromPath(const TCHAR* string, tstring* pstrResult);
#ifndef __g_Global__
extern CGlobal g_Global;
#endif //__g_Global__
#endif //__global_h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -