- //////////////////////////////////////////////////////////////////////
- // 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();
- UINT m_uLogLevel;
- // 0 : no log
- // 1 : record LOG only
- // 2 : record both LOG and INFO
- ///////////////////////////////////////////////////////////////////////////
- //
- // 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 (\SERVERShare)!
- 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);
- void WriteLogOld(CString csMsg);
- /*
- 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 (\SERVERShare)!
- */
- 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 (\SERVERShare)!
- */
- BOOL CreateLogPath(CString csLogDir);
- /*
- Get the DomainUser (DOMAINuser) Name
- returns = (BOOL)
- */
- //BOOL GetSystemDomainUserName(void);
- /*
- Get the DomainUser (DOMAINuser) 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 DomainUser 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