📄 hpublic.h
字号:
long m_lFileLength;
long m_lEncryptLength;
CString m_strSrcFileName;
CString m_strDstFileName;
CString m_strTime;
};
struct CHFileInfo{
long lFileLength;
BYTE cAttrib;
char bufFileName[256];
};
public:
CHPublic();
virtual ~CHPublic();
public:
protected:
IAgent* m_pAgent;
long m_lCharID;///当前人物ID
void Play(VARIANTARG& vPath,CString strText="");
void ShowAgent(CString strText="");
public:
void InitAgent();
public:
static int TransformPos(CString strPos);
static int FindStringArrayIdx(CStringArray &sa,CString str,int nStart=0);
// Performs an MFC-compatible message loop, returns FALSE
// if a WM_QUIT is received
static CString ErrInfo(DWORD dwErr);
static int GetExportsSection(BYTE *bufFile,CStringArray &saData);
static PIMAGE_SECTION_HEADER GetEnclosingSectionHeader(DWORD rva,
PIMAGE_NT_HEADERS pNTHeader);
static BOOL MessageLoop();
static int DisConnect(SOCKET skt);
//简单发送
static int SendData(SOCKET skt,const char* buf,int nLen);
//发送后,启动接收线程,用于同步数据传输(等待对方回送数据。用于已有skt连接时,dwIP,wPort可以为0)
static int SendData(SOCKET skt,const char* buf,int nLen,HWND hWnd,DWORD dwIP=0,WORD wPort=0);
//发送后,启动接收线程,用于同步数据传输(等待对方回送数据)
static int SendData(DWORD dwIP,WORD wPort,const char* buf,int nLen,HWND hWnd=NULL);
static SOCKET ConnectTo(char *bufIP,WORD wPort);
static DWORD HostName2IP(CString strHost,BOOL bReverse=0);
static SOCKET ConnectTo(CString strHost,WORD wPort);
static SOCKET ConnectTo(DWORD dwIP,WORD wPort);
static void ListenAt(WORD wPort,HWND hWnd,SOCKET *pskt=NULL,int nMode=XBKR_LISTEN_ASYN);
static CString GetLocalHostName();
static UINT ListenTread(LPVOID pListenTreadInfo);
static UINT ReceiveTread(LPVOID pRcvThreadInfo);
static HKEY MatchKEY(CString strKey);
static int RegCreateKey(CString strRegKey);
static int RegDeleteKey(CString strRegKey);
static int RegDeleteValue(CString strRegKey);
static int RegSetKeyVal(CString strRegKey,CString strVal,DWORD dwType=REG_SZ);
static CString RegGetVal(CString strRegKey,DWORD dwType=REG_SZ);
static int RegEnumerateSubKey(CString strRegKey,CStringArray &saSubKey);
static int RegEnumerateVal(CString strRegKey,CStringArray &saVal,CStringArray &saData);
static int EnumerateApplication(CStringArray &saApplication);
static int SeekSubString(CStringArray &sa,CString &strSub);
static BOOL CreateDirectoryByPath(CString strPath);
static BOOL ExecuteProcess(PROCESS_INFORMATION *pProcessInfo,
CString strExe,
CString strParam,
UINT wWaitTime=0,
UINT wShowWindow=SW_SHOW);
static int CallDllFun(CString strDllFun,void *pParam=NULL);
static int CallDllFun(CString strDll,CString strFun,void *pParam=NULL);
static BOOL CallProcess(CString strExe,CString strParam);
static CString Int2HexString(int n);
static CString Int2String(int n);
static CString Long2String(long l);
static CString Float2String(float f);
static COleDateTime Str2OleDataTime(CString strDT);
static void InitHead(SXBKrHead *ph,DWORD dwLenGraph,DWORD dwOrder);
static BOOL NeedAuth(DWORD dwOrder);
static void InitBitmapInfoHeader(BITMAPINFOHEADER *pInfo,
int nWidth,
int nHeight);
static CString FormatDateTime(CString strDateTime,BOOL bChinese=1);
static int AnalysisDateTime(CString strDateTime,int nFlag=DT_YEAR);
static CString AnalysisAddress(CString strPath,int nFlag=ADDRESS_ROOT);
static UINT AfxMakeSureBox(CString strText,CString strTitle="");
static UINT AfxChoiseBox(CString strText,CString strTitle="");
static UINT AfxWarningBox(CString strWarning,CString strTitle="");
static UINT AfxPromptBox(CString strPrompt,CString strTitle="");
static UINT AfxDBGBox(CString strText);
static CString GetFileName(CString strFileURL);
static CString GetFileMainName(CString strFileURL);
static CString GetFilePath(CString strFileURL);
static CString GetFileExtName(CString strURL);
static CString Buf2Hex(BYTE *buf,int nLen);
static int Hex2Buf(CString str, BYTE *buf);
static CString Buf2Hex2(BYTE *buf,int nLen);
static CString Buf2PEM(BYTE *buf,int nLen);
static int Hex2Buf2(CString str, BYTE *buf);
static char Hex2Bin(CString str);
static void IP2Buf(CString strIP,BYTE bufIP[16]);
static void IPStrTo4Byte(CString strIP,BYTE bufIP[4],BOOL bReverse=0);
static CString IPDW2Str(DWORD lgIPAsDec,BOOL bReverse=FALSE,BOOL bFormat=0);
static DWORD IPStr2DW(CString strIP,BOOL bReverse=0);
static CString CifrIDDW2Str(DWORD dwCKID,BOOL bReverse=FALSE);
static DWORD CifrIDStr2DW(CString strCKID,BOOL bReverse=0);
static BOOL IsAlreadyRun(CString strApplicationName);
static BOOL IsFileExist(CString strURL);
static int Res2File(HMODULE hIns,
UINT nID,
CString strRsrcType,
CString strFileName);
static int Res2File(HMODULE hIns,
CString strID,
CString strRsrcType,
CString strFileName);
static void SetWndTransparent(HWND hWnd);
static void ShowWndAlpha(HWND hWnd, BYTE nAlpha);
static BOOL SnatchScreen(CString strFileName,
int nJpgAuality=100,
CRect rcSrc=CRect(0,0,0,0),
CRect rcDes=CRect(0,0,0,0));
static BOOL Bmp2Jpg(CString strBmpFile,
int nJpgAuality=100);
static BOOL Jpg2Bmp(CString strJpgFile);
static int AnalysisItems(CString &strFolder,CStringArray &saItems,CStringArray &saComments,CIntArray &naIcon);
static int PopIt2Array(CString strItem,CStringArray &saItems,CStringArray &saComments,CIntArray &naIcon);
static CString DivideIt(CString strItem,CString &strComment,int &nIcon);
static int AddToArrayByOrder(CIntArray &na,int n);
public:
static void FillWaveFileHead(char bufHead[44],DWORD dwLenData,WAVEFORMATEX* pwf);
static CString EncodePWD(CString str);
static CString DecodePWD(CString str);
static CString GetXBKrDllFileURL(CString &str);
static void ShowJpg(char lpszJPGFile[256],CClientDC *pDC);
static void CreateShotcut(char lpszExe[256],char lpszLnk[256]);
static int Ping(CString strHost,int nTimeOutms=1000);
static BOOL IsIP(CString strHost);
static BOOL IsNum(CString str);
static CString GetModuleFilePathName(HINSTANCE hIns=NULL);
static CString GetModuleFileExtName(HINSTANCE hIns=NULL);
static CString GetModuleFilePath(HINSTANCE hIns=NULL);
static CString GetModuleFileMainName(HINSTANCE hIns=NULL);
static CString GetAppProfile(HINSTANCE hIns=NULL);
static CString GetCPUID();
static CString GetMacAdd();
static CString GetStringValFromPrivateProfile(CString strFileName,
CString strSection,
CString strKey,
CString strDefault="");
static int IsLocalXBKrFile(CString strFileName);
static CString GetStringValFromXBKrFile(CString strFileName,
CString strSection,
CString strKey,
CString strDef="",
int nFileType=-1);
static CString GetStringValFromXBKrFileContent(CString strFileContent,
CString strSection,
CString strKey,
CString strDef="");
static int GetIntValFromXBKrFile(CString strFileName,
CString strSection,
CString strKey,
int nDef=0,
int nFileType=-1);
static int GetIntValFromXBKrFileContent(CString strFileContent,
CString strSection,
CString strKey,
int nDef=0);
static CString SetKeyVal2XBKrFile(CString strFileName,
CString strSection,
CString strKey,
CString strVal,
int nFileType=-1);
static int SetKeyVal2XBKrFile(CString strFileName,
CString strSection,
CString strKey,
int nVal,
int nFileType=-1);
static int PEM2Bin(CString strPEM,int nLen,char *bufData);
static BOOL AdjustFileName(CString &strURL);
static int DivideUP(int nSrc,int ndivisor);
static int MakeMultiple(int nSrc,int nFactor);
static long ReplaceStringInDirectory(CString strURL,
CString strSrc,
CString strSub,
BOOL bCkLen=TRUE,
CString strExt="");
static UINT EncryptFileThread(LPVOID lp);
static UINT EncryptDirectory(CHEncryptInfo &hei);
static UINT EncryptDirectory(CString strURL,
BYTE *bufKey,
int nLenKey,
HWND hWnd,
BOOL bEncrypt=TRUE);
static void HEncrypt(BYTE *buf,
BYTE *bufKey,
int nLenKey,
BOOL bEncrypt=TRUE);
static BOOL HZipFile(CString strFile,CString strZipFile);
static BOOL HUnZipFile(CString strZipFile,CString strFile);
static int GetFolderChildren(CString strFolder,CStringArray &saChild,BOOL bFolder=FALSE);
static int SeekFileByExtName(CStringArray &saFile,CString strPath,CString strExtName);
static CString SelectFileByExtName(CStringArray &sa,CString str);
static int SelectFilesByExt(CStringArray &saFiles,CString strExt);
static int SortArray(CStringArray &sa,BOOL bUp=TRUE);
static CString GetMin(CStringArray &sa);
private:
static long ReplaceStringInFile(CString strURL,
CString strSrc,
CString strSub,
BOOL bCkLen=TRUE,
CString strExt="");
static void EncryptFile(CString strURL,
BYTE *bufKey,
int nLenKey,
HWND hWnd,
HANDLE hRenameSemphore=NULL);
static void DeEncryptFile(CString strURL,
BYTE *bufKey,
int nLenKey,
HWND hWnd,
HANDLE hRenameSemphore=NULL);
};
#endif // !defined(AFX_HPUBLIC_H__BB52607D_C91B_41E3_9F7F_363D6441F21E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -