📄 logit.h
字号:
//////////////////////////////////////////////////////////////////////
// Class CLogIt Header File
//
// Created: 2/7/00
//
// Author: Daniel Madden
// Daniel.Madden@Compaq.Com
//
// History:
//
// Modifications (by other programmers):
//
//////////////////////////////////////////////////////////////////////
#ifndef __LOGIT_H__
#define __LOGIT_H__
class CLogIt
{
// Construction
public:
CLogIt();
///////////////////////////////////////////////////////////////////////////
//
// Class Functions
//
///////////////////////////////////////////////////////////////////////////
/*
Encrypt a String of data (using DES encryption)
parm1 = (CString) String to Encrypt.
parm2 = (CString) Pass Phrase.
returns = (CString) the Encrypted String
*/
CString EncryptString(CString instr, CString passPhrase);
/*
Decrypt a String of data (using DES encryption)
parm1 = (CString) String to Decrypt.
parm2 = (CString) Pass Phrase.
returns = (CString) the Decrypted String
*/
CString DecryptString(CString instr, CString passPhrase);
/*
Get the Log File Directory Name
returns = (CString) the Logging Directory
*/
CString GetLogDir(void) { return m_csLogDir;}
/*
Set the Log File Directory Name
parm1 = (CString) Full (Drv:\\Dir) log directory to set.
NOTE: This recognizes UNC Names (\\SERVER\Share)!
returns = (Nothing)
*/
void SetLogDir(CString csLogDir) { m_csLogDir = csLogDir; }
/*
Get the Log File Name
returns = (CString)
*/
CString GetLogName(void) { return m_csLogName;}
/*
Check if the Log File is open
returns = (BOOL)
*/
BOOL IsOpen(void) { return (BOOL)m_fLog;}
/*
Write to the Log File
parm1 = (CString) Message to write to the log.
parm2 = (int) Type of log entry: (0 = Error, 1 = Warning, 2 = Information)
returns = (Nothing)
*/
void WriteLog(CString csMsg, int nEntryType);
/*
Create the Log File path using the default path (C:\\Logs) if it doesn't exist
returns = (BOOL) if successfull...otherwise FALSE
NOTE: This recognizes UNC Names (\\SERVER\Share)!
*/
BOOL CreateLogPath(void);
/*
Create the Log File path if it doesn't exist
parm1 = (CString) Full (Drv:\\Dir) log directory to set.
returns = (BOOL) if successfull...otherwise FALSE
NOTE: This recognizes UNC Names (\\SERVER\Share)!
*/
BOOL CreateLogPath(CString csLogDir);
/*
Get the Domain\User (DOMAIN\user) Name
returns = (BOOL)
*/
BOOL GetSystemDomainUserName(void);
/*
Get the Domain\User (DOMAIN\user) Name
returns = (BOOL)
*/
CString GetDomainUser(void) { return m_csDomainUserName; }
/*
Get OS Version.
parm1 = (CString) Fill with OS Version (TEXT).
parm2 = (int) Fill with OS Version (NUMBER).
1 - Win32s
2 - Win95
3 - Win98
4 - WinNT4
5 - Win2000
returns = (BOOL) if successfull...otherwise FALSE
*/
BOOL GetOSType (CString& csOSVersion, int& nType);
/*
Display system error message.
parm1 = error number.
returns = (CString)
*/
CString DisplayError(LONG lCode);
/*
Split strings (according to the deliminator) into a CStringArray (param #3)
parm1 = (CString) Source to split
parm2 = (CString) Deliminator to use
parm3 = (CStringArray&) Referenced Array to fill
parm4 = (BOOL) Add blanks, if found
returns = (Nothing)
*/
void Split(CString Source, CString Deliminator, CStringArray& AddIt, BOOL bAddEmpty);
/*
Check if the Log File is open
returns = (BOOL)
*/
BOOL IsAdmin(void) { return m_bGoodAdmPwd;}
///////////////////////////////////////////////////////////////////////////
//
// Class Variables (public)
//
///////////////////////////////////////////////////////////////////////////
/*
Holds the applications pass phrase
*/
CString m_csAppsPPhrase;
/*
Was the Pass Phrase Good?
*/
BOOL m_bGoodPassPhrase;
/*
Was the Admin Password Good?
*/
BOOL m_bGoodAdmPwd;
// Implementation
protected:
///////////////////////////////////////////////////////////////////////////
//
// Class Functions (protected)
//
///////////////////////////////////////////////////////////////////////////
/*
Creates the Log Directory if it doesn't exist
parm1 = (CString) Full (Drv:\\Dir) log directory to create.
returns = (BOOL) if successfull...otherwise FALSE
NOTE: Used by "CreateLogPath" Function.
*/
BOOL CreateLogDirectory(CString csDirName);
///////////////////////////////////////////////////////////////////////////
//
// Class Variables (protected)
//
///////////////////////////////////////////////////////////////////////////
/*
Holds the Domain\User name
*/
CString m_csDomainUserName;
/*
Handle to the Log File
*/
FILE* m_fLog;
/*
Log file directory Exists
*/
BOOL m_bDirExists;
/*
Logging time stamp
*/
CString m_csLogEntryTime;
/*
Log Path
*/
CString m_csLogPath;
/*
Full Log Path & File Name
*/
CString m_csFullLogName;
/*
Log file name
*/
CString m_csLogName;
/*
Log file directory name
*/
CString m_csLogDir;
/*
Used by the 'GetUserAndDomainName' Function
*/
TCHAR User[UNLEN + 1];
/*
Used by the 'GetUserAndDomainName' Function
*/
TCHAR Domain[DNLEN + 1];
/*
Used by the 'GetUserAndDomainName' Function
*/
DWORD cchUser;
/*
Used by the 'GetUserAndDomainName' Function
*/
DWORD cchDomain;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -