Titus Information Systems, Inc.

Windows NT Library

For programmers requiring the additional security available only to Windows NT operating systems, there are two classes designed to assist the programmer with file and data security.

CAccessObject
This class handles display and settings of security access to system objects.  Files and registry entries are presently handled.  There are no public data members.  The following public member functions are available to an instance of this class:
CAccessObject::CAccessObject()
This is the constructor.  It initializes the private data members.
CAccessObject::~CAccessObject()
This is the destructor.  It destroys the private data members.
BOOL CAccessObject::Open(CString Path, SE_OBJECT_TYPE Type)
This member function opens the specified object for use by the Display and Add member functions.  It must be called before attempting to adjust the security for any object.  The function returns TRUE if Path is successfully opened; otherwise, FALSE is returned.  Specify the full path name of the object in Path.  Type is as follows:
SE_FILE_OBJECT Indicates a file or directory.  The name string that identifies a file or directory object can be one of the following:
• A relative path, such as "abc.dat" or "..\abc.dat"
• An absolute path, such as "\abc.dat", "c:\dir1\abc.dat", or "g:\remotedir\abc.dat"
• A UNC name, such as "\\machinename\sharename\abc.dat".
• A local file system root, such as "\\\\.\\c:". Security set on a file system root does not persist when the system is restarted.
SE_REGISTRY_KEY Indicates a registry key.  A registry key object can be in the local registry, such as "CLASSES_ROOT\somepath"; or in a remote registry, such as "\\machinename\CLASSES_ROOT\somepath".  The names of registry keys must use the following literal strings to identify the predefined registry keys: "CLASSES_ROOT", "CURRENT_USER", "MACHINE", and "USERS".
BOOL CAccessObject::Close()
This member function closes the currently open object.  Be sure to call this function after updating the object's access.  The function returns TRUE if Path is successfully closed; otherwise, FALSE is returned.
BOOL CAccessObject::Display()
This member function display the current access of the open object using the AfxMessageBox function.  The Open member function must be successfully called before calling this member function.  It is for diagnostic purposes.  The function returns TRUE if Path is successfully displayed; otherwise, FALSE is returned.
BOOL CAccessObject::Add(CString User, ACCESS_MASK Mask)
This member function adds the specified access to the open object.  The Open member function must be successfully called before calling this member function.  The function returns TRUE if the open object has its access successfully updated; otherwise, FALSE is returned.  Specify either a login user or a security group in User.  Mask is the ACCESS_MASK normally used to set access control lists.
BOOL CAccessObject::Add(CStringArray&User, ACCESS_MASK Mask)
This member function adds the specified access to the open object.  The Open member function must be successfully called before calling this member function.  The function returns TRUE if the open object has its access successfully updated; otherwise, FALSE is returned.  Specify an array of either login users or security groups in User.  Mask is the ACCESS_MASK normally used to set access control lists.


CMWC
This class generates psuedo random numbers using the "Multiply With Carry" algorithm invented by Dr. George Marsaglia.  There are no public data members.  The following public member functions are available to an instance of this class:
CMWC()
This is the constructor.  It initialized the random number generator with the default seeds.  Note that not specifying your own seeds will cause the same numbers to be generated every time the class is used.
void Seed(unsigned long Z, unsigned long W)
This member function initializes the seeds with the specified numbers.
void Seed(unsigned long W)
This member function initializes the first seed with the specified number and the second seed with the ones-compliment of the specified number.
unsigned long Seed(CTime T)
This member function initializes the seeds with numbers based on the year, month, day, and hour of the specified date and time.
unsigned long Seed()
This member function initializes the seeds with numbers based on the year, month, day, and hour of the current date and time.
unsigned long Rand()
This member function returns the next 32-bit random number.
BYTE RandByte()
This member function returns the next 8-bit random number.  Every fourth call to this function causes a call to the Rand() function so that no random bits are skipped.
int Rand6()
This member function returns the low-order six bits of the 8-bit random number generated with a call to the RandByte() function.  Two random bits are skipped with every call to this function.
WORD RandWord()
This member function returns the next 16-bit random number.  Every second call to this function causes a call to the Rand() function so that no random bits are skipped.
int Rand15()
This member function returns the low-order fifteen bits of the 16-bit random number generated with a call to the RandWord() function.  One random bit is skipped with every call to this function.


[ Stand-alone Programs | Standard Library | Conversion Functions | Utility Functions | COBOL Functions ]
[ COBOL Library | COBOL Interface | Command Prompt Abbreviations | Purchase Instructions ]

[ Home | Areas of Expertise | "We Do Windows" | Clients and Projects | Software Samples | Package Software Available ]
[ Contact Information | Business Software Philosophy | Church Software Philosophy ]
All contents of this web site are Copyright © Titus Information Systems, Inc., Phoenix, Arizona, U.S.A.