summaryrefslogtreecommitdiffstats
path: root/private/utils/ulib/inc
diff options
context:
space:
mode:
Diffstat (limited to 'private/utils/ulib/inc')
-rw-r--r--private/utils/ulib/inc/achkmsg.hxx164
-rw-r--r--private/utils/ulib/inc/arg.hxx1668
-rw-r--r--private/utils/ulib/inc/array.hxx390
-rw-r--r--private/utils/ulib/inc/arrayit.hxx125
-rw-r--r--private/utils/ulib/inc/basesys.hxx57
-rw-r--r--private/utils/ulib/inc/bitvect.hxx447
-rw-r--r--private/utils/ulib/inc/buffer.hxx183
-rw-r--r--private/utils/ulib/inc/bufstrm.hxx217
-rw-r--r--private/utils/ulib/inc/bytestrm.hxx169
-rw-r--r--private/utils/ulib/inc/clasdesc.hxx183
-rw-r--r--private/utils/ulib/inc/classes.xlsbin0 -> 11546 bytes
-rw-r--r--private/utils/ulib/inc/cmem.hxx66
-rw-r--r--private/utils/ulib/inc/comm.hxx564
-rw-r--r--private/utils/ulib/inc/contain.hxx95
-rw-r--r--private/utils/ulib/inc/cstring.h174
-rw-r--r--private/utils/ulib/inc/dir.hxx150
-rw-r--r--private/utils/ulib/inc/error.hxx392
-rw-r--r--private/utils/ulib/inc/file.hxx127
-rw-r--r--private/utils/ulib/inc/filestrm.hxx208
-rw-r--r--private/utils/ulib/inc/filter.hxx274
-rw-r--r--private/utils/ulib/inc/findleak.hxx47
-rw-r--r--private/utils/ulib/inc/fsnode.hxx1018
-rw-r--r--private/utils/ulib/inc/hmem.hxx152
-rw-r--r--private/utils/ulib/inc/ifsentry.hxx93
-rw-r--r--private/utils/ulib/inc/ifsserv.hxx109
-rw-r--r--private/utils/ulib/inc/iterator.hxx78
-rw-r--r--private/utils/ulib/inc/keyboard.hxx201
-rw-r--r--private/utils/ulib/inc/list.hxx115
-rw-r--r--private/utils/ulib/inc/listit.hxx118
-rw-r--r--private/utils/ulib/inc/machine.hxx77
-rw-r--r--private/utils/ulib/inc/mbstr.hxx434
-rw-r--r--private/utils/ulib/inc/mem.hxx50
-rw-r--r--private/utils/ulib/inc/membmgr.hxx258
-rw-r--r--private/utils/ulib/inc/message.hxx203
-rw-r--r--private/utils/ulib/inc/newdelp.hxx73
-rw-r--r--private/utils/ulib/inc/object.hxx343
-rw-r--r--private/utils/ulib/inc/path.hxx508
-rw-r--r--private/utils/ulib/inc/pipe.hxx121
-rw-r--r--private/utils/ulib/inc/pipestrm.hxx112
-rw-r--r--private/utils/ulib/inc/program.hxx146
-rw-r--r--private/utils/ulib/inc/prtstrm.hxx143
-rw-r--r--private/utils/ulib/inc/screen.hxx484
-rw-r--r--private/utils/ulib/inc/seqcnt.hxx83
-rw-r--r--private/utils/ulib/inc/smsg.hxx173
-rw-r--r--private/utils/ulib/inc/sortcnt.hxx79
-rw-r--r--private/utils/ulib/inc/sortlist.hxx153
-rw-r--r--private/utils/ulib/inc/sortlit.hxx98
-rw-r--r--private/utils/ulib/inc/spackmsg.hxx64
-rw-r--r--private/utils/ulib/inc/stack.hxx233
-rw-r--r--private/utils/ulib/inc/stream.hxx244
-rw-r--r--private/utils/ulib/inc/string.hxx464
-rw-r--r--private/utils/ulib/inc/stringar.hxx83
-rw-r--r--private/utils/ulib/inc/substrng.hxx632
-rw-r--r--private/utils/ulib/inc/system.hxx253
-rw-r--r--private/utils/ulib/inc/timeinfo.hxx631
-rw-r--r--private/utils/ulib/inc/ulib.hxx152
-rw-r--r--private/utils/ulib/inc/ulibcl.hxx40
-rw-r--r--private/utils/ulib/inc/ulibdef.hxx460
-rw-r--r--private/utils/ulib/inc/winnls.old292
-rw-r--r--private/utils/ulib/inc/wstring.hxx1250
60 files changed, 15920 insertions, 0 deletions
diff --git a/private/utils/ulib/inc/achkmsg.hxx b/private/utils/ulib/inc/achkmsg.hxx
new file mode 100644
index 000000000..5c7f1f58f
--- /dev/null
+++ b/private/utils/ulib/inc/achkmsg.hxx
@@ -0,0 +1,164 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ achkmsg.hxx
+
+Abstract:
+
+
+Author:
+
+ Norbert P. Kusters (norbertk) 3-Jun-91
+
+--*/
+
+#if !defined( _AUTOCHECK_MESSAGE_DEFN_ )
+
+#define _AUTOCHECK_MESSAGE_DEFN_
+
+#include "message.hxx"
+#include "hmem.hxx"
+
+DECLARE_CLASS( AUTOCHECK_MESSAGE );
+
+class AUTOCHECK_MESSAGE : public MESSAGE {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( AUTOCHECK_MESSAGE );
+
+ VIRTUAL
+ ~AUTOCHECK_MESSAGE(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN BOOLEAN DotsOnly DEFAULT FALSE
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Set(
+ IN MSGID MsgId,
+ IN MESSAGE_TYPE MessageType DEFAULT NORMAL_MESSAGE,
+ IN ULONG MessageVisual DEFAULT NORMAL_VISUAL
+ );
+
+ VIRTUAL
+ BOOLEAN
+ DisplayV(
+ IN PCSTR Format,
+ IN va_list VarPointer
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsYesResponse(
+ IN BOOLEAN Default DEFAULT TRUE
+ );
+
+ VIRTUAL
+ PMESSAGE
+ Dup(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsLoggingEnabled(
+ );
+
+ VIRTUAL
+ VOID
+ SetLoggingEnabled(
+ IN BOOLEAN Enable DEFAULT TRUE
+ );
+
+ VIRTUAL
+ VOID
+ ResetLoggingIterator(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ QueryNextLoggedMessage(
+ OUT PFSTRING MessageText
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetDotsOnly(
+ IN BOOLEAN DotsState
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WaitForUserSignal(
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ LogMessage(
+ PCWSTRING Message
+ );
+
+ HMEM _log_buffer;
+ ULONG _logged_chars;
+ ULONG _next_message_offset;
+ BOOLEAN _dots_only;
+ BOOLEAN _logging_enabled;
+
+ protected:
+
+ MSGID _msgid;
+
+};
+
+
+INLINE
+BOOLEAN
+AUTOCHECK_MESSAGE::Set(
+ IN MSGID MsgId,
+ IN MESSAGE_TYPE MessageType,
+ IN ULONG MessageVisual
+ )
+/*++
+
+Routine Description:
+
+ This routine sets up the class to display the message with the 'MsgId'
+ resource identifier.
+
+Arguments:
+
+ MsgId - Supplies the resource message id.
+
+Return Value:
+
+ FALSE - Failure.
+ TRUE - Success.
+
+--*/
+{
+ (void) MessageType;
+ (void) MessageVisual;
+ _msgid = MsgId;
+ return TRUE;
+}
+
+#endif // _AUTOCHECK_MESSAGE_DEFN_
diff --git a/private/utils/ulib/inc/arg.hxx b/private/utils/ulib/inc/arg.hxx
new file mode 100644
index 000000000..50babee11
--- /dev/null
+++ b/private/utils/ulib/inc/arg.hxx
@@ -0,0 +1,1668 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ARGUMENT_LEXEMIZER
+
+Abstract:
+
+
+ This module contains the definition for the ARGUMENT_LEXEMIZER
+ class. The argument lexemizer is the engine of command-line
+ argument parsing.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Environment:
+
+ user
+
+Notes:
+
+ The argument lexemizer divides the command line arguments into
+ a series of lexemes, which are then matched argument patterns.
+
+ The way in which the command line is lexed is determined by
+ a few parameters, which are user-settable:
+
+ * White space
+ * Switch characters
+ * Separators
+ * Start of quote
+ * End of quote
+ * Multiple switches (i.e. what switches can be grouped)
+ * Metacharacters (used to escape the following character)
+ * Case sensitivity for switches
+ * "Glomming" of switches (see note at "GLOMMING").
+ * No space between tokens (specifically for xcopy)
+
+ The class provides defaults for all of the above.
+
+ After the command line has been lexed, the lexemizer is
+ given an ARRAY of argument objects. Each argument provides:
+
+ 1.- A pattern to match
+ 2.- A method for setting the argument value
+
+ The lexemizer will try to match each lexeme agains all the
+ arguments. When a match is found, the corresponding argument
+ value is set, the lexeme is consumed and it proceeds with the
+ next lexeme.
+
+ Schematically:
+
+
+
+
+ < Command Line >
+
+ |
+ | Argument
+ | ARRAY
+ v __________
+ +-----------+ [__________]
+ Settings--->| Lexemizer |<-------> [__________]
+ +-----------+ ^ [__________]
+ |
+ |
+ v
+ ( Matcher )
+
+
+
+
+ The matcher will try to match the lexeme provided by the
+ lexemizer and the pattern provided by the argument. If they
+ match, then the matcher asks the argument to set its value
+ (at this point, the argument might consume more lexemes from
+ the lexemizer). If the argument does not set its value, then
+ we will consider this a "no match", and the lexemizer will
+ try to match the lexeme against the following argument in
+ the ARRAY.
+
+ So, this is how to use this thing:
+
+
+ 1.- Initialize the lexemizer (with an empty ARRAY object):
+
+
+ ARGUMENT_LEXEMIZER ArgLex;
+ ARRAY SomeEmtpyArray;
+
+ SomeEmtryArray->Initialize();
+
+ ArgLex->Initialize(&SomeEmptyArray);
+
+
+
+ 2.- If we don't like some default, we change it:
+
+ ArgLex->PutSwitches("-/");
+ ArgLex->PutMetaCharacters("^");
+
+
+
+ 3.- Prepare the lexemizer for parsing. If we don't provide
+ a command line, it will take it from the environment.
+
+ ArgLex->PrepareToParse();
+
+
+
+ 4.- Define the arguments that our application will accept.
+ Initialize them with the pattern that they will match.
+ Put the argument in an ARRAY object. Note that the order
+ in which the arguments are in the array is important, since
+ that is the order in which they are matched.
+
+
+ ARRAY ArrayOfArg;
+ FLAG_ARGUMENT ArgRecursive; // Recursive flag
+ FLAG_ARGUMENT ArgVerbose; // Verbose flag
+
+ ArrayOfArg->Initialize();
+
+ ArgRecursive->Initialize("/R");
+ ArgVerbose->Initialize("/V");
+
+ ArrayOfArg->Put(&ArgRecursive);
+ ArrayOfArg->Put(&ArgVerbose);
+
+
+ 5.- Now let the lexemizer parse the arguments. If the parsing
+ returns TRUE, then all the command line was parsed correctly,
+ if it returns FALSE, then an error was found (e.g. invalid
+ argument):
+
+ if (!(ArgLex->DoParsing(&ArrayOfArg))) {
+
+ //
+ // Error, display usage
+ //
+ Usage();
+
+ }
+
+
+
+ 6.- Voila! We can now query our arguments for their value:
+
+
+ .
+ .
+ .
+ if (ArgRecursive->QueryFlag()) {
+ .
+ .
+ Do_recursive_stuff();
+ .
+ .
+
+
+
+ Warnings:
+
+ * The strings passed when setting options (such as switch
+ characters) have to remain in scope while the lexemizer is
+ being used, because the lexemizer keeps pointers to them.
+
+ * If after parsing the command line you want to change some
+ setting and parse the line again, you have to call the
+ PrepareToParse method after changing the setting and before
+ calling the DoParsing method. Note that in this case you
+ might want to use "fresh" argument objects, because most
+ arguments can only be set once.
+
+ * The method for querying the value of an argument is
+ argument-specific (no virtual method is provided).
+
+
+ * GLOMMING (mjb): This is something of a kludge I added to
+ allow xcopy to take switch arguments glommed together, as
+ in "/s/f/i/d" while not being confused by date arguments
+ such as "/d:8/24/95". This is handled similarly to the
+ "multiple switches"; only switches that are allowed to be
+ grouped may be glommed.
+
+ * NoSpcBetweenDstAndSwitch: This is a kludge to allow xcopy
+ to accept a destination path and a switch with no space
+ in between. The trick is to avoid being confused by date
+ arguments such as "/d:8/24/95".
+
+Revision History:
+
+
+--*/
+
+
+#include "array.hxx"
+#include "wstring.hxx"
+
+#if !defined( _AUTOCHECK_ )
+#include "timeinfo.hxx"
+#include "path.hxx"
+#endif
+
+
+//
+// Forward references
+//
+
+
+#if !defined (_ARGUMENT_LEXEMIZER_)
+
+#define _ARGUMENT_LEXEMIZER_
+
+DECLARE_CLASS( ARGUMENT_LEXEMIZER );
+DECLARE_CLASS( ARGUMENT );
+
+// Type of a pointer to the match function
+//
+typedef BOOLEAN (*PMATCHFUNCTION)(OUT PARGUMENT, OUT PARGUMENT_LEXEMIZER);
+
+class ARGUMENT_LEXEMIZER : public OBJECT {
+
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( ARGUMENT_LEXEMIZER );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~ARGUMENT_LEXEMIZER(
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PARRAY LexemeArray
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DoParsing (
+ IN PARRAY ArgumentArray
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ GetLexemeAt (
+ IN ULONG Index
+ );
+
+ NONVIRTUAL
+ ULONG
+ IncrementConsumedCount (
+ IN ULONG HowMany DEFAULT 1
+ );
+
+ VOID
+ PutEndQuotes (
+ IN PCWSTRING QuoteChars
+ );
+
+ VOID
+ PutEndQuotes (
+ IN PCSTR QuoteChars
+ );
+
+ NONVIRTUAL
+ VOID
+ PutMetaChars (
+ IN PCSTR MetaChars
+ );
+
+ NONVIRTUAL
+ VOID
+ PutMetaChars (
+ IN PCWSTRING MetaChars
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ PutMultipleSwitch (
+ IN PCSTR MultipleSwitch
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ PutMultipleSwitch (
+ IN PCWSTRING MultipleSwitch
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ PutSeparators (
+ IN PCSTR Separators
+ );
+
+ NONVIRTUAL
+ VOID
+ PutSeparators (
+ IN PCWSTRING Separators
+ );
+
+ VOID
+ PutStartQuotes (
+ IN PCSTR QuoteChars
+ );
+
+ VOID
+ PutStartQuotes (
+ IN PCWSTRING QuoteChars
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ PutSwitches (
+ IN PCSTR Switches
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ PutSwitches (
+ IN PCWSTRING Switches
+ );
+
+ NONVIRTUAL
+ PCWSTRING
+ GetSwitches (
+ );
+
+ NONVIRTUAL
+ CHNUM
+ QueryCharPos (
+ IN ULONG LexemeNumber
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryConsumedCount (
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryLexemeCount (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ QueryInvalidArgument (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ PrepareToParse (
+ IN PWSTRING CommandLine DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ SetCaseSensitive (
+ BOOLEAN CaseSensitive
+ );
+
+ NONVIRTUAL
+ PCWSTRING
+ GetCmdLine(
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ SetAllowSwitchGlomming (
+ BOOLEAN AllowGlomming
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ SetNoSpcBetweenDstAndSwitch (
+ BOOLEAN NoSpcBetweenDstAndSwitch
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ PutCharPos (
+ IN ULONG Position,
+ IN CHNUM CharPos
+ );
+
+ PARRAY _parray; // Array of lexemes
+ PCHNUM _CharPos; // Character positions
+ ULONG _CharPosSize; // Size of _CharPos array
+ ULONG _ConsumedCount; // Lexemes consumed
+ ULONG _LexemeCount; // Total lexemes
+ DSTRING _WhiteSpace; // White space characters
+ DSTRING _SwitchChars; // Switch characters
+ DSTRING _Separators; // Separator characters
+ DSTRING _StartQuote; // Start of quote characters
+ DSTRING _SeparatorString; // All characters which cause separation
+ DSTRING _EndQuote; // End of quote characters
+ DSTRING _MultipleSwitches; // "Groupable" switches
+ DSTRING _MetaChars; // Meta-characters
+ BOOLEAN _CaseSensitive; // TRUE if case sensitive
+ BOOLEAN _AllowGlomming; // TRUE if switch glomming allowed
+ BOOLEAN _NoSpcBetweenDstAndSwitch; // TRUE if no space is required
+ // between tokens
+
+ WCHAR _Switch; // Switch character
+ DSTRING _CmdLine; // The entire command line
+
+};
+
+
+INLINE
+PCWSTRING
+ARGUMENT_LEXEMIZER::GetSwitches (
+ )
+
+/*++
+
+Routine Description:
+
+ Returns a ptr to a string containing the valid switch chars
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Returns string containing the valid switch chars
+
+--*/
+{
+ return &_SwitchChars;
+}
+
+
+INLINE
+ULONG
+ARGUMENT_LEXEMIZER::IncrementConsumedCount (
+ IN ULONG HowMany
+ )
+/*++
+
+Routine Description:
+
+ Increments count of Lexemes consumed
+
+Arguments:
+
+ HowMany - Supplies by how many to increment.
+
+Return Value:
+
+ New count
+
+--*/
+{
+ return (_ConsumedCount += HowMany);
+}
+
+
+INLINE
+VOID
+ARGUMENT_LEXEMIZER::PutEndQuotes (
+ IN PCSTR QuoteChars
+ )
+/*++
+
+Routine Description:
+
+ Initializes the ending quote chars
+
+Arguments:
+
+ QuoteChars - Supplies pointer to string of close quote chars
+
+Return Value:
+
+ none
+--*/
+{
+ DebugPtrAssert( QuoteChars );
+ _EndQuote.Initialize(QuoteChars);
+}
+
+
+INLINE
+VOID
+ARGUMENT_LEXEMIZER::PutEndQuotes (
+ IN PCWSTRING QuoteChars
+ )
+/*++
+
+Routine Description:
+
+ Initializes the ending quote chars
+
+Arguments:
+
+ QuoteChars - Supplies pointer to string of close quote chars
+
+Return Value:
+
+ none
+--*/
+{
+ DebugPtrAssert( QuoteChars );
+ _EndQuote.Initialize(QuoteChars);
+}
+
+
+INLINE
+VOID
+ARGUMENT_LEXEMIZER::PutStartQuotes (
+ IN PCSTR QuoteChars
+ )
+/*++
+
+Routine Description:
+
+ Initializes the starting quote chars
+
+Arguments:
+
+ QuoteChars - Supplies pointer to string of open quote chars
+
+Return Value:
+
+ none
+--*/
+{
+ DebugPtrAssert( QuoteChars );
+ _StartQuote.Initialize(QuoteChars);
+}
+
+
+INLINE
+VOID
+ARGUMENT_LEXEMIZER::PutStartQuotes (
+ IN PCWSTRING QuoteChars
+ )
+/*++
+
+Routine Description:
+
+ Initializes the starting quote chars
+
+Arguments:
+
+ QuoteChars - Supplies pointer to string of open quote chars
+
+Return Value:
+
+ none
+--*/
+{
+ DebugPtrAssert( QuoteChars );
+ _StartQuote.Initialize(QuoteChars);
+}
+
+
+INLINE
+ULONG
+ARGUMENT_LEXEMIZER::QueryConsumedCount (
+ )
+/*++
+
+Routine Description:
+
+ Returns number of lexemes consumed
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Number of lexemes consumed
+
+--*/
+{
+ return _ConsumedCount;
+}
+
+
+INLINE
+ULONG
+ARGUMENT_LEXEMIZER::QueryLexemeCount (
+ ) CONST
+/*++
+
+Routine Description:
+
+ Returns total number of lexemes
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Total number of lexemes
+
+--*/
+{
+ return _LexemeCount;
+}
+
+INLINE
+PCWSTRING
+ARGUMENT_LEXEMIZER::GetCmdLine(
+ ) CONST
+/*++
+
+Routine Description:
+
+ Returns the original commmand line.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The original command line.
+
+--*/
+{
+ return &_CmdLine;
+}
+
+
+#endif // _ARGUMENT_LEXEMIZER_
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ARGUMENT
+
+Abstract:
+
+ Base class for arguments.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+[Environment:]
+
+ optional-environment-info (e.g. kernel mode only...)
+
+Notes:
+
+
+
+Revision History:
+
+--*/
+
+#if !defined (_ARGUMENT_)
+
+#define _ARGUMENT_
+
+
+class ARGUMENT : public OBJECT {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( ARGUMENT );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ GetLexeme (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ GetPattern (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsValueSet (
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetIfMatch (
+ OUT PARGUMENT_LEXEMIZER ArgumentLexemizer,
+ IN BOOLEAN CaseSensitive
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+
+ protected:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ BOOLEAN _fValueSet; // TRUE when value set
+ PWSTRING _Lexeme; // Matched Lexeme
+ DSTRING _Pattern; // Pattern
+
+};
+
+#endif // _ARGUMENT
+
+
+
+
+
+
+
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ FLAG_ARGUMENT
+
+Abstract:
+
+ Argument class for flags and switches.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Revision History:
+
+--*/
+
+#if !defined ( _FLAG_ARGUMENT_ )
+
+#define _FLAG_ARGUMENT_
+
+DECLARE_CLASS( FLAG_ARGUMENT );
+
+class FLAG_ARGUMENT : public ARGUMENT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( FLAG_ARGUMENT );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryFlag (
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ BOOLEAN _flag; // TRUE if flag (switch) set
+
+};
+
+INLINE
+BOOLEAN
+FLAG_ARGUMENT::QueryFlag (
+ )
+/*++
+
+Routine Description:
+
+ Returns TRUE if flag set
+
+Arguments:
+
+ none
+
+Return Value:
+
+ TRUE if flag set. FALSE otherwise
+
+--*/
+{
+ return _flag;
+}
+
+#endif // _FLAG_ARGUMENT_
+
+
+
+
+
+
+
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ STRING_ARGUMENT
+
+Abstract:
+
+ Argument class for strings.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Revision History:
+
+--*/
+
+#if !defined ( _STRING_ARGUMENT_ )
+
+#define _STRING_ARGUMENT_
+
+DECLARE_CLASS( STRING_ARGUMENT );
+
+class STRING_ARGUMENT : public ARGUMENT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( STRING_ARGUMENT );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~STRING_ARGUMENT(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ GetString (
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ protected:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+
+ PWSTRING _String; // Pointer to the string
+
+};
+
+INLINE
+PWSTRING
+STRING_ARGUMENT::GetString (
+ )
+/*++
+
+Routine Description:
+
+ Returns pointer to the string
+
+Arguments:
+
+ none
+
+Return Value:
+
+ pointer to the string
+
+--*/
+{
+ DebugAssert( _fValueSet );
+
+ return _String;
+}
+
+#endif // _STRING_ARGUMENT_
+
+
+
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ LONG_ARGUMENT
+
+Abstract:
+
+ Argument class for long integers.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Revision History:
+
+--*/
+
+#if !defined ( _LONG_ARGUMENT_ )
+
+#define _LONG_ARGUMENT_
+
+DECLARE_CLASS( LONG_ARGUMENT );
+
+class LONG_ARGUMENT : public ARGUMENT {
+
+ public:
+
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( LONG_ARGUMENT );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ NONVIRTUAL
+ LONG
+ QueryLong (
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ LONG _value; // Long value
+
+};
+
+INLINE
+LONG
+LONG_ARGUMENT::QueryLong (
+ )
+/*++
+
+Routine Description:
+
+ Returns value of the long argument
+
+Arguments:
+
+ none
+
+Return Value:
+
+ value of the argument
+
+--*/
+{
+ DebugAssert( _fValueSet );
+
+ return _value;
+}
+
+#endif // _LONG_ARGUMENT_
+
+
+
+#if !defined( _AUTOCHECK_ )
+
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ PATH_ARGUMENT
+
+Abstract:
+
+ Argument class for paths.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Revision History:
+
+--*/
+
+#if !defined( _PATH_ARGUMENT_ )
+
+#define _PATH_ARGUMENT_
+
+DECLARE_CLASS( PATH_ARGUMENT );
+
+class PATH_ARGUMENT : public ARGUMENT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( PATH_ARGUMENT );
+
+ ULIB_EXPORT
+ NONVIRTUAL
+ ~PATH_ARGUMENT (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern,
+ IN BOOLEAN Canonicalize DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern,
+ IN BOOLEAN Canonicalize DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ PPATH
+ GetPath (
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ protected:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+
+ PPATH _Path; // Pointer to the path
+ BOOLEAN _Canonicalize; // Canonicalization flag
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Destroy (
+ );
+
+};
+
+INLINE
+PPATH
+PATH_ARGUMENT::GetPath (
+ )
+/*++
+
+Routine Description:
+
+ Returns pointer to the path
+
+Arguments:
+
+ none
+
+Return Value:
+
+ pointer to the path
+
+--*/
+{
+ DebugAssert( _fValueSet );
+
+ return _Path;
+}
+
+#endif // _PATH_ARGUMENT_
+
+
+#endif // _AUTOCHECK_
+
+
+
+#if !defined( _AUTOCHECK_ )
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ MULTIPLE_PATH_ARGUMENT
+
+Abstract:
+
+ Provide for access to command line arguments that are file or path names.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Environment:
+
+ user
+
+Revision History:
+
+
+--*/
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ MULTIPLE_PATH_ARGUMENT
+
+Abstract:
+
+ Hold multiple file names on command line.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+
+Revision History:
+
+--*/
+
+#if !defined ( _MULTIPLE_PATH_ARGUMENT_ )
+
+#define _MULTIPLE_PATH_ARGUMENT_
+
+DECLARE_CLASS( MULTIPLE_PATH_ARGUMENT );
+
+class MULTIPLE_PATH_ARGUMENT : public PATH_ARGUMENT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( MULTIPLE_PATH_ARGUMENT );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~MULTIPLE_PATH_ARGUMENT (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern,
+ IN BOOLEAN Canonicalize DEFAULT FALSE,
+ IN BOOLEAN ExpandWildCards DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern,
+ IN BOOLEAN Canonicalize DEFAULT FALSE,
+ IN BOOLEAN ExpandWildCards DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ PCWSTRING
+ GetLexemeThatFailed (
+ );
+
+ NONVIRTUAL
+ PARRAY
+ GetPathArray (
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryPathCount (
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING pwcArg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ WildCardExpansionFailed (
+ );
+
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy (
+ );
+
+ PARRAY _PathArray;
+ ULONG _PathCount;
+ BOOLEAN _ExpandWildCards;
+ BOOLEAN _WildCardExpansionFailed;
+ DSTRING _LexemeThatFailed;
+};
+
+
+INLINE
+PCWSTRING
+MULTIPLE_PATH_ARGUMENT::GetLexemeThatFailed (
+ )
+/*++
+
+Routine Description:
+
+ Gets the lexeme that failed in case of a wildcard expansion failure
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to the lexeme that failed
+
+--*/
+{
+ return _WildCardExpansionFailed ? (PCWSTRING)&_LexemeThatFailed : NULL;
+}
+
+
+INLINE
+PARRAY
+MULTIPLE_PATH_ARGUMENT::GetPathArray (
+ )
+/*++
+
+Routine Description:
+
+ Returns pointer to the path array
+
+Arguments:
+
+ none
+
+Return Value:
+
+ pointer to the path array
+
+--*/
+{
+ return _PathArray;
+}
+
+INLINE
+ULONG
+MULTIPLE_PATH_ARGUMENT::QueryPathCount (
+ )
+/*++
+
+Routine Description:
+
+ Returns number of paths in the array
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Number of paths in the array
+
+--*/
+{
+ return _PathCount;
+}
+
+
+
+INLINE
+BOOLEAN
+MULTIPLE_PATH_ARGUMENT::WildCardExpansionFailed (
+ )
+/*++
+
+Routine Description:
+
+ Tells the caller if wildcard expansion failed
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BOOLEAN - TRUE if wildcard expansion failed
+
+--*/
+{
+ return _WildCardExpansionFailed;
+}
+
+#endif // _MULTIPLE_PATH_ARGUMENT_
+
+
+#endif // _AUTOCHECK_
+
+
+
+#if !defined( _AUTOCHECK_ )
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ TIMEINFO_ARGUMENT
+
+Abstract:
+
+ Argument class for time information.
+
+Author:
+
+ Ramon Juan San Andres (ramonsa) May-15-1991
+
+Revision History:
+
+--*/
+
+#if !defined ( _TIMEINFO_ARGUMENT_ )
+
+#define _TIMEINFO_ARGUMENT_
+
+DECLARE_CLASS( TIMEINFO_ARGUMENT );
+
+class TIMEINFO_ARGUMENT : public ARGUMENT {
+
+ public:
+
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( TIMEINFO_ARGUMENT );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~TIMEINFO_ARGUMENT(
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTR Pattern
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PWSTRING Pattern
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetValue (
+ IN PWSTRING Arg,
+ IN CHNUM chnIdx,
+ IN CHNUM chnEnd,
+ IN PARGUMENT_LEXEMIZER ArgumentLexemizer
+ );
+
+ NONVIRTUAL
+ PTIMEINFO
+ GetTimeInfo (
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ PTIMEINFO _TimeInfo; // Time info.
+
+};
+
+INLINE
+PTIMEINFO
+TIMEINFO_ARGUMENT::GetTimeInfo (
+ )
+/*++
+
+Routine Description:
+
+ Returns pointer to the time information
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to time info.
+
+--*/
+{
+ DebugAssert( _fValueSet );
+
+ return _TimeInfo;
+}
+
+#endif // _TIMEINFO_ARGUMENT_
+
+
+
+#endif // _AUTOCHECK_
+
+
+
+
+#if !defined( _AUTOCHECK_ )
+
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ TIMEINFO_ARGUMENT
+
+Abstract:
+
+ Argument class for time information.
+
+Author:
+
+ Ramon Juan San Andres (ramonsa) May-15-1991
+
+Revision History:
+
+--*/
+
+#if !defined ( _REST_OF_LINE_ARGUMENT_ )
+
+#define _REST_OF_LINE_ARGUMENT_
+
+DECLARE_CLASS( REST_OF_LINE_ARGUMENT );
+
+class REST_OF_LINE_ARGUMENT : public ARGUMENT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( REST_OF_LINE_ARGUMENT );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetIfMatch(
+ IN OUT PARGUMENT_LEXEMIZER ArgumentLexemizer,
+ IN BOOLEAN CaseSensitive
+ );
+
+ NONVIRTUAL
+ PCWSTRING
+ GetRestOfLine(
+ ) CONST;
+
+ private:
+
+ DSTRING _RestOfLine;
+
+};
+
+
+INLINE
+PCWSTRING
+REST_OF_LINE_ARGUMENT::GetRestOfLine(
+ ) CONST
+/*++
+
+Routine Description:
+
+ Returns pointer to the macro argument.
+
+Arguments:
+
+ none
+
+Return Value:
+
+ A pointer to the macro argument.
+
+--*/
+{
+ DebugAssert( _fValueSet );
+
+ return &_RestOfLine;
+}
+
+#endif // _REST_OF_LINE_ARGUMENT_
+
+
+
+#endif // _AUTOCHECK_
+
diff --git a/private/utils/ulib/inc/array.hxx b/private/utils/ulib/inc/array.hxx
new file mode 100644
index 000000000..82626b173
--- /dev/null
+++ b/private/utils/ulib/inc/array.hxx
@@ -0,0 +1,390 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ array.hxx
+
+Abstract:
+
+ This module contains the declaration for the ARRAY class.
+
+ ARRAY is a concrete implementation of a dynamic (i.e. growable) array
+ derived from the abstract class SORTABLE_CONTAINER.
+
+ ARRAY's support one 'writer' (i.e. one client poutting OBJECTs into
+ the ARRAY) and multiple readers via an ITERATOR. It is the client's
+ responsibility to synchronize multiple writers.
+
+ The ARRAY does not contain holes, i.e. all elements of the array (up
+ to QueryMemberCount() ) have objects.
+
+
+Author:
+
+ David J. Gilman (davegi) 31-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+
+--*/
+
+#if ! defined( _ARRAY_ )
+
+#define _ARRAY_
+
+#include "sortcnt.hxx"
+
+//
+// Forward references
+//
+DECLARE_CLASS( ARRAY );
+DECLARE_CLASS( ARRAY_ITERATOR );
+DECLARE_CLASS( SORTED_LIST );
+
+//
+// Pointer to array of POBJECTs
+//
+typedef POBJECT* PPOBJECT;
+
+//
+// Default values for an ARRAY object.
+//
+// - Capacity is the total number of elements that can be stored in an ARRAY
+// - CapacityIncrement is the number of elemnts that the ARRAY's Capacity
+// will be increased by when it's Capacity is exceeded
+//
+CONST ULONG DefaultCapacity = 50;
+CONST ULONG DefaultCapacityIncrement = 25;
+
+//
+// Invalid index within the array
+//
+CONST ULONG INVALID_INDEX = (ULONG)(-1);
+
+
+class ARRAY : public SORTABLE_CONTAINER {
+
+ friend ARRAY_ITERATOR;
+ friend SORTED_LIST;
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( ARRAY );
+
+ DECLARE_CAST_MEMBER_FUNCTION( ARRAY );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~ARRAY(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN ULONG Capacity DEFAULT DefaultCapacity,
+ IN ULONG CapacityIncrement DEFAULT DefaultCapacityIncrement
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DeleteAllMembers(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetAt(
+ IN ULONG Index
+ ) CONST;
+
+ VIRTUAL
+ ULONG
+ GetMemberIndex(
+ IN POBJECT Object
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ ULIB_EXPORT
+ Put(
+ IN OUT POBJECT Member
+ );
+
+ VIRTUAL
+ BOOLEAN
+ PutAt(
+ IN OUT POBJECT Member,
+ IN ULONG Index
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryCapacity (
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QueryCapacityIncrement (
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ PITERATOR
+ QueryIterator(
+ ) CONST;
+
+ VIRTUAL
+ ULONG
+ QueryMemberCount(
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ POBJECT
+ Remove(
+ IN OUT PITERATOR Position
+ );
+
+ VIRTUAL
+ POBJECT
+ RemoveAt(
+ IN ULONG Index
+ );
+
+ NONVIRTUAL
+ ULONG
+ SetCapacity (
+ IN ULONG Capacity
+ );
+
+ NONVIRTUAL
+ VOID
+ SetCapacityIncrement (
+ IN ULONG CapacityIncrement
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Sort(
+ IN BOOLEAN Ascending DEFAULT TRUE
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Insert(
+ IN OUT POBJECT Member,
+ IN ULONG Index
+ );
+
+
+ protected:
+
+ STATIC
+ LONG
+ CompareAscDesc(
+ IN POBJECT Object1,
+ IN POBJECT Object2,
+ IN BOOLEAN Ascending DEFAULT TRUE
+ );
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ PPOBJECT
+ GetObjectArray (
+ );
+
+ private:
+
+ NONVIRTUAL
+ ULONG
+ SetArrayCapacity(
+ IN ULONG NumberOfElements
+ );
+
+ STATIC
+ int _CRTAPI1
+ CompareAscending (
+ IN const void * Object1,
+ IN const void * Object2
+ );
+
+ STATIC
+ int _CRTAPI1
+ CompareDescending (
+ IN const void * Object1,
+ IN const void * Object2
+ );
+
+ PPOBJECT _ObjectArray; // Array of pointers to OBJECTs
+ ULONG _PutIndex; // Put Index
+ ULONG _Capacity; // Capacity of the array
+ ULONG _CapacityIncrement; // Increment
+
+#if DBG==1
+ ULONG _IteratorCount; // Count of iterators
+#endif
+
+};
+
+
+INLINE
+ULONG
+ARRAY::QueryCapacity (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the current capacity (maximum number of members) of the ARRAY.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ ULONG - Current capacity.
+
+
+--*/
+
+{
+ return( _Capacity );
+}
+
+
+
+INLINE
+ULONG
+ARRAY::QueryCapacityIncrement (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the current capacity increment (realloc amount) of the ARRAY.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ ULONG - Current capacity increment.
+
+--*/
+
+{
+ return( _CapacityIncrement );
+}
+
+
+
+INLINE
+VOID
+ARRAY::SetCapacityIncrement (
+ IN ULONG CapacityIncrement
+ )
+
+/*++
+
+Routine Description:
+
+ Set the capacity incement value.
+
+Arguments:
+
+ CapacityIncrement - Supplies the new value for the capacity increment.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ _CapacityIncrement = CapacityIncrement;
+}
+
+
+
+INLINE
+LONG
+ARRAY::CompareAscDesc(
+ IN POBJECT Object1,
+ IN POBJECT Object2,
+ IN BOOLEAN Ascending
+ )
+/*++
+
+Routine Description:
+
+ Compares two object accordint to an Ascending flag
+
+Arguments:
+
+ Object1 - Supplies first object
+ Object2 - Supplies second object
+ Ascending - Supplies ascending flag
+
+Return Value:
+
+ LONG - If Ascending:
+ <0 if Object1 is less that Object2
+ 0 if Object1 is equal to Object2
+ >0 if Object1 is greater than Object2
+
+ If !Ascending:
+ <0 if Object2 is less that Object1
+ 0 if Object2 is equal to Object1
+ >0 if Object2 is greater than Object1
+
+
+--*/
+{
+ return ( Ascending ? CompareAscending( &Object1, &Object2 ) :
+ CompareDescending( &Object1, &Object2) );
+}
+
+
+
+INLINE
+PPOBJECT
+ARRAY::GetObjectArray (
+ )
+/*++
+
+Routine Description:
+
+ Obtains pointer to the array of objects
+
+Arguments:
+
+ None
+
+Return Value:
+
+ PPOBJECT - Pointer to array of objects
+
+--*/
+
+{
+ return _ObjectArray;
+}
+
+#endif // _ARRAY_
+
diff --git a/private/utils/ulib/inc/arrayit.hxx b/private/utils/ulib/inc/arrayit.hxx
new file mode 100644
index 000000000..1d75de789
--- /dev/null
+++ b/private/utils/ulib/inc/arrayit.hxx
@@ -0,0 +1,125 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ arrayit.hxx
+
+Abstract:
+
+ This module contains the declaration for the ARRAY_ITERATOR class.
+ ARRAY_ITERATOR is a concrete implementation derived from the abstarct
+ ITERATOR class. It is used to 'read' (iterate) over an ARRAY object.
+ It has no public constructor and therefore can only be queried from an
+ ARRAY object. It is the client's responsibility to detsroy
+ ARRAY_ITERATORs when they are done. ARRAY_ITERATORs maintain the currency
+ for reading an ARRAY in order.
+
+Author:
+
+ David J. Gilman (davegi) 29-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _ARRAY_ITERATOR_ )
+
+#define _ARRAY_ITERATOR_
+
+#include "iterator.hxx"
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( ARRAY );
+DECLARE_CLASS( ARRAY_ITERATOR );
+
+
+class ARRAY_ITERATOR : public ITERATOR {
+
+ friend ARRAY;
+
+ public:
+
+ VIRTUAL
+ ~ARRAY_ITERATOR(
+ );
+
+ VIRTUAL
+ VOID
+ Reset(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetCurrent(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetNext(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetPrevious(
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryCurrentIndex(
+ );
+
+ protected:
+
+ DECLARE_CAST_MEMBER_FUNCTION( ARRAY_ITERATOR );
+ DECLARE_CONSTRUCTOR( ARRAY_ITERATOR );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN OUT PARRAY Array
+ );
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ private:
+
+ PARRAY _Array; // Array
+ ULONG _CurrentIndex; // Current index
+
+};
+
+
+INLINE
+ULONG
+ARRAY_ITERATOR::QueryCurrentIndex(
+ )
+/*++
+
+Routine Description:
+
+ Obtains the current index
+
+Arguments:
+
+ None
+
+Return Value:
+
+ ULONG - The current index
+
+--*/
+
+{
+ return _CurrentIndex;
+}
+#endif // _ARRAY_ITERATOR_
diff --git a/private/utils/ulib/inc/basesys.hxx b/private/utils/ulib/inc/basesys.hxx
new file mode 100644
index 000000000..8d4409016
--- /dev/null
+++ b/private/utils/ulib/inc/basesys.hxx
@@ -0,0 +1,57 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ basesys.hxx
+
+Abstract:
+
+ BASE_SYSTEM is the a base class for SYSTEM. It is created so
+ encapsulate the methods on SYSTEM that are used for AUTOCHK.
+
+Author:
+
+ David J. Gilman (davegi) 13-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if !defined( _BASE_SYSTEM_DEFN_ )
+
+#define _BASE_SYSTEM_DEFN_
+
+#include "message.hxx"
+
+
+class BASE_SYSTEM {
+
+ public:
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ QueryResourceString(
+ OUT PWSTRING ResourceString,
+ IN MSGID MsgId,
+ IN PCSTR Format ...
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ QueryResourceStringV(
+ OUT PWSTRING ResourceString,
+ IN MSGID MsgId,
+ IN PCSTR Format,
+ IN va_list VarPointer
+ );
+
+};
+
+
+#endif // _BASE_SYSTEM_DEFN_
diff --git a/private/utils/ulib/inc/bitvect.hxx b/private/utils/ulib/inc/bitvect.hxx
new file mode 100644
index 000000000..1b851740b
--- /dev/null
+++ b/private/utils/ulib/inc/bitvect.hxx
@@ -0,0 +1,447 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ bitvect.hxx
+
+Abstract:
+
+ This module contains the definition for the BITVECTOR class. BITVECTOR
+ is a concrete class which implements a bit array.
+
+Author:
+
+ David J. Gilman (davegi) 13-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+ BITVECTOR is an implementation of a general purpose bit
+ vector. It is based around an abstract type called PT
+ (Primitive Type) to increase it's portability. BITVECTORs
+ can be created of arbitrary size. If required they will
+ allocate memory to maintain the bits or will use a memory
+ buffer supplied by the client. This allows the client to
+ superimpose a bit vector onto a predefined buffer (e.g. onto
+ a SECBUF).
+
+--*/
+#if ! defined ( _BITVECTOR_ )
+
+#define _BITVECTOR_
+
+DECLARE_CLASS( BITVECTOR );
+
+
+// extern ERRSTACK *perrstk; // pointer to error stack
+
+//
+// BITVECTOR allocation increment - Primitive Type
+//
+
+DEFINE_TYPE( ULONG, PT );
+
+//
+// BIT values
+//
+
+enum BIT {
+ SET = 1,
+ RESET = 0
+};
+
+//
+// Invalid bit count
+//
+
+extern CONST PT InvalidBitCount;
+
+class BITVECTOR : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( BITVECTOR );
+
+ DECLARE_CAST_MEMBER_FUNCTION( BITVECTOR );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~BITVECTOR (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PT Size DEFAULT 0,
+ IN BIT InitialValue DEFAULT RESET,
+ IN PPT Memory DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ PCPT
+ GetBuf (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsBitSet (
+ IN PT Index
+ ) CONST;
+
+ NONVIRTUAL
+ PT
+ QueryCountSet (
+ ) CONST;
+
+ NONVIRTUAL
+ PT
+ QuerySize (
+ ) CONST;
+
+ NONVIRTUAL
+ VOID
+ ResetAll (
+ );
+
+ NONVIRTUAL
+ VOID
+ ResetBit (
+ IN PT Index
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ ResetBit (
+ IN PT Index,
+ IN PT Count
+ );
+
+ NONVIRTUAL
+ VOID
+ SetAll (
+ );
+
+ NONVIRTUAL
+ VOID
+ SetBit (
+ IN PT Index
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ SetBit (
+ IN PT Index,
+ IN PT Count
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PT
+ SetSize (
+ IN PT Size,
+ IN BIT InitialValue DEFAULT RESET
+ );
+
+ NONVIRTUAL
+ VOID
+ ToggleBit (
+ IN PT Index,
+ IN PT Count DEFAULT 1
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PT
+ ComputeCountSet (
+ ) CONST;
+
+ NONVIRTUAL
+ VOID
+ Destroy (
+ );
+
+ VOID
+ NONVIRTUAL
+ InitAll (
+ IN PT InitialValue
+ );
+
+ // Note that these three member data items cannot
+ // be static because they are used in INLINE functions
+ // that are called from outside the DLL.
+
+ PT _BitsPerPT;
+ PT _IndexShiftCount;
+ PT _BitPositionMask;
+
+ STATIC
+ CONST
+ BYTE _BitsSetLookUp[ 256 ];
+
+ PPT _BitVector;
+ PT _PTCount;
+ BOOLEAN _FreeBitVector;
+
+};
+
+INLINE
+PCPT
+BITVECTOR::GetBuf (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Returns the underlying bit vector.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PCPT - Returns a pointer to the underlying bitvector.
+
+--*/
+
+{
+ return( _BitVector );
+}
+
+INLINE
+PT
+BITVECTOR::QuerySize (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Returns the number of bits in this BITVECTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PT
+
+--*/
+
+{
+ return( _PTCount * _BitsPerPT );
+}
+
+INLINE
+VOID
+BITVECTOR::InitAll (
+ IN PT InitialValue
+ )
+
+/*++
+
+Routine Description:
+
+ Initialize each element in the internal bit vector to the
+ supplied bit pattern.
+
+Arguments:
+
+ InitialValue - Supplies the pattern for each element.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ DebugAssert( _BitVector != NULL );
+
+ memset(( PVOID ) _BitVector,
+ ( int ) InitialValue, ( size_t ) ( sizeof( PT ) * _PTCount ));
+}
+
+INLINE
+VOID
+BITVECTOR::SetAll (
+ )
+
+/*++
+
+Routine Description:
+
+ Set (to one) all of the bits in this BITVECTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ InitAll(( PT ) ~0 );
+}
+
+INLINE
+VOID
+BITVECTOR::ResetAll (
+ )
+
+/*++
+
+Routine Description:
+
+ Reset (to zero) all of the bits in this BITVECTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ InitAll(( PT ) 0 );
+}
+
+INLINE
+BOOLEAN
+BITVECTOR::IsBitSet (
+ IN PT Index
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if the bit at the supplied index is set.
+
+Arguments:
+
+ Index - Supplies the index to the bit of interest.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if the bit of interest is set.
+
+--*/
+
+{
+ DebugAssert( _BitVector != NULL );
+ DebugAssert( Index < ( _PTCount * _BitsPerPT ));
+
+ return (_BitVector[Index >> _IndexShiftCount] &
+ (1 << (Index & _BitPositionMask))) ? TRUE : FALSE;
+}
+
+INLINE
+VOID
+BITVECTOR::SetBit (
+ IN PT Index
+ )
+
+/*++
+
+Routine Description:
+
+ Set the bit at the supplied index.
+
+Arguments:
+
+ Index - Supplies the index to the bit of interest.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ DebugAssert( _BitVector != NULL );
+ DebugAssert( Index < ( _PTCount * _BitsPerPT ));
+
+ _BitVector[Index >> _IndexShiftCount] |=
+ (1 << (Index & _BitPositionMask));
+}
+
+INLINE
+VOID
+BITVECTOR::ResetBit (
+ IN PT Index
+ )
+
+/*++
+
+Routine Description:
+
+ Reset the bit at the supplied index.
+
+Arguments:
+
+ Index - Supplies the index to the bit of interest.
+
+Return Value:
+
+ None.
+
+--*/
+
+{
+ DebugAssert( _BitVector != NULL );
+ DebugAssert( Index < ( _PTCount * _BitsPerPT ));
+
+ _BitVector[Index >> _IndexShiftCount] &=
+ ~(1 << (Index & _BitPositionMask));
+}
+
+INLINE
+PT
+BITVECTOR::QueryCountSet (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine the number of bits set in this BITVECTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PT - Returns the number of set bits.
+
+--*/
+{
+ return ComputeCountSet();
+}
+
+#endif // _BITVECTOR_
diff --git a/private/utils/ulib/inc/buffer.hxx b/private/utils/ulib/inc/buffer.hxx
new file mode 100644
index 000000000..7541b5d96
--- /dev/null
+++ b/private/utils/ulib/inc/buffer.hxx
@@ -0,0 +1,183 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ buffer.hxx
+
+Abstract:
+
+ This contains all buffer class definition.
+ No reallocing of buffers is done. A buffer must be big enough
+ to hold both buffer for a cat.
+
+Author:
+
+ Steve Rowe 27-Nov-90
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+
+
+Revision History:
+
+--*/
+
+//
+// This class is no longer supported.
+//
+
+#define _BUFFER_
+
+#if !defined (_BUFFER_)
+
+#define _BUFFER_
+
+#include "error.hxx"
+
+DECLARE_CLASS( BUFFER );
+
+
+class BUFFER : public OBJECT {
+
+ friend WSTRING;
+
+ public:
+
+ VIRTUAL
+ ~BUFFER (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ BuffCat (
+ IN PCBUFFER BufferToCat
+ );
+
+ NONVIRTUAL
+ PCVOID
+ GetBufferPtr (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ PutBuffer (
+ IN PCBUFFER BufferToCopy
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryBytesInBuffer (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ SetBuffer (
+ IN PVOID InitialBuffer,
+ IN ULONG SizeOfBuffer
+ );
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( BUFFER );
+
+ NONVIRTUAL
+ BOOLEAN
+ BufferCopyAt (
+ IN PCVOID BufferToCopy,
+ IN ULONG BytesToCopy,
+ IN ULONG StartingByte DEFAULT 0
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ DeleteAt (
+ IN ULONG cbToDelete,
+ IN ULONG oStartDelete
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ InsertAt (
+ IN PCVOID BufferToCopy,
+ IN ULONG cbToCopy,
+ IN ULONG oStartCopy
+ );
+
+ NONVIRTUAL
+ PVOID
+ ReAllocate (
+ IN ULONG NewCount
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ PVOID pBuffer; // pointer to the data byffer
+ ULONG cb; // count of bytes used
+ ULONG _BufSize; // count of bytes in buffer
+
+ STATIC
+ ULONG _ThresHold;
+};
+
+INLINE
+PCVOID
+BUFFER::GetBufferPtr (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Fetch pointer to internal buffer
+
+Arguments:
+
+ None
+
+Return Value:
+
+ PCVOID - pointer to internal buffer
+
+--*/
+
+{
+ return ( pBuffer );
+}
+
+INLINE
+ULONG
+BUFFER::QueryBytesInBuffer (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Fetch size in bytes of internal buffer
+
+Arguments:
+
+ None
+
+Return Value:
+
+ ULONG - size of internal buffer in bytes
+
+--*/
+
+{
+ return ( cb );
+}
+
+#endif // _BUFFER_
diff --git a/private/utils/ulib/inc/bufstrm.hxx b/private/utils/ulib/inc/bufstrm.hxx
new file mode 100644
index 000000000..f4e5d644e
--- /dev/null
+++ b/private/utils/ulib/inc/bufstrm.hxx
@@ -0,0 +1,217 @@
+ /*++
+
+ Copyright (c) 1991 Microsoft Corporation
+
+ Module Name:
+
+ bufstrm.hxx
+
+ Abstract:
+
+ This module contains the declaration for the BUFFER_STREAM class.
+ The BUFFER_STREAM is an abstract class derived from STREAM, that
+ provides a buffer for read operations in STREAM.
+ Buffer for read operations is needed in order to read
+ STRINGs from streams.
+
+ Buffer for write operation is not currently implemented. It should
+ be implemented if we notice that write operations are slow.
+
+
+ Author:
+
+ Jaime Sasson (jaimes) 12-Apr-1991
+
+ Environment:
+
+ ULIB, User Mode
+
+
+ --*/
+
+
+ #if !defined( _BUFFER_STREAM_ )
+
+ #define _BUFFER_STREAM_
+
+ #include "stream.hxx"
+ #include "wstring.hxx"
+
+ DECLARE_CLASS( STREAM );
+
+
+ class BUFFER_STREAM : public STREAM {
+
+ public:
+
+ VIRTUAL
+ ~BUFFER_STREAM(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsAtEnd(
+ ) CONST;
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST PURE;
+
+ VIRTUAL
+ VOID
+ SetStreamTypeANSI(
+ );
+
+ VIRTUAL
+ VOID
+ DetermineStreamType(
+ IN OUT PBYTE *Buffer,
+ IN ULONG BufferSize
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Read(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToRead,
+ OUT PULONG BytesRead
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadChar(
+ OUT PWCHAR Char,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadMbString(
+ IN PSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadWString(
+ IN PWSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PWSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadString(
+ OUT PWSTRING String,
+ IN PWSTRING Delimiters,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( BUFFER_STREAM );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN ULONG BufferSize
+ );
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ AdvanceBufferPointer(
+ IN ULONG NumberOfBytes
+ );
+
+ VIRTUAL
+ BOOLEAN
+ EndOfFile(
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ FillBuffer(
+ IN PBYTE Buffer,
+ IN ULONG BufferSize,
+ OUT PULONG BytesRead
+ ) PURE;
+
+ NONVIRTUAL
+ ULONG
+ FlushBuffer(
+ );
+
+ VIRTUAL
+ PCBYTE
+ GetBuffer(
+ PULONG BytesInBuffer
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryBytesInBuffer(
+ ) CONST;
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST PURE;
+
+
+
+
+ private:
+
+
+ PBYTE _Buffer;
+ ULONG _BufferSize;
+ PBYTE _CurrentByte;
+ ULONG _BytesInBuffer;
+ INT _BufferStreamType;
+ };
+
+
+
+ INLINE
+ ULONG
+ BUFFER_STREAM::QueryBytesInBuffer(
+ ) CONST
+
+ /*++
+
+ Routine Description:
+
+ Returns the number of bytes in the buffer.
+
+ Arguments:
+
+ None.
+
+ Return Value:
+
+ ULONG - Number of bytes in the buffer.
+
+
+ --*/
+
+
+ {
+ return( _BytesInBuffer );
+ }
+
+
+ #endif // _BUFFER_STREAM_
diff --git a/private/utils/ulib/inc/bytestrm.hxx b/private/utils/ulib/inc/bytestrm.hxx
new file mode 100644
index 000000000..91f117bad
--- /dev/null
+++ b/private/utils/ulib/inc/bytestrm.hxx
@@ -0,0 +1,169 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ bytestream.hxx
+
+Abstract:
+
+
+ This module contains the declarations for the BYTE_STREAM class.
+
+ BYTE_STREAM is a class which contains (not derives) a normal
+ ULIB stream and provided fast ReadByte operations. It is designed
+ for those utilities that have to read files one byte at a time.
+
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 28-Feb-1992
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _BYTE_STREAM_ )
+
+#define _BYTE_STREAM_
+
+#include "stream.hxx"
+
+DECLARE_CLASS( BYTE_STREAM );
+
+
+#define DEFAULT_BUFFER_SIZE 256
+
+class BYTE_STREAM : public OBJECT {
+
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( BYTE_STREAM );
+
+ VOID
+ BYTE_STREAM::Construct (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~BYTE_STREAM (
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PSTREAM Stream,
+ IN DWORD BufferSize DEFAULT DEFAULT_BUFFER_SIZE
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ IsAtEnd(
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ ReadByte(
+ IN PBYTE Byte
+ );
+
+
+
+ private:
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ FillAndReadByte (
+ IN PBYTE Byte
+ );
+
+
+ PSTREAM _Stream;
+ PBYTE _Buffer;
+ PBYTE _NextByte;
+ DWORD _BufferSize;
+ DWORD _BytesInBuffer;
+
+};
+
+
+
+INLINE
+BOOLEAN
+BYTE_STREAM::IsAtEnd(
+ ) CONST
+/*++
+
+Routine Description:
+
+ Determines if we're at the end of the stream
+
+Arguments:
+
+ None
+
+Return Value:
+
+ BOOLEAN - TRUE if at end.
+
+--*/
+{
+ if ( _BytesInBuffer > 0 ) {
+ return FALSE;
+ } else {
+ return _Stream->IsAtEnd();
+ }
+}
+
+
+
+INLINE
+BOOLEAN
+BYTE_STREAM::ReadByte(
+ IN PBYTE Byte
+ )
+/*++
+
+
+Routine Description:
+
+ Reads next byte
+
+Arguments:
+
+ Byte - Supplies pointer to where to put the byte
+
+Return Value:
+
+ BOOLEAN - TRUE if byte read.
+
+--*/
+{
+ if ( _BytesInBuffer > 0 ) {
+
+ *Byte = *_NextByte++;
+ _BytesInBuffer--;
+
+ return TRUE;
+
+ } else {
+
+ return FillAndReadByte( Byte );
+
+ }
+}
+
+
+#endif // _BYTE_STREAM_
diff --git a/private/utils/ulib/inc/clasdesc.hxx b/private/utils/ulib/inc/clasdesc.hxx
new file mode 100644
index 000000000..05e3aabbd
--- /dev/null
+++ b/private/utils/ulib/inc/clasdesc.hxx
@@ -0,0 +1,183 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ clasdesc.hxx
+
+Abstract:
+
+ This module contains the declaration for the CLASS_DESCRIPTOR class.
+ A CLASS_DESCRIPTOR contains informatiom to help identify an object's
+ type at run-time. It is a concrete class which is associated with all
+ other concrete classes (i.e. there is one instance of a CLASS_DESCRIPTOR
+ for every concrete class in Ulib). The most important aspect of a
+ CLASS_DESCRIPTOR is that it supplies a guaranteed unique id for the class
+ that it decsribes.
+
+Author:
+
+ David J. Gilman (davegi) 26-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+--*/
+
+#if ! defined( _CLASS_DESCRIPTOR_ )
+
+#define _CLASS_DESCRIPTOR_
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( CLASS_DESCRIPTOR );
+
+
+#if DBG==1
+
+ //
+ // Define a CLASS_DESCRIPTOR in the file ulib.cxx. The name will be
+ // the same as the type name for the associated class.
+ //
+
+ #define DEFINE_CLASS_DESCRIPTOR( c ) \
+ ((( c##_cd = NEW CLASS_DESCRIPTOR ) != NULL ) && \
+ ((( PCLASS_DESCRIPTOR ) c##_cd )->Initialize(( PCCLASS_NAME ) #c )))
+
+ #define CLASS_DESCRIPTOR_INITIALIZE \
+ NONVIRTUAL \
+ ULIB_EXPORT \
+ BOOLEAN \
+ Initialize ( \
+ IN PCCLASS_NAME ClassName \
+ )
+
+ //
+ // For debugging purposes, CLASS_DESCRIPTOR stores the name of the class
+ // that it describes.
+ //
+ // NOTE - DebugGetClassName is declared for both CLASS_DESCRIPTOR and
+ // OBJECT. See the note at the end of this module.
+ //
+
+ //
+ // Maximum length for the name of a class
+ //
+
+ CONST _MaxClassNameLength = 20;
+
+ #define DECLARE_CD_DBG_DATA \
+ CLASS_NAME _ClassName[ _MaxClassNameLength ]
+
+ #define DECLARE_CD_DBG_FUNCTIONS \
+ NONVIRTUAL \
+ PCCLASS_NAME \
+ DebugGetClassName ( \
+ ) CONST
+
+ #define DEFINE_CD_INLINE_DBG_FUNCTIONS \
+ \
+ inline \
+ PCCLASS_NAME \
+ CLASS_DESCRIPTOR::DebugGetClassName ( \
+ ) CONST \
+ { \
+ return(( PCCLASS_NAME ) _ClassName );\
+ }
+
+ #define DbgGetClassName( pobj ) \
+ ( pobj )->DebugGetClassName( )
+#else // DBG == 0
+
+ #define DEFINE_CLASS_DESCRIPTOR( c ) \
+ ((( c##_cd = NEW CLASS_DESCRIPTOR ) != NULL ) && \
+ ((( PCLASS_DESCRIPTOR ) c##_cd )->Initialize( )))
+
+ #define CLASS_DESCRIPTOR_INITIALIZE \
+ NONVIRTUAL \
+ ULIB_EXPORT \
+ BOOLEAN \
+ Initialize ( \
+ )
+
+ #define DECLARE_CD_DBG_DATA \
+ static char d
+
+ #define DECLARE_CD_DBG_FUNCTIONS \
+ void f(void){}
+
+ #define DEFINE_CD_INLINE_DBG_FUNCTIONS \
+ inline void f(void){}
+
+ #define DbgGetClassName( pobj )
+
+#endif // DBG
+
+class CLASS_DESCRIPTOR {
+
+ friend
+ BOOLEAN
+ InitializeUlib(
+ IN HANDLE DllHandle,
+ IN ULONG Reason,
+ IN PVOID Reserved
+ );
+
+ public:
+
+ ULIB_EXPORT
+ CLASS_DESCRIPTOR(
+ );
+
+ CLASS_DESCRIPTOR_INITIALIZE;
+
+ NONVIRTUAL
+ CLASS_ID
+ QueryClassId (
+ ) CONST;
+
+ DECLARE_CD_DBG_FUNCTIONS;
+
+ private:
+
+ DECLARE_CD_DBG_DATA;
+
+ CLASS_ID _ClassID;
+};
+
+
+INLINE
+CLASS_ID
+CLASS_DESCRIPTOR::QueryClassId (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the CLASSID for the object described by this CLASS_DESCRIPTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ CLASSID - The CLASSID as maintained by this CLASS_DESCRIPTOR.
+
+--*/
+
+{
+ return( _ClassID );
+}
+
+
+DEFINE_CD_INLINE_DBG_FUNCTIONS;
+
+#endif // CLASS_DESCRIPTOR
diff --git a/private/utils/ulib/inc/classes.xls b/private/utils/ulib/inc/classes.xls
new file mode 100644
index 000000000..a5be9db61
--- /dev/null
+++ b/private/utils/ulib/inc/classes.xls
Binary files differ
diff --git a/private/utils/ulib/inc/cmem.hxx b/private/utils/ulib/inc/cmem.hxx
new file mode 100644
index 000000000..a57cba24f
--- /dev/null
+++ b/private/utils/ulib/inc/cmem.hxx
@@ -0,0 +1,66 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ cmem.hxx
+
+Abstract:
+
+ The class CONT_MEM is an implementation of the class MEM which uses the
+ memory resources given to it on initialization. Successive calls
+ to Acquire will return successive portions of the memory given
+ to it on initialization.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 26-Nov-90
+
+--*/
+
+#if !defined( _CONT_MEM_DEFN_ )
+
+#define _CONT_MEM_DEFN_
+
+#include "mem.hxx"
+
+DECLARE_CLASS( CONT_MEM );
+
+
+class CONT_MEM : public MEM {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( CONT_MEM );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PVOID Buffer,
+ IN ULONG Size
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PVOID
+ Acquire(
+ IN ULONG Size,
+ IN ULONG AlignmentMask DEFAULT 0
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ PVOID _buf;
+ ULONG _size;
+
+};
+
+#endif // _CONT_MEM_DEFN_
diff --git a/private/utils/ulib/inc/comm.hxx b/private/utils/ulib/inc/comm.hxx
new file mode 100644
index 000000000..89d701b42
--- /dev/null
+++ b/private/utils/ulib/inc/comm.hxx
@@ -0,0 +1,564 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ COMM_DEVICE
+
+Abstract:
+
+ This module contains the definition for the COMM_DEVICE class.
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 08-Jul-91
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+
+
+--*/
+
+#if !defined (_COMM_DEVICE_)
+
+#define _COMM_DEVICE_
+
+
+DECLARE_CLASS( FSN_FILE );
+DECLARE_CLASS( FILE_STREAM );
+DECLARE_CLASS( COMM_DEVICE );
+
+
+//
+// PARITY
+//
+enum PARITY {
+ COMM_PARITY_NONE = NOPARITY,
+ COMM_PARITY_EVEN = EVENPARITY,
+ COMM_PARITY_ODD = ODDPARITY,
+ COMM_PARITY_MARK = MARKPARITY,
+ COMM_PARITY_SPACE = SPACEPARITY
+};
+
+//
+// STOP BITS
+//
+enum STOPBITS {
+
+ COMM_STOPBITS_1 = ONESTOPBIT,
+ COMM_STOPBITS_15 = ONE5STOPBITS,
+ COMM_STOPBITS_2 = TWOSTOPBITS
+};
+
+//
+// DTR control
+//
+enum DTR_CONTROL {
+ DTR_ENABLE = DTR_CONTROL_ENABLE,
+ DTR_DISABLE = DTR_CONTROL_DISABLE,
+ DTR_HANDSHAKE = DTR_CONTROL_HANDSHAKE
+};
+
+//
+// RTS control
+//
+enum RTS_CONTROL {
+ RTS_ENABLE = RTS_CONTROL_ENABLE,
+ RTS_DISABLE = RTS_CONTROL_DISABLE,
+ RTS_HANDSHAKE = RTS_CONTROL_HANDSHAKE,
+ RTS_TOGGLE = RTS_CONTROL_TOGGLE
+};
+
+
+
+
+class COMM_DEVICE : public OBJECT {
+
+ public:
+
+ DECLARE_CAST_MEMBER_FUNCTION( COMM_DEVICE );
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( COMM_DEVICE );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~COMM_DEVICE(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PCPATH PortName,
+ OUT PBOOLEAN OpenError DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ CommitState (
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryBaudRate (
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QueryDataBits (
+ ) CONST;
+
+ NONVIRTUAL
+ DTR_CONTROL
+ QueryDtrControl (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryIdsr (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryOcts (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryOdsr (
+ ) CONST;
+
+ NONVIRTUAL
+ PARITY
+ QueryParity (
+ ) CONST;
+
+ NONVIRTUAL
+ RTS_CONTROL
+ QueryRtsControl (
+ ) CONST;
+
+ NONVIRTUAL
+ STOPBITS
+ QueryStopBits (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryTimeOut (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryXon (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ ReadState (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetBaudRate (
+ IN ULONG BaudRate
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetDataBits (
+ IN ULONG DataBits
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetDtrControl (
+ IN DTR_CONTROL DtrControl
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetIdsr (
+ IN BOOLEAN Idsr
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetOcts (
+ IN BOOLEAN Octs
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetOdsr (
+ IN BOOLEAN Odsr
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetParity (
+ IN PARITY Parity
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetRtsControl (
+ IN RTS_CONTROL RtsControl
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetStopBits (
+ IN STOPBITS StopBits
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetTimeOut (
+ IN BOOLEAN TimeOut
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetXon (
+ IN BOOLEAN Xon
+ );
+
+ protected:
+
+
+ private:
+
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy (
+ );
+
+
+ HANDLE _Handle; // Handle to the port
+ DCB _Dcb; // DCB Structure.
+
+#if DBG==1
+
+ BOOLEAN _Initialized; // Object has been initialized
+
+#endif // DBG
+
+
+};
+
+INLINE
+ULONG
+COMM_DEVICE::QueryBaudRate (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the baud rate
+
+Arguments:
+
+ none
+
+Return Value:
+
+ ULONG - The baud rate.
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (ULONG)_Dcb.BaudRate;
+
+}
+
+INLINE
+ULONG
+COMM_DEVICE::QueryDataBits (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the number of data bits
+
+Arguments:
+
+ none
+
+Return Value:
+
+ ULONG - The number of data bits
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (ULONG)_Dcb.ByteSize;
+
+}
+
+INLINE
+DTR_CONTROL
+COMM_DEVICE::QueryDtrControl (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the DTR control
+
+Arguments:
+
+ none
+
+Return Value:
+
+ DTR_CONTROL - The DTR control
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (DTR_CONTROL)_Dcb.fDtrControl;
+
+}
+
+INLINE
+BOOLEAN
+COMM_DEVICE::QueryIdsr (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries whether DSR sensitivity is enabled or disabled
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BOOLEAN - TRUE if DSR sensitivity enabled. FALSE otherwise.
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return ( _Dcb.fDsrSensitivity != 0 );
+
+}
+
+INLINE
+BOOLEAN
+COMM_DEVICE::QueryOcts (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries whether hanshaking using the CTS circuit is enabled or not.
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BOOLEAN - TRUE if handshaking enabled. FALSE otherwise.
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return ( _Dcb.fOutxCtsFlow != 0 );
+
+}
+
+INLINE
+BOOLEAN
+COMM_DEVICE::QueryOdsr (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries whether handshaking using the DSR circuit is enabled or not
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BOOLEAN - TRUE if handshaking enabled. FALSE otherwise.
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return ( _Dcb.fOutxDsrFlow != 0 );
+
+}
+
+INLINE
+PARITY
+COMM_DEVICE::QueryParity (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the parity
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BYTE - The parity value.
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (PARITY)_Dcb.Parity;
+
+}
+
+INLINE
+RTS_CONTROL
+COMM_DEVICE::QueryRtsControl (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the RTS control
+
+Arguments:
+
+ none
+
+Return Value:
+
+ RTS_CONTROL - The RTS control
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (RTS_CONTROL)_Dcb.fRtsControl;
+
+}
+
+INLINE
+STOPBITS
+COMM_DEVICE::QueryStopBits (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries the number of stop bits
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BYTE - The number of stop bits
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return (STOPBITS)_Dcb.StopBits;
+}
+
+INLINE
+BOOLEAN
+COMM_DEVICE::QueryXon (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Queries whether XON/XOFF protocol is enabled or not.
+
+Arguments:
+
+ none
+
+Return Value:
+
+ BOOLEAN - TRUE if protocol enabled, FALSE otherwise
+
+--*/
+
+{
+
+ DebugAssert( _Initialized );
+
+ return ( _Dcb.fInX && _Dcb.fOutX );
+}
+
+
+
+
+#endif // _COMM_DEVICE_
diff --git a/private/utils/ulib/inc/contain.hxx b/private/utils/ulib/inc/contain.hxx
new file mode 100644
index 000000000..e588e8df3
--- /dev/null
+++ b/private/utils/ulib/inc/contain.hxx
@@ -0,0 +1,95 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ contain.hxx
+
+Abstract:
+
+ This module contains the definition for the CONTAINER class, the most
+ primitive, abstract class in the container sub-hierarchy. CONTAINERs
+ of all types are repositories for OBJECTs. CONTAINER is the most abstract
+ in that it makes no assumptions about the ordering of it's contents.
+
+Author:
+
+ David J. Gilman (davegi) 26-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _CONTAINER_ )
+
+#define _CONTAINER_
+
+DECLARE_CLASS( CONTAINER );
+
+
+class CONTAINER : public OBJECT {
+
+ public:
+
+ VIRTUAL
+ ~CONTAINER(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Put(
+ IN OUT POBJECT Member
+ ) PURE;
+
+ VIRTUAL
+ ULONG
+ QueryMemberCount(
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ DeleteAllMembers(
+ ) PURE;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsEmpty(
+ ) CONST;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( CONTAINER );
+
+};
+
+
+INLINE
+BOOLEAN
+CONTAINER::IsEmpty(
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if the container is empty.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - TRUE if the container is empty.
+
+--*/
+
+{
+ return QueryMemberCount() == 0;
+}
+
+
+#endif // _CONTAINER_
diff --git a/private/utils/ulib/inc/cstring.h b/private/utils/ulib/inc/cstring.h
new file mode 100644
index 000000000..b401d2fd2
--- /dev/null
+++ b/private/utils/ulib/inc/cstring.h
@@ -0,0 +1,174 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ wstring.h
+
+Abstract:
+
+ This module contains the prototypes for the wide character
+ C-runtime support. Since there is no C-runtime support for
+ wide characters, the functions here are wrappers to the
+ single-byte counterparts
+
+Author:
+
+ Ramon San Andres (Ramonsa) 07-Jun-1991
+
+Revision History:
+
+--*/
+
+typedef char wchar;
+typedef WCHAR wchar_t;
+typedef size_t wsize_t;
+
+long watol( const wchar *);
+wchar * wcschr(const wchar *, int);
+wchar * wcslwr(wchar *);
+wchar * wcsrchr(const wchar *, int);
+wchar * wcsupr(wchar *);
+wsize_t wcscspn(const wchar *, const wchar *);
+wsize_t wcsspn(const wchar *, const wchar *);
+wchar * wcsstr(const wchar *, const wchar *);
+int wctomb( char *s, wchar_t wchar );
+int mbtowc(wchar_t *pwc, const char *s, size_t n);
+wchar_t towupper( wchar_t wc);
+
+INLINE
+long
+watol(
+ const wchar * p
+ )
+{
+ return atol( (char *)p );
+}
+
+
+INLINE
+wchar *
+wcschr (
+ const wchar * p,
+ int c
+ )
+{
+ return (wchar *)strchr( (char *)p, c);
+}
+
+
+INLINE
+wchar *
+wcslwr (
+ wchar * p
+ )
+{
+ return (wchar *)strlwr( (char *)p );
+}
+
+INLINE
+wchar *
+wcsrchr (
+ const wchar * p,
+ int c
+ )
+{
+ return (char *)strrchr( (char *)p, c);
+}
+
+INLINE
+wchar *
+wcsupr (
+ wchar * p
+ )
+{
+ return (char *)strupr( (char *)p );
+}
+
+
+INLINE
+wsize_t
+wcscspn (
+ const wchar *p1,
+ const wchar *p2
+ )
+{
+
+ return (wsize_t)strcspn( (char *)p1, (char *)p2);
+
+}
+
+INLINE
+wsize_t
+wcsspn (
+ const wchar *p1,
+ const wchar *p2
+ )
+{
+
+ return (wsize_t)strspn( (char *)p1, (char *)p2);
+
+}
+
+
+INLINE
+wchar *
+wcsstr (
+ const wchar *p1,
+ const wchar *p2
+ )
+{
+
+ return (wchar *)strstr( (char *)p1, (char *)p2);
+
+}
+
+
+INLINE
+int
+wctomb (
+ char *s,
+ wchar_t wchar
+ )
+{
+
+ if (s) {
+ *s = (char)wchar;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
+INLINE
+int
+mbtowc (
+ wchar_t *pwc,
+ const char *s,
+ size_t n
+ )
+{
+ UNREFERENCED_PARAMETER( n );
+
+ if ( s && *s && (n > 0) ) {
+ *pwc = (wchar_t)(*s);
+ return 1;
+ } else {
+ return 0;
+ }
+
+}
+
+
+INLINE
+wchar_t
+towupper(
+ wchar_t wc
+ )
+{
+
+ return (wchar_t)toupper( (char)wc );
+
+}
diff --git a/private/utils/ulib/inc/dir.hxx b/private/utils/ulib/inc/dir.hxx
new file mode 100644
index 000000000..7c4ab3637
--- /dev/null
+++ b/private/utils/ulib/inc/dir.hxx
@@ -0,0 +1,150 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ dir.hxx
+
+Abstract:
+
+ This module contains the declaration for the FSN_DIRECTORY class.
+ FSN_DIRECTORY is derived from the abstract FSNODE class. It offers an
+ interface which supports the manipulation of DIRECTORIES. It's primary
+ purpose is to support the creation of lists of FSNODE (e.g. FILE and
+ DIRECTORY) objects that meet some criteria (see FSN_FILETER)and to
+ manipulate (e.g. copy, move) FSNODEs which are 'owned' by a FSN_DIRECTORY.
+
+Author:
+
+ David J. Gilman (davegi) 09-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _FSN_DIRECTORY_ )
+
+#define _FSN_DIRECTORY_
+
+#include "fsnode.hxx"
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( FSN_DIRECTORY );
+DECLARE_CLASS( FSN_FILE );
+DECLARE_CLASS( FSN_FILTER );
+DECLARE_CLASS( FSNODE );
+DECLARE_CLASS( PATH );
+
+//
+// Type of the callback function for the Traverse method
+//
+typedef BOOLEAN (*CALLBACK_FUNCTION)( IN PVOID Object, IN OUT PFSNODE Node, IN PPATH DestinationPath);
+
+//
+// Type of the confirmation function for Copy method.
+//
+typedef BOOLEAN (*CONFIRM_COPY_FUNCTION)( IN PCFSNODE Source,
+ IN OUT PPATH DestinationPath );
+
+
+class FSN_DIRECTORY : public FSNODE {
+
+ friend class FSN_FILTER;
+ friend class SYSTEM;
+
+ public:
+
+ DECLARE_CAST_MEMBER_FUNCTION( FSN_DIRECTORY );
+
+ /*
+ NONVIRTUAL
+ PFSN_DIRECTORY
+ CreateDirectory (
+ IN PCPATH Path
+ ) CONST;
+ */
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PFSN_DIRECTORY
+ CreateDirectoryPath (
+ IN PCPATH Path
+ ) CONST;
+
+ NONVIRTUAL
+ PFSN_FILE
+ CreateFile (
+ IN PCPATH Path,
+ IN BOOLEAN OverWrite DEFAULT FALSE
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ Copy (
+ IN PFSN_FILTER FsnFilter,
+ IN PCFSN_DIRECTORY DestinationDir,
+ IN BOOLEAN Recurse DEFAULT FALSE,
+ IN BOOLEAN OverWrite DEFAULT FALSE
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DeleteDirectory (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ DeleteFsNode (
+ IN PCFSN_FILTER FsnFilter,
+ IN BOOLEAN Recurse DEFAULT FALSE
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsEmpty (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ Move (
+ IN PCFSN_FILTER FsnFilter,
+ IN PCSTR DestinationName DEFAULT NULL,
+ IN PCFSN_DIRECTORY DestinationDir DEFAULT NULL,
+ IN BOOLEAN Recurse DEFAULT FALSE,
+ IN BOOLEAN OverWrite DEFAULT FALSE
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PARRAY
+ QueryFsnodeArray (
+ IN PFSN_FILTER FsnFilter DEFAULT NULL
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Traverse (
+ IN PVOID Object,
+ IN PFSN_FILTER FsnFilter,
+ IN OUT PPATH DestinationPath,
+ IN CALLBACK_FUNCTION CallBackFunction
+ ) CONST;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( FSN_DIRECTORY );
+
+ private:
+
+};
+
+#endif // _FSN_DIRECTORY_
diff --git a/private/utils/ulib/inc/error.hxx b/private/utils/ulib/inc/error.hxx
new file mode 100644
index 000000000..227eb1134
--- /dev/null
+++ b/private/utils/ulib/inc/error.hxx
@@ -0,0 +1,392 @@
+/*
+ Defining error code:
+*/
+
+
+#define ERROR_USER_DEFINED_BASE 0xFF00
+#define ERR_ERRSTK_STACK_OVERFLOW ERROR_USER_DEFINED_BASE + 1
+#define NEW_ALLOC_FAILED ERROR_USER_DEFINED_BASE + 2
+
+#define ERROR_NLS_STRING_BASE 0xFF10
+#define ERR_NLS_ALLOC_FAILED ERROR_NLS_STRING_BASE + 1
+#define ERR_NLS_INVALID_PSZ ERROR_NLS_STRING_BASE + 2
+#define ERR_NLS_INVALID_STRING ERROR_NLS_STRING_BASE + 3
+#define ERR_NLS_FIXED_SIZE_BUF ERROR_NLS_STRING_BASE + 4
+#define ERR_NLS_NOT_FOUND ERROR_NLS_STRING_BASE + 5
+#define ERR_NLS_BAD_DATE ERROR_NLS_STRING_BASE + 6
+#define ERR_NLS_BAD_TIME ERROR_NLS_STRING_BASE + 7
+#define ERR_BAD_SUBSTRING ERROR_NLS_STRING_BASE + 8
+
+#define ERROR_ARG_BASE 0xFF20
+#define ERR_UNKNOWN_ARG_STRING ERROR_ARG_BASE + 1
+#define ERR_INVALID_COMMAND_LINE ERROR_ARG_BASE + 2
+
+#define ERROR_ARRAYLIST_BASE 0xFF30
+#define ERR_REALLOC_SIZE_FAILED ERROR_ARRAYLIST_BASE + 1
+
+#define ERROR_STR_BUF_BASE 0xFF40
+#define ERR_FILE_TOO_LARGE ERROR_STR_BUF_BASE + 1
+#define ERR_MEMORY_UNAVAILABLE ERROR_STR_BUF_BASE + 2
+#define ERR_FILE_READ_ERROR ERROR_STR_BUF_BASE + 3
+#define ERR_NO_STRINGS_IN_BUFFER ERROR_STR_BUF_BASE + 4
+#define ERR_INVALID_FILE_NAME ERROR_STR_BUF_BASE + 4
+
+
+#define ERROR_MB_STRING_BASE 0xFF50
+#define ERR_COLLATE_FAILURE ERROR_MB_STRING_BASE + 1
+
+#define ERROR_VOLUME_BASE 0xFF60
+#define ERR_CANNOT_OPEN_VOL ERROR_VOLUME_BASE + 1
+#define ERR_CANNOT_GET_VOL ERROR_VOLUME_BASE + 2
+#define ERR_PARITION_TOOBIG ERROR_VOLUME_BASE + 3
+#define ERR_NO_S_SWITCH ERROR_VOLUME_BASE + 4
+#define ERR_INVALID_PARM ERROR_VOLUME_BASE + 5
+#define ERR_VOL_NOTOPEN ERROR_VOLUME_BASE + 6
+#define ERR_VOL_NOHELPERS ERROR_VOLUME_BASE + 7
+#define ERR_VOL_NETDRIVE ERROR_VOLUME_BASE + 8
+#define ERR_VOL_BUSYDRIVE ERROR_VOLUME_BASE + 9
+#define ERR_VOL_INVALIDLABEL ERROR_VOLUME_BASE + 0xA
+
+#define ERROR_FMT_BASE 0xFFFF0070
+#define ERR_FMT_NOTSUPPORTED ERROR_FMT_BASE + 1
+#define ERR_FMT_UNEXPECTEDERR ERROR_FMT_BASE + 2
+#define ERR_FMT_BADPARM ERROR_FMT_BASE + 3
+#define ERR_FMT_INCOMPATPARM ERROR_FMT_BASE + 4
+#define ERR_FMT_INCOMPATDISK ERROR_FMT_BASE + 5
+#define ERR_FMT_ONCEONLY ERROR_FMT_BASE + 6
+#define ERR_FMT_VOLTOOBIG ERROR_FMT_BASE + 7
+#define ERR_FMT_BADVOLID ERROR_FMT_BASE + 8
+#define ERR_FMT_EXECFAIL ERROR_FMT_BASE + 9
+#define ERR_FMT_BADCMMFUNC ERROR_FMT_BASE + 0xA
+#define ERR_FMT_INVALIDMEDIA ERROR_FMT_BASE + 0xB
+#define ERR_FMT_BADOS ERROR_FMT_BASE + 0xC
+#define ERR_FMT_GENERALFAIL ERROR_FMT_BASE + 0xD
+#define ERR_FMT_NOSPARM ERROR_FMT_BASE + 0xE
+#define ERR_FMT_INVALIDNAME ERROR_FMT_BASE + 0xF
+#define ERR_FMT_NOWRITEBOOT ERROR_FMT_BASE + 0x10
+#define ERR_FMT_BADLABEL ERROR_FMT_BASE + 0x11
+#define ERR_FMT_FATERR ERROR_FMT_BASE + 0x12
+#define ERR_FMT_DIRWRITE ERROR_FMT_BASE + 0x13
+#define ERR_FMT_DRIVELETTER ERROR_FMT_BASE + 0x14
+#define ERR_FMT_UNSUPP_PARMS ERROR_FMT_BASE + 0x15
+#define ERR_FMT_STOPIFDISK ERROR_FMT_BASE + 0x16
+#define ERR_FMT_NODRIVESPEC ERROR_FMT_BASE + 0x17
+
+#define ERROR_IOBUF_BASE 0xFF90
+#define ERR_ALLOC_FAILURE ERROR_IOBUF_BASE + 1
+#define ERR_REALLOC_FAILURE ERROR_IOBUF_BASE + 2
+#define ERR_BUFFER_OVERFLOW ERROR_IOBUF_BASE + 3
+#define ERR_BUFFER_NOT_LOCAL ERROR_IOBUF_BASE + 4
+
+#define ERROR_FS_MGR_BASE 0xff95
+#define ERROR_DRV_BASE 0xff96
+#define ERR_DRV_NOT_SET ERROR_DRV_BASE + 1
+#define ERR_DRV_INVALID_ARG ERROR_DRV_BASE + 2
+#define ERROR_FS_REF_BASE 0xff99
+#define ERROR_FS_REF_SETPROPERTY ERROR_FS_REF_BASE + 1
+#define ERROR_FILE_BASE 0xffa0
+#define ERROR_DIRECTORY_BASE 0xffb0
+#define ERROR_MSG_BASE 0xffc0
+
+#define ERROR_MBR_BASE 0xFFd0
+#define ERR_INVALID_PARITION ERROR_MBR_BASE + 1
+#define ERR_INVALID_SYSTEM_ID ERROR_MBR_BASE + 2
+
+#define ERROR_BPB_BASE 0xFFe0
+#define ERR_BPB_NOMEM ERROR_BPB_BASE + 1
+#define ERR_INVALID_DEVICE ERROR_BPB_BASE + 2
+#define ERR_NO_BPB ERROR_BPB_BASE + 3
+#define ERR_NO_MBR ERROR_BPB_BASE + 4
+
+#define ERROR_FAT_BASE 0xFFf0
+#define ERR_BAD_CLUS_NUM ERROR_FAT_BASE + 1
+
+#define ERROR_FATFMT_BASE 0xFFf5
+#define ERR_NOMULTITRACK ERROR_FATFMT_BASE + 1
+#define ERR_BADAREAS ERROR_FATFMT_BASE + 2
+
+#define ERROR_BMIND_BASE 0xFFFF0000
+#define ERR_BMIND_PARAMETER ERROR_BMIND_BASE + 1
+#define ERR_BMIND_INITIALIZATION ERROR_BMIND_BASE + 2
+
+#define ERROR_BITMAP_BASE 0xFFFF0010
+#define ERR_BM_PARAMETER ERROR_BITMAP_BASE + 1
+#define ERR_BM_FULL ERROR_BITMAP_BASE + 2
+
+#define ERROR_BADBLK_BASE 0xFFFF0020
+#define ERR_BB_PARAMETER ERROR_BADBLK_BASE + 1
+
+#define ERROR_HOTFIX_BASE 0xFFFF0030
+#define ERR_HF_PARAMETER ERROR_HOTFIX_BASE + 1
+
+#define ERROR_FNODE_BASE 0xFFFF0040
+#define ERR_FN_PARAMETER ERROR_FNODE_BASE + 1
+
+#define ERROR_SUPER_BASE 0xFFFF0050
+#define ERR_SB_PARAMETER ERROR_SUPER_BASE + 1
+
+#define ERROR_SPARE_BASE 0xFFFF0060
+#define ERR_SP_PARAMETER ERROR_SPARE_BASE + 1
+
+#define ERROR_HPFSVOL_BASE 0xFFFF0070
+#define ERR_HV_PARAMETER ERROR_HPFSVOL_BASE + 1
+#define ERR_HV_BAD_SA ERROR_HPFSVOL_BASE + 2
+
+#define ERROR_DIRMAP_BASE 0xFFFF0080
+#define ERR_DM_PARAMETER ERROR_DIRMAP_BASE + 1
+#define ERR_DM_FULL ERROR_DIRMAP_BASE + 2
+
+#define ERROR_DIRBLK_BASE 0xFFFF0090
+#define ERR_DB_PARAMETER ERROR_DIRBLK_BASE + 1
+
+#define ERROR_HP_SUPER_AREA_BASE 0xFFFF00A0
+#define ERR_HPSA_PARAMETER ERROR_HP_SUPER_AREA_BASE + 1
+#define ERR_HPSA_NOT_READ ERROR_HP_SUPER_AREA_BASE + 2
+#define ERR_HPSA_BAD_SA ERROR_HP_SUPER_AREA_BASE + 3
+
+#define ERROR_CHKDSK_BASE 0xFFFF00B0
+#define ERR_CHKDSK_NOTSUPPORTED ERROR_CHKDSK_BASE + 1
+#define ERR_CHKDSK_UNEXPECTEDERR ERROR_CHKDSK_BASE + 2
+#define ERR_CHKDSK_BADPARM ERROR_CHKDSK_BASE + 3
+#define ERR_CHKDSK_INCOMPATPARM ERROR_CHKDSK_BASE + 4
+#define ERR_CHKDSK_INCOMPATDISK ERROR_CHKDSK_BASE + 5
+#define ERR_CHKDSK_BADVOLID ERROR_CHKDSK_BASE + 6
+#define ERR_CHKDSK_EXECFAIL ERROR_CHKDSK_BASE + 7
+#define ERR_CHKDSK_BADCMMFUNC ERROR_CHKDSK_BASE + 8
+#define ERR_CHKDSK_INVALIDMEDIA ERROR_CHKDSK_BASE + 9
+#define ERR_CHKDSK_BADOS ERROR_CHKDSK_BASE + 0xA
+#define ERR_CHKDSK_GENERALFAIL ERROR_CHKDSK_BASE + 0xB
+#define ERR_CHKDSK_INVALIDNAME ERROR_CHKDSK_BASE + 0xC
+#define ERR_CHKDSK_NOWRITEBOOT ERROR_CHKDSK_BASE + 0xD
+#define ERR_CHKDSK_BADLABEL ERROR_CHKDSK_BASE + 0xE
+#define ERR_CHKDSK_FATERR ERROR_CHKDSK_BASE + 0xF
+#define ERR_CHKDSK_DIRWRITE ERROR_CHKDSK_BASE + 0x10
+#define ERR_CHKDSK_DRIVELETTER ERROR_CHKDSK_BASE + 0x11
+#define ERR_CHKDSK_UNSUPP_PARMS ERROR_CHKDSK_BASE + 0x12
+#define ERR_CHKDSK_NODRIVESPEC ERROR_CHKDSK_BASE + 0x13
+#define ERR_CHKDSK_INVALID_FSTYPE ERROR_CHKDSK_BASE + 0x14
+#define ERR_CHKDSK_NO_FIX_SECTOR0 ERROR_CHKDSK_BASE + 0x15
+
+#define ERR_NOT_INIT 0xFFFF00D0
+#define ERR_NOT_READ 0xFFFF00E0
+
+#define ERROR_MEM_BASE 0xFFFF00F0
+#define ERR_CMEM_NO_MEM ERROR_MEM_BASE + 1
+#define ERR_HMEM_NO_MEM ERROR_MEM_BASE + 2
+
+#define ERRSTK_DEFAULT_SIZE 20
+typedef ULONG ERRCODE; // errco
+
+
+#if !defined( ERRSTACK_DEFN )
+#define ERRSTACK_DEFN
+
+// this has to be defined in the .exe and has to use this name.
+
+class ERRSTACK;
+typedef ERRSTACK* PERRSTACK;
+
+extern ERRSTACK *perrstk;
+
+
+class ERRSTACK {
+
+ public:
+
+ void push (ERRCODE errIn, CLASS_ID idIn)
+ { (void)(errIn); (void)(idIn); (void)(this); };
+
+};
+
+
+#define PUSH_ERR( x ) perrstk->push( x, QueryClassId() );
+
+#endif // !defined ERRSTACK_DEFN
+
+
+
+
+
+
+
+#if 0 // BUGBUG davegi fix
+
+
+/***************************************************************************\
+CLASS: ERROR
+
+PURPOSE: Class to hold an error code.
+
+INTERFACE: ERROR constructs and init error with class id and error code
+ SetErr Sets the error code
+ QueryErr returns current error code
+ SetId Set id used to identify class that had error.
+ QueryClassId returns current class id
+ SetMsg Sets pointer to message object
+ QueryMsg Returns pointer to message object
+ SetIdErrMsg Sets err, id and message at same time
+
+NOTES: Any error that is to be passed up the stack should be put into
+ an error object and put in the ERRSTK object. All references
+ to ERRSTK are through the ulib defined global perrstk. All
+ users of ERRSTK should declare:
+
+ #include "error.hxx";
+ extern ERRSTK * perrstk;
+
+ The ERROR object contains the error code, the class id (see
+ object.hxx) and an optional pointer to a MESSAGE object.
+
+ Error codes are defined with error.hxx. These are the error codes
+ specific to the utility objects. All error codes generated from
+ outside of OS/2 need to be mapped to this set of error codes.
+ Specifically the C runtime error codes will have to be mapped
+ to an error code defined in error.hxx. An error code returned
+ from an OS/2 call is put directly into the ERROR object. An
+ error code from the C runtime has to be mapped to some error
+ code defined in error.hxx.
+
+ The class id is defined in object.hxx. Each class has a unique
+ class id. This can be found be using the QueryClassId method on any
+ object. If the error does not occur within an object then use
+ ID_NOT_AN_OBJECT. This is a generic class id defined for this
+ purpose. If a more specific location is needed and the error
+ is not in an object then define a new class id substracting
+ from ID_BASE as shown in object.hxx with the ID_NOT_AN_OBJECT
+ example.
+
+ The optional pointer to a MESSAGE object can be used latter
+ to process the ERROR and recover context specific information
+ about the ERROR. There will need to be a message id defined
+ for the error.
+
+HISTORY: 4-1-90 stever
+
+KEYWORDS: ERROR CLASS_ID
+
+SEEALSO: ERRSTK
+\***************************************************************************/
+#if !defined (ERROR_DEFN)
+
+#define ERROR_DEFN
+
+class MESSAGE;
+
+class ERROR : public OBJECT { // err
+
+ private:
+
+ ERRCODE err;
+ CLASS_ID id;
+// const MESSAGE * pmsg;
+
+ public:
+ ERROR ();
+// ERROR (ERRCODE errIn, CLASS_ID idIn, const MESSAGE *pmsgIn = (MESSAGE *)NULL);
+ ~ERROR ();
+ ERROR & operator= (ERROR & );
+ BOOL SetErr (ERRCODE errIn) {return(err = errIn);}
+ ERRCODE QueryErr () {return(err);}
+ BOOL SetId (CLASS_ID idIn) {return(id = idIn); }
+ CLASS_ID QueryClassId () {return(id); }
+// ERROR * PutIdErrMsg (CLASS_ID idIn, ERRCODE errIn, const MESSAGE * pmsgIn = (const MESSAGE *)NULL) {id = idIn; pmsg = pmsgIn; err = errIn; return(this); }
+// const MESSAGE * PutMsg (MESSAGE * pmsgIn) { return(pmsg = pmsgIn); }
+// const MESSAGE * GetMsg () { return(pmsg); }
+
+#if defined (DEBUG)
+ BOOL print ();
+#endif
+
+};
+
+#if defined( DEBUG_STOP_PUSHERR )
+
+#define PUSH_ERR( x ) DebugPrintAbort( "PUSH_ERR called" );
+
+#else
+
+#define PUSH_ERR( x ) (void)*perrstk->push( x, QueryClassId() );
+
+#endif // DEBUG
+
+#endif // ERROR_DEFN
+
+/***************************************************************************\
+CLASS: ERRSTACK
+
+PURPOSE: Hold a stack of error objects
+
+INTERFACE: ERRSTACK creates an array of error obj. pointers
+ ~ERRSTACK deletes array of errors. (calls ~ERROR on each)
+ push push an error object onto the stack. There are
+ two signatures one for pointer to error objectg
+ the other for error code, class id and message
+ pop pop the top error object off the stack
+ QueryCount Query number of errors on the stack
+ QueryTop Query Top index to stack.
+ QuerySize Query size in pointer of stack
+ ClearStack Clear all error from stack (deletes error objects)
+
+
+NOTES: Each exe should declare with global scope an object of type
+ ERRSTK. If you include error.hxx a pointer called perrstk will
+ be declared. perrstk = NEW ERRSTK should be done at the start
+ of the program. The default size for the error stack will be
+ ERRSTK_DEFAULT_SIZE. If the error stack cannot be constructed the
+ the program should abort.
+
+ One slot is always reserved in the stack to hold an overflow
+ error. If ERRSTK_DEFAULT_SIZE stack is allocated then the
+ actual size of the stack is ERRSTK_DEFAULT_SIZE + 1. The overflow
+ error will also occur at index 0. Index ERRSTK_DEFAULT_SIZE - 1
+ is the bottom of the stack. Unless an overflow has occured the
+ stack index will not go below 1. Note that QuerySize will
+ return the original size passed in plus 1. QueryCountError will
+ include a stack overflow error.
+
+ The ERROR object passed to the stack is copied before it is
+ pushed. The caller is responsible for deleting the object.
+
+HISTORY: 3-6-90 stever
+
+KEYWORDS: ERRSTK
+
+SEEALSO: ERROR CLASS_ID
+\***************************************************************************/
+
+#if !defined (ERRSTK_DEFN)
+
+#define ERRSTK_DEFN
+
+class ERRSTACK : public OBJECT { // errstk
+
+ public:
+
+ ERRSTACK (ULONG cpoInitIn = ERRSTK_DEFAULT_SIZE, ULONG cpoIncIn = 0);
+ ~ERRSTACK ();
+ ERROR * push (const ERROR * );
+ ERROR * push (ERRCODE errIn, CLASS_ID idIn);
+ ERROR * pop ();
+ ULONG QueryCount () { return(ipoCur); }
+ ULONG QueryTop () { return(ipoCur); }
+ ULONG QuerySize () { return(cpoMax); }
+ ULONG ClearStack ();
+
+#ifdef DEBUG
+ ULONG print ();
+#endif
+
+ private:
+
+ ERROR * AllocError();
+ ULONG ipoCur; // index to top of stack
+ ULONG cpoMax; // index to bottom of stack
+ ULONG cpoInc; // bytes to add for each realloc
+ ULONG cpoInit; // initial alloc. (used by ClearStack
+ ERROR ** papo; // pointer to stack bottom
+
+};
+
+#endif // ERRSTK_DEFN
+
+#endif // BUGBUG davegi
diff --git a/private/utils/ulib/inc/file.hxx b/private/utils/ulib/inc/file.hxx
new file mode 100644
index 000000000..3d1f7ac76
--- /dev/null
+++ b/private/utils/ulib/inc/file.hxx
@@ -0,0 +1,127 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ file.hxx
+
+Abstract:
+
+ This module contains the declaration for the FSN_FILE class. FSN_FILE
+ is derived from the abstract FSNODE class. It offers an interface which
+ supports manipulation of the external (i.e. non data) portion of files.
+
+Author:
+
+ David J. Gilman (davegi) 09-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _FSN_FILE_ )
+
+#define _FSN_FILE_
+
+#include "fsnode.hxx"
+#include "filestrm.hxx"
+
+//
+// Error Codes from a copy
+//
+typedef enum _COPY_ERROR {
+ COPY_ERROR_ACCESS_DENIED = ERROR_ACCESS_DENIED,
+ COPY_ERROR_SHARE_VIOLATION = ERROR_SHARING_VIOLATION,
+ COPY_ERROR_NO_MEMORY = ERROR_NOT_ENOUGH_MEMORY,
+ COPY_ERROR_DISK_FULL = ERROR_DISK_FULL,
+ COPY_ERROR_INVALID_NAME = ERROR_INVALID_NAME
+} COPY_ERROR, *PCOPY_ERROR;
+
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( FSN_FILE );
+DECLARE_CLASS( FSN_FILTER );
+
+class FSN_FILE : public FSNODE {
+
+ friend FSN_FILTER;
+ friend SYSTEM;
+
+ public:
+
+ DECLARE_CAST_MEMBER_FUNCTION( FSN_FILE );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Copy (
+ IN OUT PPATH NewFile,
+ OUT PCOPY_ERROR ErrorCode DEFAULT NULL,
+ IN BOOLEAN OverwriteReadOnly DEFAULT FALSE,
+ IN BOOLEAN ResetReadOnly DEFAULT FALSE,
+ IN BOOLEAN Restartable DEFAULT FALSE,
+ IN LPPROGRESS_ROUTINE CallBack DEFAULT NULL,
+ IN VOID * Data DEFAULT NULL,
+ IN PBOOL Cancel DEFAULT NULL
+
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ DeleteFromDisk(
+ IN BOOLEAN Force DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ ULONG
+ QuerySize (
+ ) CONST;
+
+ ULIB_EXPORT
+ PFILE_STREAM
+ QueryStream (
+ IN STREAMACCESS Access
+ );
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( FSN_FILE );
+
+ private:
+
+};
+
+
+
+INLINE
+ULONG
+FSN_FILE::QuerySize (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the size of the file in bytes.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ ULONG - returns the file size
+
+--*/
+
+{
+ return( _FileData.nFileSizeLow );
+}
+
+#endif // _FSN_FILE_
diff --git a/private/utils/ulib/inc/filestrm.hxx b/private/utils/ulib/inc/filestrm.hxx
new file mode 100644
index 000000000..581571670
--- /dev/null
+++ b/private/utils/ulib/inc/filestrm.hxx
@@ -0,0 +1,208 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ filestrm.hxx
+
+Abstract:
+
+ This module contains the declaration for the FILE_STREAM class.
+ The FILE_STREAM is an abstract class derived from BUFFER_STREAM,
+ that models a file as a stream of data.
+ A FILE_STREAM class has the concept of a pointer (file poiter),
+ and it provides some methods that allow operations on this pointer,
+ such as:
+
+ .move file pointer to a particular position;
+ .read/write byte in a particular position;
+ .query the position of the file pointer;
+
+ The only way that a client has to create a FILE_STREAM is through
+ QueryStream() (a method in FSN_FILE).
+ FILE_STREAM can be has a method for initialization with two different
+ signatures. In one case, a PFSN_FILE is passed as parameter. This
+ initialization is used by QueryStream().
+ The other signature allows that a HANDLE is passed as parameter.
+ This initialization is used by GetStandardStream() during the
+ initialization of ulib.
+
+
+
+Author:
+
+ Jaime Sasson (jaimes) 21-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _FILE_STREAM_ )
+
+#define _FILE_STREAM_
+
+#include "bufstrm.hxx"
+
+
+enum SEEKORIGIN {
+ STREAM_BEGINNING,
+ STREAM_CURRENT,
+ STREAM_END
+ };
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( FILE_STREAM );
+DECLARE_CLASS( FSN_FILE );
+
+
+class FILE_STREAM : public BUFFER_STREAM {
+
+ friend class FSN_FILE;
+ friend class COMM_DEVICE;
+ friend PSTREAM GetStandardStream( HANDLE, STREAMACCESS );
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CAST_MEMBER_FUNCTION( FILE_STREAM );
+
+ VIRTUAL
+ ~FILE_STREAM(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ MovePointerPosition(
+ IN LONG Position,
+ IN SEEKORIGIN Origin
+ );
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ QueryPointerPosition(
+ OUT PULONG Position
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Read(
+ OUT PBYTE Buffer,
+ IN ULONG NumberOfBytesToRead,
+ OUT PULONG NumberOfBytesRead
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ReadAt(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToRead,
+ IN LONG Position,
+ IN SEEKORIGIN Origin,
+ OUT PULONG BytesRead
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Write(
+ IN PCBYTE Buffer,
+ IN ULONG BytesToWrite,
+ OUT PULONG BytesWritten
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ WriteAt(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToWrite,
+ IN LONG Position,
+ IN SEEKORIGIN Origin,
+ OUT PULONG BytesWritten
+ );
+
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( FILE_STREAM );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ PCFSN_FILE File,
+ STREAMACCESS Access
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ HANDLE Handle,
+ STREAMACCESS Access
+ );
+
+ VIRTUAL
+ BOOLEAN
+ AdvanceBufferPointer(
+ IN ULONG NumberOfBytes
+ );
+
+ VIRTUAL
+ BOOLEAN
+ EndOfFile(
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ FillBuffer(
+ IN PBYTE Buffer,
+ IN ULONG BufferSize,
+ OUT PULONG BytesRead
+ );
+
+ NONVIRTUAL
+ PCBYTE
+ GetBuffer(
+ PULONG BytesInBuffer
+ );
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST;
+
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+
+ HANDLE _FileHandle;
+ HANDLE _FileMappingHandle;
+ STREAMACCESS _Access;
+ BOOLEAN _EndOfFile;
+ BOOLEAN _ShouldCloseHandle;
+ PBYTE _FileBaseAddress;
+ ULONG _FileSize;
+ PBYTE _CurrentByte;
+ BOOLEAN _EmptyFile;
+ BOOLEAN _MemoryMappedFile;
+};
+
+
+
+#endif // _FILE_STREAM_
diff --git a/private/utils/ulib/inc/filter.hxx b/private/utils/ulib/inc/filter.hxx
new file mode 100644
index 000000000..9519c475b
--- /dev/null
+++ b/private/utils/ulib/inc/filter.hxx
@@ -0,0 +1,274 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ filter.hxx
+
+Abstract:
+
+ This module contains the declaration for the FSN_FILTER class. FSN_FILTER
+ is a concrete class derived from OBJECT. It is used to maintain the state
+ information needed to determine if a file meets the criteria
+ pre-established in the FSN_FILTER.
+
+Author:
+
+ David J. Gilman (davegi) 04-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+ Here is how the filter works:
+
+ 1.- You initialize the filter (no arguments). This sets the filter
+ to its default matching criteria, which is "everything matches".
+
+ 2.- You will usually want to set your desired matching criteria. There
+ are 3 parameters that you can set:
+
+ a.- The file name - here you specify a file name (possibly with
+ wild cards ).
+
+ b.- The time criteria - you have to use the SetTimeInfo() method
+ once for every type of time that you want to filter. For the
+ SetTimeInfo() method you have to specify:
+
+ - The time
+ - The type of time that you want to filter (e.g
+ modification time, creation time etc. ).
+ - The matching criteria, which is a combination of:
+
+ TIME_BEFORE - Match if file time before this time
+ TIME_AT - Match if file time is this time
+ TIME_AFTER - Match if file time after this time
+
+ for example, if you want files that have been modified on or
+ after a particular time, you do:
+
+ SetTimeInfo( Time, FSN_TIME_MODIFIED, (TIME_AT | TIME_AFTER ) );
+
+ c.- The attributes - here you can provide 3 masks, called the
+ "All" mask, the "Any" mask, and the "None" mask. The meaning of
+ these mask is:
+
+ ALL: In order to match, a file must contain all the attributes
+ specified in this mask set.
+
+ ANY: In order to match, a file must contain any of the attributes
+ specified in this mask set.
+
+ NONE: In order to match, a file must contain all the attributes
+ specified in this mask NOT set.
+
+ An attribute may be present in at most ONE of the masks. An
+ attribute may be present in none of the masks
+
+
+
+ Here are some examples of the queries that we might want and what
+ the masks should be set to. The attributes are represented by:
+
+ D (directory) H (hidden) S (system) A (archived)
+ R (read-only)
+
+
+ ALL ANY NONE
+ ----- ----- -----
+
+ All files (not directories) that are ---A- ----- DHS--
+ not hidden or system, and that are
+ archived (this is used by XCopy)
+
+ All directories (used by Tree) D---- ----- -----
+
+
+ All files that are read-only or ----- -H--R D----
+ hidden
+
+
+ All hidden files that are read-only -H--- --S-R D----
+ or system
+
+
+
+
+--*/
+
+#if ! defined( _FSN_FILTER_ )
+
+#define _FSN_FILTER_
+
+#include "fsnode.hxx"
+#include "wstring.hxx"
+#include "timeinfo.hxx"
+
+//
+// Forward reference
+//
+
+DECLARE_CLASS( FSN_FILTER );
+DECLARE_CLASS( FSN_DIRECTORY );
+
+#define TIME_BEFORE 1
+#define TIME_AT 2
+#define TIME_AFTER 4
+
+class FSN_FILTER : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( FSN_FILTER );
+
+ DECLARE_CAST_MEMBER_FUNCTION( FSN_FILTER );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~FSN_FILTER (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DoesNodeMatch (
+ IN PFSNODE Node
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ GetFileName (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetFileName (
+ IN PCSTR FileName
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetFileName (
+ IN PCWSTRING FileName
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetAttributes (
+ IN FSN_ATTRIBUTE All DEFAULT (FSN_ATTRIBUTE)0,
+ IN FSN_ATTRIBUTE Any DEFAULT (FSN_ATTRIBUTE)0,
+ IN FSN_ATTRIBUTE None DEFAULT (FSN_ATTRIBUTE)0
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetTimeInfo (
+ IN PCTIMEINFO TimeInfo,
+ IN FSN_TIME TimeInfoType DEFAULT FSN_TIME_MODIFIED,
+ IN USHORT TimeInfoMatch DEFAULT TIME_AT
+ );
+
+ NONVIRTUAL
+ PFSNODE
+ QueryFilteredFsnode (
+ IN PCFSN_DIRECTORY ParentDirectory,
+ IN PWIN32_FIND_DATA FindData
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ FilterAttributes (
+ IN FSN_ATTRIBUTE Attributes
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ FilterFileName (
+ IN PCWSTRING FileName
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ FilterTimeInfo (
+ IN PFILETIME CreationTime,
+ IN PFILETIME LastAccessTime,
+ IN PFILETIME LastWriteTime
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ PatternMatch (
+ IN PCWSTRING FileName,
+ IN CHNUM FileNamePosition,
+ IN PCWSTRING FindName,
+ IN CHNUM FindNamePosition
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ TimeInfoMatch (
+ IN PTIMEINFO TimeInfo,
+ IN PFILETIME FileTime,
+ IN USHORT Criteria
+ );
+
+ FSN_ATTRIBUTE _AttributesAll;
+ FSN_ATTRIBUTE _AttributesAny;
+ FSN_ATTRIBUTE _AttributesNone;
+ BOOLEAN _AttributesSet;
+
+ DSTRING _FileName;
+ BOOLEAN _FileNameSet;
+
+ TIMEINFO _TimeInfo[3];
+ USHORT _TimeInfoMatch[3];
+ BOOLEAN _TimeInfoSet[3];
+};
+
+INLINE
+PWSTRING
+FSN_FILTER::GetFileName (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Gets a pointer to the filter's filename
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to the filter's filename
+
+--*/
+
+{
+ return &(((PFSN_FILTER) this)->_FileName);
+}
+
+#endif // _FSN_FILTER__
diff --git a/private/utils/ulib/inc/findleak.hxx b/private/utils/ulib/inc/findleak.hxx
new file mode 100644
index 000000000..34ed5010f
--- /dev/null
+++ b/private/utils/ulib/inc/findleak.hxx
@@ -0,0 +1,47 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ findleak.hxx
+
+Abstract:
+
+Author:
+
+ David J. Gilman (davegi) 02-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _FINDLEAK_ )
+
+#define _FINDLEAK_
+
+DEFINE_CLASS_POINTER_AND_REFERENCE_TYPES( FINDLEAK );
+
+class FINDLEAK : public PROGRAM {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( FINDLEAK );
+
+ VIRTUAL
+ BOOLEAN
+ Initialize (
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+};
+
+#endif // _FINDLEAK_
diff --git a/private/utils/ulib/inc/fsnode.hxx b/private/utils/ulib/inc/fsnode.hxx
new file mode 100644
index 000000000..fcca4f349
--- /dev/null
+++ b/private/utils/ulib/inc/fsnode.hxx
@@ -0,0 +1,1018 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ fsnode.hxx
+
+Abstract:
+
+ This module contains the declaration for the FSNODE class. FSNODE stands
+ for File System NODE and is an abstract class for all user visible
+ objects that exist in a file system (e.g. files, directories).
+
+Author:
+
+ David J. Gilman (davegi) 09-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+ Do not confuse this class or it's derived classes with the IFS class
+ sub-hierarchy. FSNODE related classes are user visible classes. They
+ are not intended to be used for low level file system tasks such as
+ format or chkdsk. FSNODE classes are as file system independent as the
+ underlying system allows.
+
+--*/
+
+#if ! defined( _FSNODE_ )
+
+#define _FSNODE_
+
+#include "path.hxx"
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( ARRAY );
+DECLARE_CLASS( FSN_DIRECTORY );
+DECLARE_CLASS( FSNODE );
+DECLARE_CLASS( TIMEINFO );
+DECLARE_CLASS( WSTRING );
+
+
+//
+// Extend the set of system defined FILE_ATTRIBUTEs to include
+//
+// - all files (no directories)
+// - all file and directories
+//
+
+#define FILE_ATTRIBUTE_FILES ( FILE_ATTRIBUTE_ARCHIVE | \
+ FILE_ATTRIBUTE_HIDDEN | \
+ FILE_ATTRIBUTE_NORMAL | \
+ FILE_ATTRIBUTE_READONLY | \
+ FILE_ATTRIBUTE_COMPRESSED | \
+ FILE_ATTRIBUTE_SYSTEM )
+
+#define FILE_ATTRIBUTE_ALL ( FILE_ATTRIBUTE_FILES | \
+ FILE_ATTRIBUTE_DIRECTORY )
+
+typedef ULONG FSN_ATTRIBUTE;
+
+#define FSN_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_ARCHIVE
+#define FSN_ATTRIBUTE_DIRECTORY FILE_ATTRIBUTE_DIRECTORY
+#define FSN_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_HIDDEN
+#define FSN_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_NORMAL
+#define FSN_ATTRIBUTE_READONLY FILE_ATTRIBUTE_READONLY
+#define FSN_ATTRIBUTE_COMPRESSED FILE_ATTRIBUTE_COMPRESSED
+#define FSN_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_SYSTEM
+#define FSN_ATTRIBUTE_FILES FILE_ATTRIBUTE_FILES
+#define FSN_ATTRIBUTE_ALL FILE_ATTRIBUTE_ALL
+
+//
+// FSNODE time & date types
+//
+
+enum FSN_TIME {
+ FSN_TIME_MODIFIED = 0,
+ FSN_TIME_CREATED = 1,
+ FSN_TIME_ACCESSED = 2
+};
+
+class FSNODE : public OBJECT {
+
+ friend class FSN_FILTER;
+
+ public:
+
+ VIRTUAL
+ ~FSNODE (
+ );
+
+ NONVIRTUAL
+ PCPATH
+ GetPath (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsArchived (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsDirectory (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsHidden (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsNormal (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsReadOnly (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsSystem (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ MakeArchived (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ MakeHidden (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ MakeNormal (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ MakeReadOnly (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ MakeSystem (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ QueryBase (
+ ) CONST;
+
+ NONVIRTUAL
+ PWSTRING
+ QueryName (
+ ) CONST;
+
+ VIRTUAL
+ PFSN_DIRECTORY
+ QueryParentDirectory (
+ ) CONST;
+
+ VIRTUAL
+ PTIMEINFO
+ QueryTimeInfo (
+ IN FSN_TIME TimeInfoType DEFAULT FSN_TIME_MODIFIED
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ Rename(
+ IN PCPATH NewName
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ResetArchivedAttribute (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ResetHiddenAttribute (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ResetReadOnlyAttribute (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ResetSystemAttribute (
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetTimeInfo (
+ IN PCTIMEINFO TimeInfo,
+ IN FSN_TIME TimeInfoType DEFAULT FSN_TIME_MODIFIED
+ );
+
+ VIRTUAL
+ BOOLEAN
+ DeleteFromDisk(
+ IN BOOLEAN Force DEFAULT FALSE
+ );
+
+ VIRTUAL
+ BOOLEAN
+ UpdateFsNode(
+ );
+
+ NONVIRTUAL
+ FSN_ATTRIBUTE
+ QueryAttributes(
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ SetAttributes (
+ IN FSN_ATTRIBUTE Attributes,
+ OUT LPDWORD Win32Error DEFAULT NULL
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ UseAlternateName(
+ );
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( FSNODE );
+
+ VIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PCWSTR PathName,
+ IN PCFSN_DIRECTORY ParentDirectory,
+ IN PWIN32_FIND_DATA FileData
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Initialize (
+ IN PCWSTRING PathName,
+ IN PWIN32_FIND_DATA FileData
+ );
+
+ NONVIRTUAL
+ PFILETIME
+ GetCreationTime(
+ );
+
+ NONVIRTUAL
+ PFILETIME
+ GetLastAccessTime(
+ );
+
+ NONVIRTUAL
+ PFILETIME
+ GetLastWriteTime(
+ );
+
+ PATH _Path;
+ WIN32_FIND_DATAW _FileData;
+
+ private:
+
+};
+
+INLINE
+PCPATH
+FSNODE::GetPath (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the contained PATH object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PCPATH - returns a constant pointer to the contained PATH object
+
+--*/
+
+{
+ return( &_Path );
+}
+
+INLINE
+PFILETIME
+FSNODE::GetCreationTime(
+ )
+
+
+/*++
+
+Routine Description:
+
+ Returns pointer to creation time.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PFILETIME - pointer to creation time
+
+--*/
+
+{
+ return( &_FileData.ftCreationTime );
+}
+
+INLINE
+PFILETIME
+FSNODE::GetLastAccessTime(
+ )
+
+
+/*++
+
+Routine Description:
+
+ Returns pointer to last access time.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PFILETIME - pointer to last access time
+
+--*/
+
+{
+ return( &_FileData.ftLastAccessTime );
+}
+
+INLINE
+PFILETIME
+FSNODE::GetLastWriteTime(
+ )
+
+
+/*++
+
+Routine Description:
+
+ Returns pointer to last write time.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PFILETIME - pointer to last write time
+
+--*/
+
+{
+ return( &_FileData.ftLastWriteTime );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsArchived (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's archived attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's archived attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsDirectory (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's directory attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's directory attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsHidden (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's hidden attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's hidden attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsNormal (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's normal attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's normal attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_NORMAL ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsReadOnly (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's readonly attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's readonly attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_READONLY ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::IsSystem (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this FSNODE's system attribute is set.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this FSNODE's system attribute is set.
+
+--*/
+
+{
+ return( ( _FileData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM ) != 0 );
+}
+
+INLINE
+BOOLEAN
+FSNODE::MakeArchived (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' archived.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's archived attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes | FILE_ATTRIBUTE_ARCHIVE )) {
+
+ _FileData.dwFileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::MakeHidden (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' hidden.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's hidden attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes | FILE_ATTRIBUTE_HIDDEN )) {
+
+ _FileData.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::MakeNormal (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' normal.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of resetting all the file's resettable
+ attributes.
+
+Note:
+
+ Making a 'file' normal means resetting all but the
+ FILE_ATTRIBUTE_DIRECTORY attributes.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ FILE_ATTRIBUTE_NORMAL )) {
+
+ _FileData.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::MakeReadOnly (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' read-only.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's read-only attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes | FILE_ATTRIBUTE_READONLY )) {
+
+ _FileData.dwFileAttributes |= FILE_ATTRIBUTE_READONLY;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::MakeSystem (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' a system file.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's system attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes | FILE_ATTRIBUTE_SYSTEM )) {
+
+ _FileData.dwFileAttributes |= FILE_ATTRIBUTE_SYSTEM;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+PWSTRING
+FSNODE::QueryBase (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the base name maintained by the contained PATH object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PWSTRING - Returns a pointer to the base name.
+
+--*/
+
+{
+ return( ((PFSNODE) this)->_Path.QueryBase( ));
+}
+
+INLINE
+FSN_ATTRIBUTE
+FSNODE::QueryAttributes (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the node's attributes
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ FSN_ATTRIBUTE - The attributes
+
+--*/
+
+{
+ return( (FSN_ATTRIBUTE)_FileData.dwFileAttributes );
+}
+
+INLINE
+PWSTRING
+FSNODE::QueryName (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the name maintained by the contained PATH object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PWSTRING - Returns a pointer to the name.
+
+--*/
+
+{
+ return( ((PFSNODE) this)->_Path.QueryName( ));
+}
+
+
+
+INLINE
+BOOLEAN
+FSNODE::ResetArchivedAttribute (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' non archived.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of resetting the file's archived attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes & ~FILE_ATTRIBUTE_ARCHIVE )) {
+
+ _FileData.dwFileAttributes &= ~FILE_ATTRIBUTE_ARCHIVE;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::ResetHiddenAttribute (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' non-hidden.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of resetting the file's hidden attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes & ~FILE_ATTRIBUTE_HIDDEN )) {
+
+ _FileData.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+
+
+INLINE
+BOOLEAN
+FSNODE::ResetReadOnlyAttribute (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' non-read-only.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of resetting the file's read-only attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY )) {
+
+ _FileData.dwFileAttributes &= ~FILE_ATTRIBUTE_READONLY;
+ return( TRUE );
+ } else {
+
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+INLINE
+BOOLEAN
+FSNODE::ResetSystemAttribute (
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Make the underlying 'file' a non-system file.
+
+Arguments:
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's system attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ _FileData.dwFileAttributes & ~FILE_ATTRIBUTE_SYSTEM )) {
+
+ _FileData.dwFileAttributes &= ~FILE_ATTRIBUTE_SYSTEM;
+ return( TRUE );
+ } else {
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+
+INLINE
+BOOLEAN
+FSNODE::SetAttributes (
+ IN FSN_ATTRIBUTE Attributes,
+ OUT LPDWORD Win32Error
+ )
+
+/*++
+
+Routine Description:
+
+ Set the attributes of the underlying 'file'.
+ (This method was added to improve performance of attrib.exe).
+
+Arguments:
+
+ Attributes - New attributes for the file.
+
+ Win32Error - Optional parameter that will contain a Win32 error code
+ if the method is unable to change attribute.
+
+Return Value:
+
+ BOOLEAN - Returns the result of setting the file's system attribute.
+
+--*/
+
+{
+ if( SetFileAttributesW(( LPWSTR ) _FileData.cFileName,
+ (_FileData.dwFileAttributes & ~FILE_ATTRIBUTE_FILES) | Attributes )) {
+
+ _FileData.dwFileAttributes &= ~FILE_ATTRIBUTE_FILES;
+ _FileData.dwFileAttributes |= Attributes;
+ return( TRUE );
+ } else {
+ if( Win32Error != NULL ) {
+ *Win32Error = GetLastError();
+ }
+ return( FALSE );
+ }
+}
+
+
+
+
+
+#endif // _FSNODE_
diff --git a/private/utils/ulib/inc/hmem.hxx b/private/utils/ulib/inc/hmem.hxx
new file mode 100644
index 000000000..294bf617d
--- /dev/null
+++ b/private/utils/ulib/inc/hmem.hxx
@@ -0,0 +1,152 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ hmem.hxx
+
+Abstract:
+
+ The class HMEM is an implementation of the class MEM which uses the
+ memory resources of the heap.
+
+ After the first call to Acquire that succeeds, all successive calls
+ will return the same memory that was returned by the first call
+ provided that the size requested is within the bounds of the first call.
+ The common buffer which was created upon the first successful call to
+ Acquire will be available along with its size by calling GetBuf and
+ QuerySize.
+
+ Calling Destroy will put the object back in its initial state thus
+ invalidating any pointers to its memory and enabling future calls
+ to Acquire to succeed regardless of the size specicified.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 26-Nov-90
+
+--*/
+
+#if !defined(HMEM_DEFN)
+
+#define HMEM_DEFN
+
+#include "mem.hxx"
+
+DECLARE_CLASS( HMEM );
+
+
+class HMEM : public MEM {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( HMEM );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~HMEM(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PVOID
+ Acquire(
+ IN ULONG Size,
+ IN ULONG AlignmentMask DEFAULT 0
+ );
+
+ NONVIRTUAL
+ PVOID
+ GetBuf(
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QuerySize(
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Resize(
+ IN ULONG NewSize,
+ IN ULONG AlignmentMask DEFAULT 0
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+ ULONG _size;
+ PVOID _real_buf;
+ PVOID _buf;
+
+};
+
+
+INLINE
+PVOID
+HMEM::GetBuf(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the memory that was previously 'Acquired'.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ A pointer to the beginning of the memory buffer.
+
+--*/
+{
+ return _buf;
+}
+
+
+INLINE
+ULONG
+HMEM::QuerySize(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the size of the memory that was previously
+ 'Acquired'.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The size of the memory returned by 'GetBuf'.
+
+--*/
+{
+ return _size;
+}
+
+
+#endif // HMEM_DEFN
diff --git a/private/utils/ulib/inc/ifsentry.hxx b/private/utils/ulib/inc/ifsentry.hxx
new file mode 100644
index 000000000..14c57acd9
--- /dev/null
+++ b/private/utils/ulib/inc/ifsentry.hxx
@@ -0,0 +1,93 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ifsentry.hxx
+
+Abstract:
+
+ Contains prototypes for entry points to the IFS
+ utility DLLs.
+
+
+Author:
+
+ Bill McJohn (billmc) 04-June-1991
+
+Environment:
+
+ User Mode
+
+--*/
+
+
+#if !defined ( _IFS_ENTRY_ )
+
+#define _IFS_ENTRY_
+
+#if defined( _AUTOCHECK_ ) && !defined( _SETUP_LOADER_ )
+#define FAR
+#define APIENTRY
+#endif // _AUTOCHECK_ || _SETUP_LOADER_
+
+typedef BOOLEAN(FAR APIENTRY * CHKDSK_FN)( PCWSTRING DriveName,
+ PMESSAGE Message,
+ BOOLEAN Fix,
+ BOOLEAN Verbose,
+ BOOLEAN,
+ BOOLEAN Recover,
+ PPATH,
+ BOOLEAN Extend,
+ BOOLEAN ResizeLogFile,
+ ULONG LogFileSize,
+ PULONG ExitStatus);
+
+typedef BOOLEAN(FAR APIENTRY * FORMAT_FN)( PCWSTRING,
+ PMESSAGE,
+ BOOLEAN,
+ MEDIA_TYPE,
+ PCWSTRING,
+ ULONG );
+
+
+typedef BOOLEAN(FAR APIENTRY * RECOVER_FN)( PPATH, PMESSAGE );
+
+typedef BOOLEAN (FAR APIENTRY * EXTEND_FN)(PCWSTRING, PMESSAGE, BOOLEAN Verify);
+
+//
+// Convert status code
+//
+typedef enum _CONVERT_STATUS {
+
+ CONVERT_STATUS_CONVERTED,
+ CONVERT_STATUS_INVALID_FILESYSTEM,
+ CONVERT_STATUS_CONVERSION_NOT_AVAILABLE,
+ CONVERT_STATUS_CANNOT_LOCK_DRIVE,
+ CONVERT_STATUS_ERROR,
+ CONVERT_STATUS_INSUFFICIENT_SPACE
+
+} CONVERT_STATUS, *PCONVERT_STATUS;
+
+
+typedef BOOLEAN(FAR APIENTRY * CONVERT_FN)( PCWSTRING,
+ PCWSTRING,
+ PMESSAGE,
+ BOOLEAN,
+ BOOLEAN,
+ PCONVERT_STATUS );
+
+typedef BOOLEAN (FAR APIENTRY * CHECKSPACE_FN)(
+ PCWSTRING,
+ PCWSTRING,
+ PMESSAGE,
+ BOOLEAN,
+ BOOLEAN,
+ BOOLEAN );
+
+typedef BOOLEAN(FAR APIENTRY * NAMETABLE_FN)( PCWSTRING,
+ PCWSTRING,
+ PMESSAGE );
+
+#endif // _IFS_ENTRY_
diff --git a/private/utils/ulib/inc/ifsserv.hxx b/private/utils/ulib/inc/ifsserv.hxx
new file mode 100644
index 000000000..7ae523505
--- /dev/null
+++ b/private/utils/ulib/inc/ifsserv.hxx
@@ -0,0 +1,109 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ifsentry.hxx
+
+Abstract:
+
+ Contains prototypes for entry points to the IFS
+ utility DLLs.
+
+
+Author:
+
+ Bill McJohn (billmc) 04-June-1991
+
+Environment:
+
+ User Mode
+
+--*/
+
+
+#if !defined ( _IFS_ENTRY_ )
+
+#define _IFS_ENTRY_
+
+#if defined( _AUTOCHECK_ ) && !defined( _SETUP_LOADER_ )
+#define FAR
+#define APIENTRY
+#endif // _AUTOCHECK_ || _SETUP_LOADER_
+
+extern "C"
+BOOLEAN
+FAR APIENTRY
+Chkdsk(
+ IN PCWSTRING NtDriveName,
+ IN OUT PMESSAGE Message,
+ IN BOOLEAN Fix,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN OnlyIfDirty,
+ IN BOOLEAN Recover,
+ IN PPATH PathToCheck,
+ IN BOOLEAN Extend,
+ IN BOOLEAN ResizeLogFile,
+ IN ULONG LogFilesize,
+ OUT PULONG ExitStatus
+ );
+
+extern "C"
+BOOLEAN
+FAR APIENTRY
+Format(
+ IN PCWSTRING NtDriveName,
+ IN OUT PMESSAGE Message,
+ IN BOOLEAN Quick,
+ IN MEDIA_TYPE MediaType,
+ IN PCWSTRING LabelString,
+ IN ULONG ClusterSize
+ );
+
+extern "C"
+BOOLEAN
+FAR APIENTRY
+Recover(
+ IN PPATH RecFilePath,
+ IN OUT PMESSAGE Message
+ );
+
+extern "C"
+BOOLEAN
+FAR APIENTRY
+Extend(
+ IN PCWSTRING NtDriveName,
+ IN OUT PMESSAGE Message,
+ IN BOOLEAN Verify
+ );
+
+
+//
+// Convert status code
+//
+typedef enum _CONVERT_STATUS {
+
+ CONVERT_STATUS_CONVERTED,
+ CONVERT_STATUS_INVALID_FILESYSTEM,
+ CONVERT_STATUS_CONVERSION_NOT_AVAILABLE,
+ CONVERT_STATUS_CANNOT_LOCK_DRIVE,
+ CONVERT_STATUS_ERROR,
+ CONVERT_STATUS_INSUFFICIENT_SPACE
+
+} CONVERT_STATUS, *PCONVERT_STATUS;
+
+extern "C"
+BOOLEAN
+FAR APIENTRY
+Convert(
+ IN PCWSTRING NtDriveName,
+ IN PCWSTRING FsName,
+ IN OUT PMESSAGE Message,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN Pause,
+ OUT PCONVERT_STATUS Status
+ );
+
+
+#endif // _IFS_ENTRY_
diff --git a/private/utils/ulib/inc/iterator.hxx b/private/utils/ulib/inc/iterator.hxx
new file mode 100644
index 000000000..3ea89ae8a
--- /dev/null
+++ b/private/utils/ulib/inc/iterator.hxx
@@ -0,0 +1,78 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ iterator.hxx
+
+Abstract:
+
+ This module contains the declaration for the abstract ITERATOR class.
+ ITERATORS are used to iterate over a CONTAINER allowing for multiple,
+ simultaneous readers. ITERATORs maintain the currency needed to perform
+ an iteration. This includes the current OBJECT in the CONTAINER and the
+ currency needed to get the next or previous OBJECT. ITERATORs also
+ provide the capability of wrapping when the end or begin of the container
+ is reached.
+
+Author:
+
+ David J. Gilman (davegi) 29-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _ITERATOR_ )
+
+#define _ITERATOR_
+
+DECLARE_CLASS( ITERATOR );
+
+
+class ITERATOR : public OBJECT {
+
+ public:
+
+ VIRTUAL
+ ~ITERATOR(
+ );
+
+ VIRTUAL
+ POBJECT
+ FindNext(
+ IN PCOBJECT Key
+ );
+
+ VIRTUAL
+ POBJECT
+ GetCurrent(
+ ) PURE;
+
+ VIRTUAL
+ POBJECT
+ GetNext(
+ ) PURE;
+
+ VIRTUAL
+ POBJECT
+ GetPrevious(
+ ) PURE;
+
+ VIRTUAL
+ VOID
+ Reset(
+ ) PURE;
+
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( ITERATOR );
+
+};
+
+
+#endif // _ITERATOR_
diff --git a/private/utils/ulib/inc/keyboard.hxx b/private/utils/ulib/inc/keyboard.hxx
new file mode 100644
index 000000000..f605b3198
--- /dev/null
+++ b/private/utils/ulib/inc/keyboard.hxx
@@ -0,0 +1,201 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ keyboard.hxx
+
+Abstract:
+
+ This module contains the declaration for the KEYBOARD class.
+ The KEYBOARD class is a derived from BUFFER_STREAM that provides
+ methods to access the keyboard as a stream of bytes with read-only
+ access.
+ It also provides some methods that set/reset the keyboard mode.
+
+
+Author:
+
+ Jaime Sasson (jaimes) 21-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _KEYBOARD_ )
+
+#define _KEYBOARD_
+
+#include "bufstrm.hxx"
+
+
+
+DECLARE_CLASS( KEYBOARD );
+
+class KEYBOARD : public BUFFER_STREAM {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( KEYBOARD );
+
+ ULIB_EXPORT
+ DECLARE_CAST_MEMBER_FUNCTION( KEYBOARD );
+
+
+ NONVIRTUAL
+ ~KEYBOARD (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN BOOLEAN LineMode DEFAULT TRUE,
+ IN BOOLEAN EchoMode DEFAULT TRUE
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ DisableBreakHandling (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ DisableEchoMode(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DisableLineMode(
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ EnableBreakHandling (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ EnableEchoMode(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ EnableLineMode(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ EndOfFile(
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ FillBuffer(
+ IN PBYTE Buffer,
+ IN ULONG BufferSize,
+ OUT PULONG BytesRead
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Flush(
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ GotABreak (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ IsEchoModeEnabled(
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsKeyAvailable(
+ OUT PBOOLEAN Available
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsLineModeEnabled(
+ ) CONST;
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QueryDelay (
+ ) CONST;
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QuerySpeed (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ SetDelay (
+ IN ULONG Delay
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ SetSpeed (
+ IN ULONG Speed
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ CONST
+ PBOOL
+ GetPFlagBreak (
+ VOID
+ ) CONST;
+
+ private:
+
+ HANDLE _KeyboardHandle;
+ ULONG _PreviousMode;
+ BOOLEAN _FlagCtrlZ;
+ STATIC BOOL _FlagBreak;
+
+ NONVIRTUAL
+ BOOLEAN
+ CheckForAsciiKey(
+ IN PINPUT_RECORD InputRecord,
+ IN ULONG NumberOfInputRecords
+ ) CONST;
+
+ STATIC
+ BOOL
+ BreakHandler (
+ IN ULONG CtrlType
+ );
+
+};
+
+#endif // _KEYBOARD_
diff --git a/private/utils/ulib/inc/list.hxx b/private/utils/ulib/inc/list.hxx
new file mode 100644
index 000000000..da5932343
--- /dev/null
+++ b/private/utils/ulib/inc/list.hxx
@@ -0,0 +1,115 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ list.hxx
+
+Abstract:
+
+ This class is an implementation of the SEQUENTIAL_CONTAINER
+ protocol. The specific implementation is that of a doubly
+ linked list.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 22-Oct-91
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if !defined( _LIST_DEFN_ )
+
+#define _LIST_DEFN_
+
+#include "seqcnt.hxx"
+#include "membmgr.hxx"
+
+
+struct OBJECT_LIST_NODE {
+ OBJECT_LIST_NODE* next;
+ OBJECT_LIST_NODE* prev;
+ POBJECT data;
+};
+
+DEFINE_POINTER_AND_REFERENCE_TYPES( OBJECT_LIST_NODE );
+
+DECLARE_CLASS( LIST );
+
+class LIST : public SEQUENTIAL_CONTAINER {
+
+ FRIEND class LIST_ITERATOR;
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( LIST );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~LIST(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ );
+
+ VIRTUAL
+ ULONG
+ QueryMemberCount(
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Put(
+ IN OUT POBJECT Member
+ );
+
+ VIRTUAL
+ POBJECT
+ Remove(
+ IN OUT PITERATOR Position
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PITERATOR
+ QueryIterator(
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Insert(
+ IN OUT POBJECT Member,
+ IN OUT PITERATOR Position
+ );
+
+ private:
+
+ POBJECT_LIST_NODE _head;
+ POBJECT_LIST_NODE _tail;
+ ULONG _count;
+ MEM_BLOCK_MGR _mem_block_mgr;
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+};
+
+
+#endif // _LIST_DEFN_
diff --git a/private/utils/ulib/inc/listit.hxx b/private/utils/ulib/inc/listit.hxx
new file mode 100644
index 000000000..0dfbbac59
--- /dev/null
+++ b/private/utils/ulib/inc/listit.hxx
@@ -0,0 +1,118 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ listit.hxx
+
+Abstract:
+
+ This is an implementation of iterator for LIST.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 24-Oct-91
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _LIST_ITERATOR_ )
+
+#define _LIST_ITERATOR_
+
+#include "iterator.hxx"
+#include "list.hxx"
+
+DECLARE_CLASS( LIST_ITERATOR );
+
+class LIST_ITERATOR : public ITERATOR {
+
+ FRIEND class LIST;
+
+ public:
+
+ DECLARE_CONSTRUCTOR( LIST_ITERATOR );
+
+ DECLARE_CAST_MEMBER_FUNCTION( LIST_ITERATOR );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN PCLIST List
+ );
+
+ VIRTUAL
+ VOID
+ Reset(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetCurrent(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetNext(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetPrevious(
+ );
+
+ private:
+
+ POBJECT_LIST_NODE _current;
+ PCLIST _list;
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+};
+
+
+INLINE
+VOID
+LIST_ITERATOR::Construct(
+ )
+/*++
+
+Routine Description:
+
+ This routine resets LIST_ITERATOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _current = NULL;
+ _list = NULL;
+}
+
+
+INLINE
+BOOLEAN
+LIST_ITERATOR::Initialize(
+ IN PCLIST List
+ )
+{
+ DebugAssert(List);
+ _list = List;
+ return TRUE;
+}
+
+
+#endif // _LIST_ITERATOR_
diff --git a/private/utils/ulib/inc/machine.hxx b/private/utils/ulib/inc/machine.hxx
new file mode 100644
index 000000000..9cfdb6f6b
--- /dev/null
+++ b/private/utils/ulib/inc/machine.hxx
@@ -0,0 +1,77 @@
+
+#if defined(JAPAN) && defined(_X86_)
+#if !defined(_MACHINE_DEFN_)
+
+#define _MACHINE_DEFN_
+
+extern "C" {
+ #include "windows.h"
+ #include "machine.h"
+}
+
+#if defined( _AUTOCHECK_ )
+
+extern "C"
+InitializeMachineId(
+ VOID
+);
+
+extern DWORD _dwMachineId;
+
+#define InitializeMachineData() InitializeMachineId();
+
+#define IsFMR_N() ( ISFUJITSUFMR( _dwMachineId ) )
+
+#define IsPC98_N() ( ISNECPC98( _dwMachineId ) )
+
+#define IsPCAT_N() ( ISMICROSOFT( _dwMachineId ) )
+
+#else
+
+DECLARE_CLASS( MACHINE );
+
+class MACHINE : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( MACHINE );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize( VOID );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsFMR( VOID );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsPC98( VOID );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsPCAT( VOID );
+
+ private:
+
+ STATIC DWORD _dwMachineId;
+};
+
+extern ULIB_EXPORT MACHINE MachinePlatform;
+
+#define InitializeMachineData() MachinePlatform.Initialize()
+
+#define IsFMR_N() MachinePlatform.IsFMR()
+
+#define IsPC98_N() MachinePlatform.IsPC98()
+
+#define IsPCAT_N() MachinePlatform.IsPCAT()
+
+#endif // defiend(_AUTOCHECK_)
+#endif // defined(JAPAN) && defiend(_X86_)
+#endif
diff --git a/private/utils/ulib/inc/mbstr.hxx b/private/utils/ulib/inc/mbstr.hxx
new file mode 100644
index 000000000..6b3c5ee14
--- /dev/null
+++ b/private/utils/ulib/inc/mbstr.hxx
@@ -0,0 +1,434 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ mbstr.hxx
+
+Abstract:
+
+ This module contains the definition of the MBSTR class. The MBSTR
+ class is a module that provides static methods for operating on
+ multibyte strings.
+
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 21-Feb-1992
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+
+
+--*/
+
+#if ! defined( _MBSTR_ )
+
+#define _MBSTR_
+
+
+extern "C" {
+ #include <stdarg.h>
+ #include <string.h>
+ #include <memory.h>
+}
+
+DECLARE_CLASS( MBSTR );
+
+class MBSTR {
+
+ public:
+
+ STATIC
+ PVOID
+ Memcpy (
+ INOUT PVOID Src,
+ INOUT PVOID Dst,
+ IN DWORD Size
+ );
+
+ STATIC
+ PVOID
+ Memset (
+ INOUT PVOID Src,
+ IN BYTE Byte,
+ IN DWORD Size
+ );
+
+
+ STATIC
+ PSTR
+ Strcat (
+ INOUT PSTR String1,
+ IN PSTR String2
+ );
+
+ STATIC
+ PSTR
+ Strchr (
+ IN PSTR String,
+ IN CHAR Char
+ );
+
+
+ STATIC
+ INT
+ Strcmp (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+
+
+#ifdef DBCS
+//fix kksuzuka: #931
+//enabling DBCS with stricmp
+ STATIC
+ ULIB_EXPORT
+ INT
+ Stricmp (
+ IN PSTR p1,
+ IN PSTR p2
+ );
+#else
+ STATIC
+ INT
+ Stricmp (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+#endif
+
+
+ STATIC
+ ULIB_EXPORT
+ INT
+ Strcmps (
+ IN PSTR p1,
+ IN PSTR p2
+ );
+
+ STATIC
+ ULIB_EXPORT
+ INT
+ Strcmpis (
+ IN PSTR p1,
+ IN PSTR p2
+ );
+
+
+ STATIC
+ PSTR
+ Strcpy (
+ INOUT PSTR String1,
+ IN PSTR String2
+ );
+
+
+ STATIC
+ DWORD
+ Strcspn (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+
+ STATIC
+ PSTR
+ Strdup (
+ IN PSTR String
+ );
+
+
+ STATIC
+ DWORD
+ Strlen (
+ IN PSTR String
+ );
+
+
+ STATIC
+ PSTR
+ Strlwr (
+ INOUT PSTR String
+ );
+
+ STATIC
+ PSTR
+ Strncat (
+ INOUT PSTR String1,
+ IN PSTR String2,
+ DWORD Size
+ );
+
+
+ STATIC
+ INT
+ Strncmp (
+ IN PSTR String1,
+ IN PSTR String2,
+ IN DWORD Size
+ );
+
+
+ STATIC
+ DWORD
+ Strspn (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+
+
+#ifdef DBCS
+//fix kksuzuka: #926
+//enabling DBCS with strstr
+ STATIC
+ ULIB_EXPORT
+ PSTR
+ Strstr (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+#else
+ STATIC
+ PSTR
+ Strstr (
+ IN PSTR String1,
+ IN PSTR String2
+ );
+#endif
+
+ STATIC
+ PSTR
+ Strupr (
+ INOUT PSTR String
+ );
+
+
+ STATIC
+ PSTR*
+ MakeLineArray (
+ INOUT PSTR* Buffer,
+ INOUT PDWORD BufferSize,
+ INOUT PDWORD NumberOfLines
+ );
+
+ STATIC
+ DWORD
+ Hash(
+ IN PSTR String,
+ IN DWORD Buckets DEFAULT 211,
+ IN DWORD BytesToSum DEFAULT (DWORD)-1
+ );
+
+
+ private:
+
+#ifdef DBCS
+ STATIC
+ INT
+ CheckSpace(
+ IN PSTR s
+ );
+#endif
+
+ STATIC
+ PSTR
+ SkipWhite(
+ IN PSTR p
+ );
+
+
+};
+
+
+INLINE
+PVOID
+MBSTR::Memcpy (
+ INOUT PVOID Src,
+ INOUT PVOID Dst,
+ IN DWORD Size
+ )
+{
+ return memcpy( Src, Dst, (size_t)Size );
+}
+
+
+INLINE
+PVOID
+MBSTR::Memset (
+ INOUT PVOID Src,
+ IN BYTE Byte,
+ IN DWORD Size
+ )
+{
+ return memset( Src, Byte, (size_t)Size );
+}
+
+
+
+INLINE
+PSTR
+MBSTR::Strcat (
+ INOUT PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strcat( String1, String2 );
+}
+
+INLINE
+PSTR
+MBSTR::Strchr (
+ IN PSTR String,
+ IN CHAR Char
+ )
+{
+ return strchr( String, Char );
+}
+
+
+INLINE
+INT
+MBSTR::Strcmp (
+ IN PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strcmp( String1, String2 );
+}
+
+
+#ifndef DBCS
+//fix kksuzuka: #931
+//enabling DBCS with stricmp
+INLINE
+INT
+MBSTR::Stricmp (
+ IN PSTR String1,
+ IN PSTR String2
+ )
+{
+ return _stricmp( String1, String2 );
+}
+#endif
+
+
+INLINE
+PSTR
+MBSTR::Strcpy (
+ INOUT PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strcpy( String1, String2 );
+}
+
+
+INLINE
+DWORD
+MBSTR::Strcspn (
+ IN PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strcspn( String1, String2 );
+}
+
+
+INLINE
+PSTR
+MBSTR::Strdup (
+ IN PSTR String
+ )
+{
+ return _strdup( String );
+}
+
+
+INLINE
+DWORD
+MBSTR::Strlen (
+ IN PSTR String
+ )
+{
+ return strlen( String );
+}
+
+
+INLINE
+PSTR
+MBSTR::Strlwr (
+ INOUT PSTR String
+ )
+{
+ return _strlwr( String );
+}
+
+
+INLINE
+PSTR
+MBSTR::Strncat (
+ INOUT PSTR String1,
+ IN PSTR String2,
+ DWORD Size
+ )
+{
+ return strncat( String1, String2, (unsigned int)Size );
+}
+
+
+INLINE
+INT
+MBSTR::Strncmp (
+ IN PSTR String1,
+ IN PSTR String2,
+ IN DWORD Size
+ )
+{
+ return strncmp( String1, String2, (size_t)Size );
+}
+
+
+INLINE
+DWORD
+MBSTR::Strspn (
+ IN PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strspn( String1, String2 );
+}
+
+#ifndef DBCS
+//fix kksuzuka: #926
+//enabling DBCS with strstr
+INLINE
+PSTR
+MBSTR::Strstr (
+ IN PSTR String1,
+ IN PSTR String2
+ )
+{
+ return strstr( String1, String2 );
+}
+#endif
+
+
+INLINE
+PSTR
+MBSTR::Strupr (
+ INOUT PSTR String
+ )
+{
+ return _strupr( String );
+}
+
+
+
+
+
+#endif // _MBSTR_
diff --git a/private/utils/ulib/inc/mem.hxx b/private/utils/ulib/inc/mem.hxx
new file mode 100644
index 000000000..f0c316e77
--- /dev/null
+++ b/private/utils/ulib/inc/mem.hxx
@@ -0,0 +1,50 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ mem.hxx
+
+Abstract:
+
+ The class MEM contains one pure virtual function named 'Acquire'.
+ The implementors and users of this class must follow some simple
+ constraints.
+
+ Acquire will return a pointer to Size bytes of memory or NULL.
+
+ A function taking a MEM as an argument should call Acquire at most one
+ time. It should not, for instance, cache a pointer to the MEM for
+ future calls to Acquire.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 26-Nov-90
+
+--*/
+
+#if !defined(MEM_DEFN)
+
+#define MEM_DEFN
+
+DECLARE_CLASS( MEM );
+
+class MEM : public OBJECT {
+
+ public:
+
+ VIRTUAL
+ PVOID
+ Acquire(
+ IN ULONG Size,
+ IN ULONG AlignmentMask DEFAULT 0
+ ) PURE;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( MEM );
+
+};
+
+#endif // MEM_DEFN
diff --git a/private/utils/ulib/inc/membmgr.hxx b/private/utils/ulib/inc/membmgr.hxx
new file mode 100644
index 000000000..f3332048e
--- /dev/null
+++ b/private/utils/ulib/inc/membmgr.hxx
@@ -0,0 +1,258 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ membmgr.hxx
+
+Abstract:
+
+ This class offers two classes for the management of fixed
+ size blocks of memory. The first class STATIC_MEM_BLOCK_MGR
+ allows the user to allocate and free fixed size memory blocks
+ up to the specified limit that the class was initialized to.
+
+ The second class MEM_BLOCK_MGR offers a scheme for memory block
+ management that will grow as the clients needs increase.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 29-May-92
+
+--*/
+
+#if !defined(_MEM_BLOCK_MGR_DEFN_)
+
+#define _MEM_BLOCK_MGR_DEFN_
+
+
+#include "array.hxx"
+#include "bitvect.hxx"
+
+
+DECLARE_CLASS( STATIC_MEM_BLOCK_MGR );
+
+class STATIC_MEM_BLOCK_MGR : public OBJECT {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( STATIC_MEM_BLOCK_MGR );
+
+ VIRTUAL
+ ~STATIC_MEM_BLOCK_MGR(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN ULONG MemBlockSize,
+ IN ULONG NumBlocks DEFAULT 128
+ );
+
+ NONVIRTUAL
+ PVOID
+ Alloc(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Free(
+ OUT PVOID MemBlock
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryBlockSize(
+ ) CONST;
+
+ NONVIRTUAL
+ ULONG
+ QueryNumBlocks(
+ ) CONST;
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+ PCHAR _heap;
+ ULONG _num_blocks;
+ ULONG _block_size;
+ ULONG _num_allocated;
+ ULONG _next_alloc;
+ BITVECTOR _bitvector;
+
+};
+
+
+INLINE
+ULONG
+STATIC_MEM_BLOCK_MGR::QueryBlockSize(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine return the number of bytes in a block returned
+ by this object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The number of bytes per block.
+
+--*/
+{
+ return _block_size;
+}
+
+
+INLINE
+ULONG
+STATIC_MEM_BLOCK_MGR::QueryNumBlocks(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine return the number of blocks contained
+ by this object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The number of blocks.
+
+--*/
+{
+ return _num_blocks;
+}
+
+
+
+DECLARE_CLASS( MEM_BLOCK_MGR );
+
+class MEM_BLOCK_MGR : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( MEM_BLOCK_MGR );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~MEM_BLOCK_MGR(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN ULONG MemBlockSize,
+ IN ULONG InitialNumBlocks DEFAULT 128
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PVOID
+ Alloc(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Free(
+ OUT PVOID MemBlock
+ );
+
+ NONVIRTUAL
+ ULONG
+ QueryBlockSize(
+ ) CONST;
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+ PSTATIC_MEM_BLOCK_MGR _static_mem_list[32];
+
+};
+
+
+INLINE
+ULONG
+MEM_BLOCK_MGR::QueryBlockSize(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine return the number of bytes in a block returned
+ by this object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The number of bytes per block.
+
+--*/
+{
+ return _static_mem_list[0] ? _static_mem_list[0]->QueryBlockSize() : 0;
+}
+
+
+INLINE
+PVOID
+operator new(
+ IN size_t Size,
+ IN PVOID Pointer
+ )
+/*++
+
+Routine Description:
+
+ This is an explicit placement version of the 'new' operator
+ which clients of these classes may wish to use in order to
+ call the constructor on their newly allocated objects.
+
+Arguments:
+
+ Size - Supplies the size of the buffer.
+ Pointer - Supplies a pointer to the buffer.
+
+Return Value:
+
+ This function returns the passed in pointer.
+
+--*/
+{
+ return Pointer;
+}
+
+
+#endif // _MEM_BLOCK_MGR_DEFN_
diff --git a/private/utils/ulib/inc/message.hxx b/private/utils/ulib/inc/message.hxx
new file mode 100644
index 000000000..2747fabcc
--- /dev/null
+++ b/private/utils/ulib/inc/message.hxx
@@ -0,0 +1,203 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ message.hxx
+
+Abstract:
+
+ The MESSAGE class provides a dummy implementation of a message displayer
+ class. Message displayers are meant to be used by applications to
+ relay information to the user. Many functions will require a 'MESSAGE'
+ parameter through which to relay their output.
+
+ This particular implementation of this concept will do nothing. It
+ will be used by users who do not wish to have any output from their
+ applications.
+
+ Additionally, this class serves as a base class to real implementations
+ of the virtual methods.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 1-Apr-91
+
+--*/
+
+
+#if !defined(MESSAGE_DEFN)
+
+#define MESSAGE_DEFN
+
+#include "wstring.hxx"
+
+extern "C" {
+ #include <stdarg.h>
+}
+
+enum MESSAGE_TYPE {
+ NORMAL_MESSAGE,
+ ERROR_MESSAGE,
+ PROGRESS_MESSAGE
+};
+
+//
+// Each message also has a visualization: text or GUI. The default is both
+//
+
+#define TEXT_MESSAGE 0x1
+#define GUI_MESSAGE 0x2
+#define NORMAL_VISUAL (TEXT_MESSAGE | GUI_MESSAGE)
+
+
+DECLARE_CLASS( MESSAGE );
+DECLARE_CLASS( HMEM );
+
+
+DEFINE_TYPE(ULONG, MSGID);
+
+
+class MESSAGE : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR(MESSAGE);
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~MESSAGE(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Set(
+ IN MSGID MsgId,
+ IN MESSAGE_TYPE MessageType DEFAULT NORMAL_MESSAGE,
+ IN ULONG MessageVisual DEFAULT NORMAL_VISUAL
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Display(
+ IN PCSTR Format ...
+ );
+
+ VIRTUAL
+ BOOLEAN
+ DisplayV(
+ IN PCSTR Format,
+ IN va_list VarPointer
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Display(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsYesResponse(
+ IN BOOLEAN Default DEFAULT TRUE
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryStringInput(
+ OUT PWSTRING String
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ WaitForUserSignal(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ MSGID
+ SelectResponse(
+ IN ULONG NumberOfSelections ...
+ );
+
+ VIRTUAL
+ PMESSAGE
+ Dup(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsLoggingEnabled(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ SetLoggingEnabled(
+ IN BOOLEAN Enable DEFAULT TRUE
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ ResetLoggingIterator(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryNextLoggedMessage(
+ OUT PFSTRING MessageText
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryPackedLog(
+ IN OUT PHMEM Mem,
+ OUT PULONG PackedDataLength
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetDotsOnly(
+ IN BOOLEAN DotsState
+ );
+};
+
+
+
+INLINE
+BOOLEAN
+MESSAGE::Display(
+ )
+/*++
+
+Routine Description:
+
+ This routine displays the message with no parameters.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ FALSE - Failure.
+ TRUE - Success.
+
+--*/
+{
+ return Display("");
+}
+
+
+
+#endif // MESSAGE_DEFN
diff --git a/private/utils/ulib/inc/newdelp.hxx b/private/utils/ulib/inc/newdelp.hxx
new file mode 100644
index 000000000..f12823d3c
--- /dev/null
+++ b/private/utils/ulib/inc/newdelp.hxx
@@ -0,0 +1,73 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ newdelp.hxx
+
+Abstract:
+
+ This module contains the private definitions used by Ulib's
+ implementation of the new and delete operators and the CRT's malloc,
+ calloc, realloc and free functions.
+
+Author:
+
+ David J. Gilman (davegi) 07-Dec-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+//
+// MEM_BLOCK header signature type and value.
+//
+
+DEFINE_TYPE( ULONG, MEM_BLOCKSIG );
+CONST MEM_BLOCKSIG Signature = 0xDEADDEAD;
+
+//
+// Maximum length of caller's file name.
+//
+
+CONST ULONG MaxFileLength = 20;
+
+//
+// Maximum size of call stack recorded.
+//
+
+CONST ULONG MaxCallStack = 20;
+
+//
+// MEM_BLOCK is the header attached to all allocated memory blocks.
+// Do not change the order of these fields without fixing the initialization
+// of the dummy MEM_BLOCK in newdel.cxx.
+//
+
+struct _MEM_BLOCK {
+ _MEM_BLOCK* pmemNext;
+ _MEM_BLOCK* pmemPrev;
+ MEM_BLOCKSIG memsig;
+ ULONG line;
+ ULONG size;
+ STR file[ MaxFileLength ];
+ DWORD call[ MaxCallStack ];
+};
+
+DEFINE_TYPE( struct _MEM_BLOCK, MEM_BLOCK );
+
+//
+// Returns the root of the stack frame list.
+//
+
+extern "C" {
+
+ VOID
+ DoStackTrace(
+ DWORD CallStack[]
+ );
+
+};
diff --git a/private/utils/ulib/inc/object.hxx b/private/utils/ulib/inc/object.hxx
new file mode 100644
index 000000000..81a37bbae
--- /dev/null
+++ b/private/utils/ulib/inc/object.hxx
@@ -0,0 +1,343 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ Object.hxx
+
+Abstract:
+
+ This module contains the class declaration for the OBJECT class,
+ the root of the Ulib hierarchy. OBJECT is a very important class as
+ it provides default (and sometimes NONVIRTUAL) implementations for
+ helping to identify and classify all other objects at run-time. This
+ capability allows CONTAINERs to manipulate OBJECTs rather than a given
+ derived class of objects. OBJECTs supply the most primitive support for
+ polymorphism within the library. Along with CLASS_DESCRIPTORs they supply
+ the ability to safely determine (Cast) if an OBJECT is of a given class
+ at run-time.
+
+Author:
+
+ David J. Gilman (davegi) 22-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _OBJECT_HXX_ )
+
+#define _OBJECT_HXX_
+
+#include "clasdesc.hxx"
+
+DECLARE_CLASS( OBJECT );
+
+#if DBG == 1
+
+ extern "C" {
+
+ #include <stdio.h>
+ };
+
+ #define DECLARE_OBJECT_DBG_FUNCTIONS \
+ \
+ VIRTUAL \
+ ULIB_EXPORT \
+ VOID \
+ DebugDump ( \
+ IN BOOLEAN Deep DEFAULT FALSE \
+ ) CONST; \
+ \
+ NONVIRTUAL \
+ PCCLASS_NAME \
+ DebugGetClassName ( \
+ ) CONST;
+
+ #define DEFINE_OBJECT_DBG_FUNCTIONS \
+ \
+ ULIB_EXPORT \
+ VOID \
+ OBJECT::DebugDump ( \
+ IN BOOLEAN Deep \
+ ) CONST \
+ { \
+ (void)(Deep); \
+ DebugPtrAssert( _ClassDescriptor ); \
+ } \
+ \
+ PCCLASS_NAME \
+ OBJECT::DebugGetClassName ( \
+ ) CONST \
+ { \
+ DebugPtrAssert( _ClassDescriptor ); \
+ return( _ClassDescriptor->DebugGetClassName( ));\
+ }
+
+
+ //
+ // Debug functions should never be invoked directly. Instead use the
+ // following Dbg macros. Inline functions are not used so that no space
+ // is used in the object when debugging is disabled.
+ //
+
+ #define DbgDump( pobj ) \
+ ( pobj )->DebugDump( FALSE );
+
+ #define DbgDumpAll( pobj ) \
+ ( pobj )->DebugDump( TRUE );
+
+ #define DbgDumpDeep( pobj, flag ) \
+ ( pobj )->DebugDump( flag );
+
+#else // DBG==0
+
+ #define DECLARE_OBJECT_DBG_FUNCTIONS
+
+ #define DEFINE_OBJECT_DBG_FUNCTIONS
+
+ #define DbgDump( pobj )
+
+ #define DbgDumpAll( pobj )
+
+ #define DbgDumpDeep( pobj, flag )
+
+#endif // DBG
+
+class OBJECT {
+
+ public:
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~OBJECT(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ LONG
+ Compare(
+ IN PCOBJECT Object
+ ) CONST;
+
+ NONVIRTUAL
+ PCCLASS_DESCRIPTOR
+ GetClassDescriptor(
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsSameClass(
+ IN PCOBJECT Object
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsSameObject(
+ IN PCOBJECT Object
+ ) CONST;
+
+ NONVIRTUAL
+ CLASS_ID
+ QueryClassId(
+ ) CONST;
+
+ DECLARE_OBJECT_DBG_FUNCTIONS
+
+ protected:
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ OBJECT(
+ );
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ SetClassDescriptor(
+ IN PCCLASS_DESCRIPTOR ClassDescriptor
+ );
+
+ private:
+
+ PCCLASS_DESCRIPTOR _ClassDescriptor;
+
+};
+
+
+INLINE
+VOID
+OBJECT::Construct(
+ )
+{
+}
+
+
+INLINE
+CLASS_ID
+OBJECT::QueryClassId (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Return the CLASSID for this object.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ CLASSID - The CLASSID as maintained by the object's CLASS_DESCRIPTOR.
+
+Notes:
+
+ This function used to be at the end of clasdesac.hxx with th following
+ note:
+
+ This member functions is for OBJECT, not for CLASS_DESCRIPTOR. It is
+ defined here because it requires CLASS_DESCRIPTOR to be defined in
+ order to make it inline.
+
+--*/
+
+{
+ DebugPtrAssert( _ClassDescriptor );
+
+ return _ClassDescriptor->QueryClassId();
+}
+
+
+INLINE
+VOID
+OBJECT::SetClassDescriptor (
+ IN PCCLASS_DESCRIPTOR ClassDescriptor
+ )
+
+/*++
+
+Routine Description:
+
+ Set the CLASS_DESCRIPTOR for a derived class.
+
+Arguments:
+
+ ClassDescriptor - Supplies a pointer to the derived class'
+ CLASS_DECRIPTOR.
+
+Return Value:
+
+ None.
+
+Notes:
+
+ This function should only be called by the DEFINE_CONSTRUCTOR macro.
+
+--*/
+
+{
+ DebugPtrAssert( ClassDescriptor );
+ _ClassDescriptor = ClassDescriptor;
+}
+
+
+
+INLINE
+PCCLASS_DESCRIPTOR
+OBJECT::GetClassDescriptor (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Gain access to the object's CLASS_DESCRIPTOR.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PCCLASS_DESCRIPTOR - A pointer to the CLASS_DESCRIPTOR asscoicated with
+ this object.
+
+--*/
+
+{
+ DebugPtrAssert( _ClassDescriptor );
+
+ return( _ClassDescriptor );
+}
+
+
+INLINE
+BOOLEAN
+OBJECT::IsSameClass (
+ IN PCOBJECT Object
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this object and the supplied object are of the same class
+ by checking their CLASS_IDs for equality.
+
+Arguments:
+
+ Object - Supplies the object to compare class types against.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this object and the supplied object are of
+ the same class.
+
+--*/
+
+{
+ DebugPtrAssert( Object );
+
+ return (BOOLEAN) (QueryClassId() == Object->QueryClassId());
+}
+
+
+INLINE
+BOOLEAN
+OBJECT::IsSameObject (
+ IN PCOBJECT Object
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determine if this object and the supplied object are the same by checking
+ their CLASS_IDs and then their memory location.
+
+Arguments:
+
+ Object - Supplies the object to compare for equivalence.
+
+Return Value:
+
+ BOOLEAN - Returns TRUE if this object and the supplied object are
+ equivalent.
+
+--*/
+
+{
+ return (BOOLEAN) (this == Object);
+}
+
+
+#endif // OBJECT
diff --git a/private/utils/ulib/inc/path.hxx b/private/utils/ulib/inc/path.hxx
new file mode 100644
index 000000000..f950da038
--- /dev/null
+++ b/private/utils/ulib/inc/path.hxx
@@ -0,0 +1,508 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ path.hxx
+
+Abstract:
+
+ The PATH class provides an interface to the complete
+ Win32 name space. Complete means that it will correctly
+ handle long, drive or UNC based, blank embedded, mixed case
+ names. It should eliminate the need for everyone to code
+ statements such as "is the second char a ':'" or "search for
+ the first '\' from the end of the name". That is, access to and
+ manipulation of path and file names should be performed soley
+ through the PATH member functions. This will eliminate
+ the recoding of standard name manipulation code and ensure
+ complete support of Win32 functionality, such as codepage and
+ DBCS support.
+
+Author:
+
+ Steve Rowe 13-Dec-90
+
+Environment:
+
+ ULIB, user
+
+Notes:
+
+
+ To clarify terminology used here, the following describes a
+ canonicalized path (in butchered BNF/reg exp):
+
+ {Canon} ::= {Prefix}"\"{Name}
+ {Prefix} ::= {Device}{Dirs}
+ {Dirs} ::= {"\"{Component}}*
+ {Device} ::= {Drive}|{Machine}
+ {Drive} ::= {Letter}":"
+ {Machine} ::= "\\"{Char}+
+ {Letter} ::= valid drive letter [a-zA-Z]
+ {Char} ::= valid filename/directory char [~:\]
+ {Component} ::= {Char}+
+ {Name} ::= {Base - excluding "."} | { {Base}"."{Ext} }
+ {Base} ::= {Char}+
+ {Ext} ::= {Char - excluding "."}+
+
+ Legend:
+ -------
+ {x}* - 0 or more x
+ {x}+ - 1 or more x
+ "x" - just x (not the quotes)
+ {x}|{y} - x or y (not both or none)
+
+
+ Examples:
+ ---------
+ # Canon
+ --- -----
+ (1) x:\abc\def.ghi\jkl.mnop
+ (2) \\x\abc\def.ghi\jkl.mnop
+ (3) c:\config.sys
+
+ (1) (2) (3)
+
+ Prefix x:\abc\def.ghi \\x\abc\def.ghi c:
+ Device x: \\x c:
+ Dirs \abc \abc\def.ghi
+ Name jkl.mnop jkl.mnop config.sys
+ Base jkl jkl config
+ Ext mnop mnop sys
+
+ Component numbers are 0-based.
+
+
+--*/
+
+#if !defined( _PATH_)
+
+#define _PATH_
+
+#include "wstring.hxx"
+#include "array.hxx"
+
+//
+// Forward references & declarations
+//
+
+DECLARE_CLASS( PATH );
+
+
+
+//
+// PATHSTATE maintains the number of characters within each component that
+// makes up a PATH
+//
+struct _PATHSTATE {
+
+ //
+ // Prefix
+ //
+ CHNUM PrefixLen;
+ CHNUM DeviceLen;
+ CHNUM DirsLen;
+ CHNUM SeparatorLen;
+
+ //
+ // Name
+ //
+ CHNUM NameLen;
+ CHNUM BaseLen;
+ CHNUM ExtLen;
+
+};
+
+DEFINE_TYPE( struct _PATHSTATE, PATHSTATE );
+
+class PATH : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( PATH );
+
+ DECLARE_CAST_MEMBER_FUNCTION( PATH );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PCWSTR InitialPath,
+ IN BOOLEAN Canonicalize DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PCWSTRING InitialPath,
+ IN BOOLEAN Canonicalize DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN PCPATH InitialPath,
+ IN BOOLEAN Canonicalize DEFAULT FALSE
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~PATH (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ AppendBase (
+ IN PCWSTRING Base,
+ IN BOOLEAN Absolute DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ EndsWithDelimiter (
+ ) CONST;
+
+ NONVIRTUAL
+ PCWSTRING
+ GetPathString (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ HasWildCard (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsDrive (
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ IsRoot (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ModifyName (
+ IN PCWSTRING Pattern
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ QueryBase (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PARRAY
+ QueryComponentArray (
+ OUT PARRAY Array DEFAULT NULL
+ ) CONST;
+
+ NONVIRTUAL
+ PWSTRING
+ QueryDevice (
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ QueryDirs (
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ QueryDirsAndName (
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ QueryExt (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PPATH
+ QueryFullPath (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ QueryFullPathString (
+ ) CONST;
+
+ NONVIRTUAL
+ PWSTRING
+ QueryName (
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PPATH
+ QueryPath (
+ ) CONST;
+
+ NONVIRTUAL
+ PWSTRING
+ QueryPrefix (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ QueryRoot (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PPATH
+ QueryWCExpansion(
+ IN PPATH BasePath
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetBase (
+ IN PCWSTRING NewBase
+ );
+
+ ULIB_EXPORT
+ BOOLEAN
+ SetDevice (
+ IN PCWSTRING NewDevice
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetExt (
+ IN PCWSTRING NewExt
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetName (
+ IN PCWSTRING NewName
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetPrefix (
+ IN PCWSTRING NewPrefix
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ TruncateBase (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ TruncateNameAtColon (
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ExpandWildCards(
+ IN OUT PWSTRING pStr1,
+ IN OUT PWSTRING pStr2
+ );
+
+ BOOLEAN
+ Initialize (
+ );
+
+ NONVIRTUAL
+ CHNUM
+ QueryBaseStart (
+ ) CONST;
+
+ CHNUM
+ QueryDeviceLen(
+ IN PWSTRING pString
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryDeviceStart (
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryExtStart (
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryNameStart (
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryPrefixStart (
+ ) CONST;
+
+ NONVIRTUAL
+ VOID
+ SetPathState (
+ );
+
+
+
+#if DBG==1
+
+ ULONG _Signature;
+ BOOLEAN _Initialized;
+
+#endif
+ //
+ // path data
+ //
+ WCHAR _PathBuffer[MAX_PATH];
+ FSTRING _PathString;
+ PATHSTATE _PathState;
+
+};
+
+INLINE
+CHNUM
+PATH::QueryPrefixStart (
+ ) CONST
+
+{
+ return( 0 );
+}
+
+INLINE
+CHNUM
+PATH::QueryNameStart (
+ ) CONST
+
+{
+ //
+ // Increment past the '\'
+ //
+ return( QueryPrefixStart() + _PathState.PrefixLen + _PathState.SeparatorLen );
+}
+
+INLINE
+CHNUM
+PATH::QueryBaseStart (
+ ) CONST
+
+{
+ return( QueryNameStart() );
+}
+
+INLINE
+CHNUM
+PATH::QueryDeviceStart (
+ ) CONST
+
+{
+ return( 0 );
+}
+
+INLINE
+CHNUM
+PATH::QueryExtStart (
+ ) CONST
+{
+ return( QueryNameStart() + _PathState.BaseLen + 1 );
+}
+
+INLINE
+PCWSTRING
+PATH::GetPathString (
+ ) CONST
+
+{
+ return( &_PathString );
+}
+
+INLINE
+PWSTRING
+PATH::QueryBase (
+ )
+
+{
+ return( _PathState.BaseLen ? _PathString.QueryString( QueryBaseStart(), _PathState.BaseLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryDirs (
+ )
+
+{
+ return( _PathState.DirsLen ? _PathString.QueryString( QueryDeviceStart() + _PathState.DeviceLen, _PathState.DirsLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryDirsAndName (
+ )
+
+{
+ return( ( _PathState.DirsLen || _PathState.NameLen ) ? _PathString.QueryString( QueryDeviceStart() + _PathState.DeviceLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryDevice (
+ )
+
+{
+ return( _PathState.DeviceLen ? _PathString.QueryString( QueryDeviceStart(), _PathState.DeviceLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryExt (
+ )
+
+{
+ return( _PathState.ExtLen ? _PathString.QueryString( QueryExtStart(), _PathState.ExtLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryName (
+ ) CONST
+
+{
+ return( _PathState.NameLen ? _PathString.QueryString( QueryNameStart(), _PathState.NameLen ) : NULL );
+}
+
+INLINE
+PWSTRING
+PATH::QueryPrefix (
+ )
+
+{
+ return( _PathState.PrefixLen ? _PathString.QueryString( QueryPrefixStart(), _PathState.PrefixLen ) : NULL );
+}
+
+
+
+#endif // _PATH_
diff --git a/private/utils/ulib/inc/pipe.hxx b/private/utils/ulib/inc/pipe.hxx
new file mode 100644
index 000000000..aef3c917d
--- /dev/null
+++ b/private/utils/ulib/inc/pipe.hxx
@@ -0,0 +1,121 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ pipe.hxx
+
+Abstract:
+
+ This module defines the PIPE object.
+
+Author:
+
+ Barry J. Gilhuly (W-Barry) June 27, 1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _PIPE_ )
+
+#define _PIPE_
+
+
+DECLARE_CLASS( PIPE_STREAM );
+DECLARE_CLASS( PIPE );
+DECLARE_CLASS( WSTRING );
+
+class PIPE : public OBJECT {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( PIPE );
+
+ DECLARE_CAST_MEMBER_FUNCTION( PIPE );
+
+ BOOLEAN
+ Initialize(
+ IN LPSECURITY_ATTRIBUTES PipeAttributes DEFAULT NULL,
+ IN ULONG PipeSize DEFAULT 0,
+ IN PWSTRING PipeName DEFAULT NULL
+ );
+
+ PPIPE_STREAM
+ QueryReadStream(
+ );
+
+ PPIPE_STREAM
+ QueryWriteStream(
+ );
+
+ private:
+
+ PPIPE_STREAM
+ QueryPipeStream(
+ IN HANDLE hStream,
+ IN STREAMACCESS Access
+ );
+
+ VOID
+ Destroy(
+ );
+
+ BOOLEAN _fInitialized;
+ HANDLE _hReadPipe;
+ HANDLE _hWritePipe;
+
+};
+
+INLINE
+PPIPE_STREAM
+PIPE::QueryReadStream(
+ )
+/*++
+
+Routine Description:
+
+ Create a stream with read access to the PIPE.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ A pointer to the created stream if success. Otherwise, it returns
+ NULL.
+
+--*/
+{
+ return( QueryPipeStream( _hReadPipe, READ_ACCESS ) );
+}
+
+INLINE
+PPIPE_STREAM
+PIPE::QueryWriteStream(
+ )
+/*++
+
+Routine Description:
+
+ Create a stream with write access to the PIPE.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ A pointer to the created stream if success. Otherwise, it returns
+ NULL.
+
+--*/
+{
+ return( QueryPipeStream( _hWritePipe, WRITE_ACCESS ) );
+}
+
+#endif // _PIPE_
diff --git a/private/utils/ulib/inc/pipestrm.hxx b/private/utils/ulib/inc/pipestrm.hxx
new file mode 100644
index 000000000..28faf4ff5
--- /dev/null
+++ b/private/utils/ulib/inc/pipestrm.hxx
@@ -0,0 +1,112 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ pipestr.hxx
+
+Abstract:
+
+ This module contains the declaration for the PIPE_STREAM class.
+ The PIPE_STREAM is a class derived from BUFFER_STREAM that provides
+ methods to read and write data to an anonymous pipe.
+ A PIPE_STREAM will have one of the following access: READ or WRITE.
+
+
+Author:
+
+ Jaime Sasson (jaimes) 18-Apr-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( PIPE_STREAM_ )
+
+#define PIPE_STREAM_
+
+#include "bufstrm.hxx"
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( PIPE_STREAM );
+DECLARE_CLASS( WSTRING );
+
+
+class PIPE_STREAM : public BUFFER_STREAM {
+
+ public:
+
+ friend class PIPE;
+ friend PSTREAM GetStandardStream( HANDLE, STREAMACCESS );
+
+ DECLARE_CAST_MEMBER_FUNCTION( PIPE_STREAM );
+
+ VIRTUAL
+ ~PIPE_STREAM(
+ );
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST;
+
+
+ protected:
+
+
+ DECLARE_CONSTRUCTOR( PIPE_STREAM );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN HANDLE Handle,
+ IN STREAMACCESS Access
+ );
+
+ VIRTUAL
+ BOOLEAN
+ EndOfFile(
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ FillBuffer(
+ IN PBYTE Buffer,
+ IN ULONG BufferSize,
+ OUT PULONG BytesRead
+ );
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST;
+
+#ifdef DBCS // v-junm - 10/15/93
+
+ VIRTUAL
+ BOOLEAN
+ CheckIfLeadByte(
+ IN PUCHAR text,
+ IN ULONG offset
+ );
+
+#endif
+
+
+ private:
+
+ HANDLE _PipeHandle;
+ STREAMACCESS _Access;
+ BOOLEAN _EndOfFile;
+};
+
+
+#endif // _PIPE_STREAM_
diff --git a/private/utils/ulib/inc/program.hxx b/private/utils/ulib/inc/program.hxx
new file mode 100644
index 000000000..7e675b6aa
--- /dev/null
+++ b/private/utils/ulib/inc/program.hxx
@@ -0,0 +1,146 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ program.hxx
+
+Abstract:
+
+Author:
+
+ David J. Gilman (davegi) 02-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _PROGRAM_ )
+
+#define _PROGRAM_
+
+#include "rtmsg.h"
+#include "smsg.hxx"
+
+DECLARE_CLASS( PATH );
+DECLARE_CLASS( PROGRAM );
+
+class PROGRAM : public OBJECT {
+
+ public:
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN MSGID UsageMsg DEFAULT MSG_UTILS_HELP,
+ IN MSGID FatalMsg DEFAULT MSG_UTILS_ERROR_FATAL,
+ IN ULONG FatalLevel DEFAULT 1
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~PROGRAM (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DisplayMessage (
+ IN MSGID Message,
+ IN MESSAGE_TYPE Type DEFAULT NORMAL_MESSAGE
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DisplayMessage (
+ IN MSGID Message,
+ IN MESSAGE_TYPE Type,
+ IN PSTR Format,
+ IN ...
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ ExitProgram (
+ ULONG Level
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ Fatal (
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ Fatal (
+ IN ULONG ErrorLevel,
+ IN MSGID Message,
+ IN PSTR Format,
+ IN ...
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ PSTREAM
+ GetStandardInput (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PSTREAM
+ GetStandardOutput (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PSTREAM
+ GetStandardError (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ Usage (
+ ) CONST;
+
+ STATIC
+ PPATH
+ QueryImagePath (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ VOID
+ ValidateVersion (
+ IN MSGID InvalidVersionMsg DEFAULT MSG_UTILS_ERROR_INVALID_VERSION,
+ IN ULONG ErrorLevel DEFAULT 1
+ ) CONST;
+
+ protected:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( PROGRAM );
+
+ STREAM_MESSAGE _Message; // Message stream
+ PSTREAM _Standard_Input; // Standard input
+ PSTREAM _Standard_Output; // Standard output
+ PSTREAM _Standard_Error; // Standard error
+
+ private:
+
+ MSGID _UsageMsg; // Usage message id.
+ MSGID _FatalMsg; // Fatal message id.
+ ULONG _FatalLevel; // Fatal error level
+
+};
+
+
+#endif // _PROGRAM_
diff --git a/private/utils/ulib/inc/prtstrm.hxx b/private/utils/ulib/inc/prtstrm.hxx
new file mode 100644
index 000000000..0fa283218
--- /dev/null
+++ b/private/utils/ulib/inc/prtstrm.hxx
@@ -0,0 +1,143 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ prtstrm.hxx
+
+Abstract:
+
+ This module contains the declaration for the PRINT_STREAM class.
+ The PRINT_STREAM is a class derived from STREAM that provides
+ methods to write data to a print device.
+ A PRINT_STREAM has always WRITE_ACCESS.
+
+
+Author:
+
+ Jaime Sasson (jaimes) 18-Apr-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _PRINT_STREAM_ )
+
+#define _PRINT_STREAM_
+
+#include "stream.hxx"
+
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( PRINT_STREAM );
+DECLARE_CLASS( WSTRING );
+DECLARE_CLASS( PATH );
+
+
+class PRINT_STREAM : public STREAM {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( PRINT_STREAM );
+
+ DECLARE_CAST_MEMBER_FUNCTION( PRINT_STREAM );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~PRINT_STREAM(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PCPATH DeviceName
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsAtEnd(
+ ) CONST;
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ Read(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToRead,
+ OUT PULONG BytesRead
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadChar(
+ OUT PWCHAR Char,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadMbString(
+ IN PSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadWString(
+ IN PWSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PWSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadString(
+ OUT PWSTRING String,
+ IN PWSTRING Delimiters,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+
+
+ protected:
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST;
+
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ HANDLE _Handle;
+};
+
+
+
+#endif // _PRINT_STREAM_
diff --git a/private/utils/ulib/inc/screen.hxx b/private/utils/ulib/inc/screen.hxx
new file mode 100644
index 000000000..6c3c5ceb6
--- /dev/null
+++ b/private/utils/ulib/inc/screen.hxx
@@ -0,0 +1,484 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ screen.hxx
+
+Abstract:
+
+ This module contains the declaration for the SCREEN class.
+ The SCREEN class provides methods that models the stream
+ of bytes, with write access.
+ Read operations from a SCREEN are not allowed.
+ End of stream in a SCREEN object means that the cursor is
+ in the last column of the last row.
+
+
+Author:
+
+ Jaime Sasson (jaimes) 21-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _SCREEN_ )
+
+#define _SCREEN_
+
+#include "stream.hxx"
+
+
+enum SCROLL_DIRECTION {
+ SCROLL_UP,
+ SCROLL_DOWN,
+ SCROLL_LEFT,
+ SCROLL_RIGHT
+ };
+
+DECLARE_CLASS( SCREEN );
+
+
+class SCREEN : public STREAM {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( SCREEN );
+
+ ULIB_EXPORT
+ DECLARE_CAST_MEMBER_FUNCTION( SCREEN );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ ~SCREEN (
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN BOOLEAN CurrentActiveScreen,
+ IN USHORT NumberOfRows,
+ IN USHORT NumberOfColumns,
+ IN USHORT TextAttribute,
+ IN BOOLEAN ExpandAsciiControlSequence DEFAULT TRUE,
+ IN BOOLEAN WrapAtEndOfLine DEFAULT TRUE
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ChangeScreenSize(
+ IN USHORT NumberOfRows,
+ IN USHORT NumberOfColumns,
+ OUT PBOOLEAN IsFullScreen DEFAULT NULL
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ ChangeTextAttribute(
+ IN USHORT Attribute
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ DisableAsciiControlSequence(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ DisableWrapMode(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ EnableAsciiControlSequence(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ EnableWrapMode(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ EraseLine(
+ IN USHORT LineNumber
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ EraseScreen(
+ );
+
+
+#ifdef DBCS
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ EraseScreenAndResetAttribute(
+ );
+#endif
+
+
+ NONVIRTUAL
+ BOOLEAN
+ EraseToEndOfLine(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ FillRectangularRegionAttribute(
+ IN USHORT TopLeftRow,
+ IN USHORT TopLeftColumn,
+ IN USHORT BottomRightRow,
+ IN USHORT BottomRightColumn,
+ IN USHORT Attribute
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ FillRegionAttribute(
+ IN USHORT StartRow,
+ IN USHORT StartColumn,
+ IN USHORT EndRow,
+ IN USHORT EndColumn,
+ IN USHORT Attribute
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ FillRectangularRegionCharacter(
+ IN USHORT TopLeftRow,
+ IN USHORT TopLeftColumn,
+ IN USHORT BottomRightRow,
+ IN USHORT BottomRightColumn,
+ IN CHAR Character
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ FillRegionCharacter(
+ IN USHORT StartRow,
+ IN USHORT StartColumn,
+ IN USHORT EndRow,
+ IN USHORT EndColumn,
+ IN CHAR Character
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ IsAsciiControlSequenceEnabled(
+ ) CONST;
+
+
+ VIRTUAL
+ BOOLEAN
+ IsAtEnd(
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ IsWrapModeEnabled(
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ MoveCursorDown(
+ IN USHORT Rows
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ MoveCursorLeft(
+ IN USHORT Columns
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ MoveCursorRight(
+ IN USHORT Columns
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ MoveCursorTo(
+ IN USHORT Row,
+ IN USHORT Column
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ MoveCursorUp(
+ IN USHORT Rows
+ );
+
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST;
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ DWORD
+ QueryCodePage (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ QueryCursorPosition(
+ OUT PUSHORT Row,
+ OUT PUSHORT Column
+ );
+
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST;
+
+
+ NONVIRTUAL
+ DWORD
+ QueryOutputCodePage (
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ QueryScreenSize(
+ OUT PUSHORT NumberOfRows,
+ OUT PUSHORT NumberOfColumns,
+ OUT PUSHORT WindowRows DEFAULT NULL,
+ OUT PUSHORT WindowColumns DEFAULT NULL
+ ) CONST;
+
+
+ VIRTUAL
+ BOOLEAN
+ Read(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToRead,
+ OUT PULONG BytesRead
+ );
+
+
+ VIRTUAL
+ BOOLEAN
+ ReadChar(
+ OUT PWCHAR Char,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+
+ VIRTUAL
+ BOOLEAN
+ ReadMbString(
+ IN PSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadWString(
+ IN PWSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PWSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadString(
+ OUT PWSTRING String,
+ IN PWSTRING Delimiter,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ ScrollScreen(
+ USHORT Amount,
+ SCROLL_DIRECTION Direction
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetCodePage(
+ IN DWORD CodePage
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetCursorOff(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ SetCursorOn(
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ SetCursorSize(
+ IN ULONG Size
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ SetOutputCodePage(
+ IN DWORD CodePage
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetScreenActive(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WriteString(
+ IN PCWSTRING String,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN CHNUM Granularity DEFAULT 0
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WriteChar(
+ IN WCHAR Char
+ );
+
+ private:
+
+ HANDLE _ScreenHandle;
+// USHORT _Rows;
+// USHORT _Columns;
+ USHORT _TextAttribute;
+ ULONG _ScreenMode;
+
+
+};
+
+
+INLINE
+BOOLEAN
+SCREEN::IsAsciiControlSequenceEnabled(
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determines if expansion of ASCII control sequences are currently
+ allowed.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Indicates if ASCII control sequences are allowed.
+
+
+--*/
+
+
+{
+ if( ( _ScreenMode & ENABLE_PROCESSED_OUTPUT ) ) {
+ return( TRUE );
+ } else {
+ return( FALSE );
+ }
+}
+
+
+
+INLINE
+BOOLEAN
+SCREEN::IsWrapModeEnabled(
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Determines if twrap is allowed in the screen.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ BOOLEAN - Indicates if the screen is in the wrap mode.
+
+
+--*/
+
+
+{
+ if( ( _ScreenMode & ENABLE_WRAP_AT_EOL_OUTPUT ) ) {
+ return( TRUE );
+ } else {
+ return( FALSE );
+ }
+}
+
+
+
+#endif // _SCREEN_
diff --git a/private/utils/ulib/inc/seqcnt.hxx b/private/utils/ulib/inc/seqcnt.hxx
new file mode 100644
index 000000000..352a86286
--- /dev/null
+++ b/private/utils/ulib/inc/seqcnt.hxx
@@ -0,0 +1,83 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ seqcnt.hxx
+
+Abstract:
+
+ This module contains the declaration for the SEQUENTIAL_CONTAINER class.
+ SEQUENTIAL_CONTAINER is a fairly primitive class which augments the
+ CONTAINER class by adding the capability that the objects stored in the
+ container have some sort of sequenced relationship. This means that
+ OBJECTs can be queried from SEQUENTIAL_CONTAINERs by the use of an
+ ITERATOR and that the concepts first, last, next and previous have
+ meaning.
+
+Author:
+
+ David J. Gilman (davegi) 29-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _SEQUENTIAL_CONTAINER_ )
+
+#define _SEQUENTIAL_CONTAINER_
+
+#include "contain.hxx"
+
+DECLARE_CLASS( SEQUENTIAL_CONTAINER );
+DECLARE_CLASS( ITERATOR );
+
+class SEQUENTIAL_CONTAINER : public CONTAINER {
+
+ FRIEND class ITERATOR;
+
+ public:
+
+ VIRTUAL
+ ~SEQUENTIAL_CONTAINER(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Put(
+ IN OUT POBJECT Member
+ ) PURE;
+
+ VIRTUAL
+ ULONG
+ QueryMemberCount(
+ ) CONST PURE;
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DeleteAllMembers(
+ );
+
+ VIRTUAL
+ PITERATOR
+ QueryIterator(
+ ) CONST PURE;
+
+ VIRTUAL
+ POBJECT
+ Remove(
+ IN OUT PITERATOR Position
+ ) PURE;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( SEQUENTIAL_CONTAINER );
+
+};
+
+
+#endif // _SEQUENTIAL_CONTAINER_
diff --git a/private/utils/ulib/inc/smsg.hxx b/private/utils/ulib/inc/smsg.hxx
new file mode 100644
index 000000000..13581bbb4
--- /dev/null
+++ b/private/utils/ulib/inc/smsg.hxx
@@ -0,0 +1,173 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ smsg.hxx
+
+Abstract:
+
+ The STREAM_MESSAGE class offers a STREAM implementation of the
+ MESSAGE class. The messages are output to the STREAM to which
+ the object is initialized to.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 1-Apr-91
+
+--*/
+
+
+#if !defined(STREAM_MESSAGE_DEFN)
+
+#define STREAM_MESSAGE_DEFN
+
+#include "message.hxx"
+
+DECLARE_CLASS( STREAM_MESSAGE );
+DECLARE_CLASS( STREAM );
+
+class STREAM_MESSAGE : public MESSAGE {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( STREAM_MESSAGE );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~STREAM_MESSAGE(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN OUT PSTREAM OutputStream,
+ IN OUT PSTREAM InputStream,
+ IN OUT PSTREAM ErrorStream DEFAULT NULL
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Set(
+ IN MSGID MsgId,
+ IN MESSAGE_TYPE MessageType DEFAULT NORMAL_MESSAGE,
+ IN ULONG MessageVisual DEFAULT NORMAL_VISUAL
+ );
+
+ VIRTUAL
+ BOOLEAN
+ DisplayV(
+ IN PCSTR Format,
+ IN va_list VarPointer
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ IsYesResponse(
+ IN BOOLEAN Default DEFAULT TRUE
+ );
+
+ VIRTUAL
+ BOOLEAN
+ QueryStringInput(
+ OUT PWSTRING String
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WaitForUserSignal(
+ );
+
+ VIRTUAL
+ MSGID
+ SelectResponse(
+ IN ULONG NumberOfSelections ...
+ );
+
+ NONVIRTUAL
+ VOID
+ SetInputCaseSensitivity(
+ IN BOOLEAN CaseSensitive
+ );
+
+ VIRTUAL
+ PMESSAGE
+ Dup(
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ ReadLine(
+ OUT PWSTRING String
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Flush(
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ DisplayString(
+ );
+
+ MSGID _msgid;
+ MESSAGE_TYPE _msgtype;
+ ULONG _msgvisual;
+ PSTREAM _out_stream;
+ PSTREAM _in_stream;
+ PSTREAM _err_stream;
+ BOOLEAN _case_sensitive;
+ BOOLEAN _copy_input;
+ DSTRING _display_string;
+
+};
+
+
+typedef STREAM_MESSAGE* PSTREAM_MESSAGE;
+
+
+INLINE
+VOID
+STREAM_MESSAGE::SetInputCaseSensitivity(
+ IN BOOLEAN CaseSensitive
+ )
+/*++
+
+Routine Description:
+
+ This routine sets whether or not to be case sensitive on input.
+ The class defaults this value to FALSE when it is initialized.
+
+Arguments:
+
+ CaseSensitive - Supplies whether or not to be case sensitive on input.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _case_sensitive = CaseSensitive;
+}
+
+
+#endif // STREAM_MESSAGE_DEFN
diff --git a/private/utils/ulib/inc/sortcnt.hxx b/private/utils/ulib/inc/sortcnt.hxx
new file mode 100644
index 000000000..a4870e5a5
--- /dev/null
+++ b/private/utils/ulib/inc/sortcnt.hxx
@@ -0,0 +1,79 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ sortcnt.hxx
+
+Abstract:
+
+ This module contains the declaration for the SORTABLE_CONTAINER class.
+ SORTABLE_CONTAINER is an abstract classe that is derived from the abstract
+ class SEQUENTIAL_CONTAINER. It not only assumes a sequence but also
+ assumes that the sequence can be changed by sorting it's contents. That
+ is the contents have a relative order independent from how they were
+ placed in the container.
+
+Author:
+
+ David J. Gilman (davegi) 29-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _SORTABLE_CONTAINER_ )
+
+#define _SORTABLE_CONTAINER_
+
+#include "seqcnt.hxx"
+
+DECLARE_CLASS( SORTABLE_CONTAINER );
+
+class SORTABLE_CONTAINER : public SEQUENTIAL_CONTAINER {
+
+ public:
+
+ VIRTUAL
+ ~SORTABLE_CONTAINER(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Put(
+ IN OUT POBJECT Member
+ ) PURE;
+
+ VIRTUAL
+ ULONG
+ QueryMemberCount(
+ ) CONST PURE;
+
+ VIRTUAL
+ PITERATOR
+ QueryIterator(
+ ) CONST PURE;
+
+ VIRTUAL
+ POBJECT
+ Remove(
+ IN OUT PITERATOR Position
+ ) PURE;
+
+ VIRTUAL
+ BOOLEAN
+ Sort(
+ IN BOOLEAN Ascending DEFAULT TRUE
+ ) PURE;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( SORTABLE_CONTAINER );
+
+};
+
+
+#endif // _SORTABLE_CONTAINER_
diff --git a/private/utils/ulib/inc/sortlist.hxx b/private/utils/ulib/inc/sortlist.hxx
new file mode 100644
index 000000000..a2ae1ecb0
--- /dev/null
+++ b/private/utils/ulib/inc/sortlist.hxx
@@ -0,0 +1,153 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ sortlist.hxx
+
+Abstract:
+
+ This module contains the declaration for the SORTED_LIST class.
+
+ SORTED_LIST is a concrete implementation of a SORTABLE_CONTAINER.
+ The elements in a SORTED_LIST are maintained in sorted order.
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 29-Oct-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _SORTED_LIST_ )
+
+#define _SORTED_LIST_
+
+#include "sortcnt.hxx"
+#include "array.hxx"
+
+DECLARE_CLASS( SORTED_LIST );
+
+class SORTED_LIST : public SORTABLE_CONTAINER {
+
+ friend class SORTED_LIST_ITERATOR;
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( SORTED_LIST );
+
+ DECLARE_CAST_MEMBER_FUNCTION( SORTED_LIST );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~SORTED_LIST (
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN BOOLEAN Ascending DEFAULT TRUE
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ IsAscending (
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ DeleteAllMembers(
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Put (
+ IN OUT POBJECT Member
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ PITERATOR
+ QueryIterator (
+ ) CONST;
+
+ VIRTUAL
+ ULIB_EXPORT
+ ULONG
+ QueryMemberCount (
+ ) CONST;
+
+ VIRTUAL
+ POBJECT
+ Remove (
+ IN OUT PITERATOR Position
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Sort(
+ IN BOOLEAN Ascending DEFAULT TRUE
+ );
+
+ protected:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ VIRTUAL
+ ULONG
+ Search(
+ IN PCOBJECT Key,
+ IN ULONG FirstIndex,
+ IN ULONG LastIndex
+ );
+
+
+ private:
+
+ ARRAY _Array; // Array
+ BOOLEAN _Ascending; // Ascending flag
+#if DBG==1
+ ULONG _IteratorCount; // Iterator Count
+#endif
+
+};
+
+
+INLINE
+BOOLEAN
+SORTED_LIST::IsAscending (
+ )
+/*++
+
+Routine Description:
+
+ Determines if the list is sorted in ascending order
+
+Arguments:
+
+ None
+
+Return Value:
+
+ BOOLEAN - TRUE if list is sorted in ascending order, FALSE otherwise
+
+--*/
+
+{
+ return _Ascending;
+}
+
+
+
+#endif // _SORTED_LIST_
diff --git a/private/utils/ulib/inc/sortlit.hxx b/private/utils/ulib/inc/sortlit.hxx
new file mode 100644
index 000000000..81acfbfae
--- /dev/null
+++ b/private/utils/ulib/inc/sortlit.hxx
@@ -0,0 +1,98 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ sortlit.hxx
+
+Abstract:
+
+ This module contains the declaration for the SORTED_LIST_ITERATOR class.
+ SORTED_LIST_ITERATOR is a concrete implementation of the ITERATOR class.
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 29-Oct-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+#if ! defined( _SORTED_LIST_ITERATOR_ )
+
+#define _SORTED_LIST_ITERATOR_
+
+#include "iterator.hxx"
+
+//
+// Forward references
+//
+DECLARE_CLASS( SORTED_LIST );
+DECLARE_CLASS( SORTED_LIST_ITERATOR );
+
+
+class SORTED_LIST_ITERATOR : public ITERATOR {
+
+ friend SORTED_LIST;
+
+ public:
+
+ VIRTUAL
+ ~SORTED_LIST_ITERATOR(
+ );
+
+ VIRTUAL
+ POBJECT
+ FindNext(
+ IN PCOBJECT Key
+ );
+
+ VIRTUAL
+ POBJECT
+ GetCurrent(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetNext(
+ );
+
+ VIRTUAL
+ POBJECT
+ GetPrevious(
+ );
+
+ VIRTUAL
+ VOID
+ Reset(
+ );
+
+ protected:
+
+ DECLARE_CAST_MEMBER_FUNCTION( SORTED_LIST_ITERATOR );
+ DECLARE_CONSTRUCTOR( SORTED_LIST_ITERATOR );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN OUT PSORTED_LIST List
+ );
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ private:
+
+ PSORTED_LIST _List; // Sorted List
+ ULONG _CurrentIndex; // Current index
+
+};
+
+
+#endif // _SORTED_LIST_ITERATOR_
diff --git a/private/utils/ulib/inc/spackmsg.hxx b/private/utils/ulib/inc/spackmsg.hxx
new file mode 100644
index 000000000..30888480f
--- /dev/null
+++ b/private/utils/ulib/inc/spackmsg.hxx
@@ -0,0 +1,64 @@
+/*++
+
+Copyright (c) 1991-1994 Microsoft Corporation
+
+Module Name:
+
+ spackmsg.hxx
+
+Abstract:
+
+ Header file for the SP_AUTOCHECK_MESSAGE subclass.
+
+Author:
+
+ Lonny McMichael (lonnym) 09-Jun-94
+
+--*/
+
+#if !defined( _SP_AUTOCHECK_MESSAGE_DEFN_ )
+
+#define _SP_AUTOCHECK_MESSAGE_DEFN_
+
+#include "achkmsg.hxx"
+
+DECLARE_CLASS( SP_AUTOCHECK_MESSAGE );
+
+class SP_AUTOCHECK_MESSAGE : public AUTOCHECK_MESSAGE {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( SP_AUTOCHECK_MESSAGE );
+
+ VIRTUAL
+ ~SP_AUTOCHECK_MESSAGE(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ DisplayV(
+ IN PCSTR Format,
+ IN va_list VarPointer
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsYesResponse(
+ IN BOOLEAN Default DEFAULT TRUE
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy(
+ );
+};
+
+
+#endif // _SP_AUTOCHECK_MESSAGE_DEFN_
diff --git a/private/utils/ulib/inc/stack.hxx b/private/utils/ulib/inc/stack.hxx
new file mode 100644
index 000000000..c5a2f4964
--- /dev/null
+++ b/private/utils/ulib/inc/stack.hxx
@@ -0,0 +1,233 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ stack.hxx
+
+Abstract:
+
+ This module contains the declaration for the concrete STACK class.
+ STACK is derived from the ORDERED_CONTAINER class. It implements a
+ standard FIFO stack data structure with the addition that it has a last
+ position which can be queried. STACKs are dynamic in that they will
+ grow rather than overflow.
+
+Author:
+
+ David J. Gilman (davegi) 11-Dec-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _STACK_ )
+
+#define _STACK_
+
+#include "seqcnt.hxx"
+
+//
+// Forward references
+//
+
+DECLARE_CLASS( ARRAY );
+DECLARE_CLASS( ITERATOR );
+DECLARE_CLASS( STACK );
+
+
+//
+// Default values for an ARRAY object.
+//
+
+CONST ULONG DefaultCapacity = 50;
+CONST ULONG DefaultCapacityIncrement = 25;
+
+class STACK : public SEQUENTIAL_CONTAINER {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( STACK );
+
+ DECLARE_CAST_MEMBER_FUNCTION( STACK );
+
+ NONVIRTUAL
+ VOID
+ Clear (
+ );
+
+ VIRTUAL
+ PCOBJECT
+ GetFirst (
+ ) CONST PURE;
+
+ VIRTUAL
+ PCOBJECT
+ GetLast (
+ ) CONST PURE;
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ IN ULONG Capacity DEFAULT DefaultCapacity,
+ IN ULONG CapacityIncrement DEFAULT DefaultCapacityIncrement
+ );
+
+ NONVIRTUAL
+ PCOBJECT
+ Pop (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Push (
+ IN PCOBJECT Object
+ );
+
+ VIRTUAL
+ PCOBJECT
+ Put (
+ IN PCOBJECT Member
+ ) PURE;
+
+ VIRTUAL
+ PITERATOR
+ QueryIterator (
+ ) CONST PURE;
+
+ VIRTUAL
+ PCOBJECT
+ Remove (
+ IN PCOBJECT Member
+ ) PURE;
+
+ NONVIRTUAL
+ PCOBJECT
+ Top (
+ ) CONST;
+
+ private:
+
+ PARRAY _Stack;
+ ULONG _Top;
+};
+
+INLINE
+PCOBJECT
+STACK::GetFirst (
+ ) CONST
+
+{
+ return( Top( ));
+}
+
+INLINE
+PCOBJECT
+STACK::GetLast (
+ ) CONST
+
+{
+ DebugPtrAssert( _Stack );
+ if( _Stack != NULL ) {
+ return( _Stack->GetLast( ));
+ } else {
+ return( NULL );
+ }
+}
+
+INLINE
+VOID
+STACK::Clear (
+ )
+
+{
+ _Top = 0;
+}
+
+INLINE
+PCOBJECT
+STACK::Pop (
+ )
+
+{
+ DebugPtrAssert( _Stack );
+ if( ( _Stack != NULL ) && ( _Top != 0 )) {
+ return( _Stack->GetAt( _Top-- ));
+ } else {
+ return( NULL );
+ }
+}
+
+INLINE
+BOOLEAN
+STACK::Push (
+ IN PCOBJECT Object
+ )
+
+{
+ DebugPtrAssert( _Stack );
+ if( _Stack != NULL ) {
+ return( _Stack->PutAt( ++_Top ));
+ } else {
+ return( NULL );
+ }
+}
+
+INLINE
+PCOBJECT
+STACK::Put (
+ IN PCOBJECT Member
+ )
+
+{
+ DebugPtrAssert( Member );
+ return( Push( Member ));
+}
+
+INLINE
+PITERATOR
+STACK::QueryIterator (
+ ) CONST
+
+{
+ DebugPtrAssert( _Stack );
+ if( _Stack != NULL ) {
+ return( _Stack->QueryIterator( ));
+ } else {
+ return( NULL );
+ }
+}
+
+INLINE
+PCOBJECT
+STACK::Remove (
+ IN PCOBJECT Member
+ ) PURE
+
+{
+ DebugPtrAssert( Member ).IsEqual( Top( ));
+ if( ( Member != NULL ) && Member.IsEqual( Top( )) ) {
+ return( Pop( ));
+ } else {
+ retrun( NULL );
+ }
+}
+
+INLINE
+PCOBJECT
+STACK::Top (
+ ) CONST
+
+{
+ DebugPtrAssert( _Stack );
+ if( ( _Stack != NULL ) && ( _Top != 0 )) {
+ return( _Stack->GetAt( _Top ));
+ } else {
+ return( NULL );
+ }
+}
+
+#endif // _STACK_
diff --git a/private/utils/ulib/inc/stream.hxx b/private/utils/ulib/inc/stream.hxx
new file mode 100644
index 000000000..7f8326c08
--- /dev/null
+++ b/private/utils/ulib/inc/stream.hxx
@@ -0,0 +1,244 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ stream.hxx
+
+Abstract:
+
+ This module contains the declarations for the STREAM class.
+ STREAM is an abstract class used to model "devices" that
+ allow read or write operations, as a stream of data.
+ ("Device" here means anything that can supply or accept data
+ through read and write operations. Examples of "devices" are
+ keyboard, screen, file, pipes, etc.)
+ A STREAM object can have one of the following access: READ,
+ WRITE and READ_AND_WRITE.
+
+ The STREAM class provides methods to read data from the stream,
+ write data to the stream, check the stream access, and check if
+ the end of the stream has occurred.
+ (The occurrence of the end of stream means that all data in
+ a stream with READ or READ_AND_WRITE access was consumed, and no
+ more data can be obtained from the stream.)
+
+
+Author:
+
+ Jaime Sasson (jaimes) 21-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _STREAM_ )
+
+#define _STREAM_
+
+#include "wstring.hxx"
+#include "system.hxx"
+
+DECLARE_CLASS( STREAM );
+
+
+enum STREAMACCESS {
+ READ_ACCESS,
+ WRITE_ACCESS,
+ READ_AND_WRITE_ACCESS
+ };
+
+
+class STREAM : public OBJECT {
+
+
+ public:
+
+ friend BOOLEAN SYSTEM::PutStandardStream( DWORD, PSTREAM );
+
+ VIRTUAL
+ ~STREAM(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ IsAtEnd(
+ ) CONST PURE;
+
+ VIRTUAL
+ STREAMACCESS
+ QueryAccess(
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ Read(
+ OUT PBYTE Buffer,
+ IN ULONG BytesToRead,
+ OUT PULONG BytesRead
+ ) PURE;
+
+ NONVIRTUAL
+ BOOLEAN
+ ReadByte(
+ OUT PBYTE Data
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadChar(
+ OUT PWCHAR Char,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ ) PURE;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ReadLine(
+ OUT PWSTRING String,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ReadMbLine(
+ IN PSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadMbString(
+ IN PSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ ) PURE;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ ReadWLine(
+ IN PWSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ );
+
+ VIRTUAL
+ BOOLEAN
+ ReadWString(
+ IN PWSTR String,
+ IN DWORD BufferSize,
+ INOUT PDWORD StringSize,
+ IN PWSTR Delimiters,
+ IN BOOLEAN ExpandTabs DEFAULT FALSE,
+ IN DWORD TabExp DEFAULT 8
+ ) PURE;
+
+ VIRTUAL
+ BOOLEAN
+ ReadString(
+ OUT PWSTRING String,
+ IN PWSTRING Delimiters,
+ IN BOOLEAN Unicode DEFAULT FALSE
+ ) PURE;
+
+ VIRTUAL
+ BOOLEAN
+ Write(
+ IN PCBYTE Buffer,
+ IN ULONG BytesToWrite,
+ OUT PULONG BytesWritten
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ WriteByte(
+ IN BYTE Data
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WriteChar(
+ IN WCHAR Char
+ );
+
+ VIRTUAL
+ BOOLEAN
+ WriteString(
+ IN PCWSTRING String,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN CHNUM Granularity DEFAULT 0
+ );
+
+ protected:
+
+
+ DECLARE_CONSTRUCTOR( STREAM );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ );
+
+ VIRTUAL
+ HANDLE
+ QueryHandle(
+ ) CONST PURE;
+
+
+ private:
+
+
+ DSTRING _Delimiter;
+ PSTR _MbDelimiter;
+ PWSTR _WDelimiter;
+};
+
+
+INLINE
+BOOLEAN
+STREAM::Initialize(
+ )
+
+/*++
+
+Routine Description:
+
+ Initializes an object of type STREAM.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ Returns TRUE if the initialization succeeded, or FALSE otherwise.
+
+
+--*/
+
+
+{
+ _MbDelimiter = "\n";
+ _WDelimiter = L"\n";
+ return( _Delimiter.Initialize( "\n" ) );
+}
+
+
+#endif // _STREAM_
diff --git a/private/utils/ulib/inc/string.hxx b/private/utils/ulib/inc/string.hxx
new file mode 100644
index 000000000..28d479ee2
--- /dev/null
+++ b/private/utils/ulib/inc/string.hxx
@@ -0,0 +1,464 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ GENERIC_STRING
+
+Abstract:
+
+ This module contains the definition for the GENERIC_STRING class.
+
+Author:
+
+ Ramon J. San Andres (ramonsa) 03-May-91
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+ A GENERIC_STRING is the base class for all string classes. This
+ base class provides a basic wide-character interface.
+
+ A string is a finite, ordered sequence of wide characters. Note
+ that a GENERIC_STRING is NOT necessarily null-terminated.
+
+ Individual characters within a string are indexed by a number of
+ type CHNUM (CHaracter NUMber). This index is zero-based.
+
+ There are three special symbols that are widely used in the ULIB
+ strings world:
+
+ INVALID_CHAR This symbol represents an invalid wide character.
+
+ INVALID_CHNUM This symbol represents an invalid CHNUM index within
+ a GENERIC_STRING.
+
+ TO_END This symbol means "up to the end of the string", and
+ is used a lot as a default value in those methods
+ that accept a length argument.
+
+
+--*/
+
+
+//
+// This class is no longer supported.
+//
+
+#include "wstring.hxx"
+
+#define _GENERIC_STRING_
+
+#if !defined (_GENERIC_STRING_)
+
+#define _GENERIC_STRING_
+
+//
+// Comparison flags
+//
+#define COMPARE_IGNORECASE ( 1 )
+#define COMPARE_IGNOREDIACRITIC ( 2 )
+#define COMPARE_IGNORESYMBOLS ( 4 )
+
+
+//
+// The type of the index used to access individual characters within
+// a generic string.
+//
+DEFINE_TYPE( ULONG, CHNUM );
+
+//
+// Magic constants
+//
+#define INVALID_CHAR ((WCHAR)(-1))
+#define INVALID_CHNUM ((CHNUM)(-1))
+#define TO_END INVALID_CHNUM
+
+
+DECLARE_CLASS( GENERIC_STRING );
+
+
+class GENERIC_STRING : public OBJECT {
+
+ public:
+
+ DECLARE_CAST_MEMBER_FUNCTION( GENERIC_STRING );
+
+ VIRTUAL
+ ~GENERIC_STRING(
+ );
+
+ VIRTUAL
+ PBYTE
+ GetInternalBuffer (
+ IN CHNUM Position DEFAULT 0
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ IsChAt (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ MakeNumber (
+ OUT PLONG Number,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ ULONG
+ QueryByteCount (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ WCHAR
+ QueryChAt(
+ IN CHNUM Position DEFAULT 0
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ QueryChCount (
+ ) CONST PURE;
+
+ VIRTUAL
+ PGENERIC_STRING
+ QueryGenericString (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ PSTR
+ QuerySTR(
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN OUT PSTR Buffer DEFAULT NULL,
+ IN ULONG BufferSize DEFAULT 0
+ ) CONST PURE;
+
+ VIRTUAL
+ PWSTR
+ QueryWSTR (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN OUT PWSTR Buffer DEFAULT NULL,
+ IN ULONG BufferSize DEFAULT 0,
+ IN BOOLEAN ForceNull DEFAULT TRUE
+ ) CONST PURE;
+
+ VIRTUAL
+ BOOLEAN
+ Replace (
+ IN PCGENERIC_STRING String2,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN CHNUM Position2 DEFAULT 0,
+ IN CHNUM Length2 DEFAULT TO_END
+ ) PURE;
+
+ VIRTUAL
+ BOOLEAN
+ SetChAt (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) PURE;
+
+ VIRTUAL
+ CHNUM
+ Strchr (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ LONG
+ Strcmp (
+ IN PCGENERIC_STRING GenericString
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ Strcspn (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ LONG
+ Stricmp (
+ IN PCGENERIC_STRING GenericString
+ ) CONST PURE;
+
+ VIRTUAL
+ LONG
+ StringCompare (
+ IN CHNUM Position1,
+ IN CHNUM Length1 ,
+ IN PCGENERIC_STRING GenericString2,
+ IN CHNUM Position2,
+ IN CHNUM Length2,
+ IN USHORT CompareFlags DEFAULT COMPARE_IGNORECASE
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ StrLen (
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ Strrchr (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ Strspn (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ VIRTUAL
+ CHNUM
+ Strstr (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST PURE;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator == (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator != (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator < (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator > (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator <= (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator >= (
+ IN RCGENERIC_STRING String
+ ) CONST;
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( GENERIC_STRING );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize (
+ );
+
+ private:
+
+ VOID
+ Construct (
+ );
+
+
+};
+
+INLINE
+BOOLEAN
+GENERIC_STRING::operator == (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is equal to this string
+ FALSE - if not.
+
+--*/
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) == 0);
+}
+
+INLINE
+BOOLEAN
+GENERIC_STRING::operator != (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is equal to this string
+ FALSE - if not.
+
+--*/
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) != 0);
+}
+
+INLINE
+BOOLEAN
+GENERIC_STRING::operator < (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is less then this string
+ FALSE - if not.
+
+--*/
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) < 0);
+}
+
+INLINE
+BOOLEAN
+GENERIC_STRING::operator > (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is greater then this string
+ FALSE - if not.
+
+--*/
+
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) > 0);
+}
+
+INLINE
+BOOLEAN
+GENERIC_STRING::operator <= (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is less then or equal this string
+ FALSE - if not.
+
+--*/
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) <= 0);
+}
+
+INLINE
+NONVIRTUAL
+BOOLEAN
+GENERIC_STRING::operator >= (
+ IN RCGENERIC_STRING String
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Compares this string with another.
+
+Arguments:
+
+ String - Supplies a reference to the string to compare.
+
+Return Value:
+
+ TRUE - if String is greater then or equal this string
+ FALSE - if not.
+
+--*/
+
+{
+ return (StringCompare( 0, QueryChCount(), (PCGENERIC_STRING)&String, 0, String.QueryChCount(), COMPARE_IGNORECASE ) >= 0);
+}
+
+#endif // _GENERIC_STRING_
diff --git a/private/utils/ulib/inc/stringar.hxx b/private/utils/ulib/inc/stringar.hxx
new file mode 100644
index 000000000..dfae463e5
--- /dev/null
+++ b/private/utils/ulib/inc/stringar.hxx
@@ -0,0 +1,83 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ stringar.hxx
+
+Abstract:
+
+ This module contains the definitions for the STRING_ARRAY class.
+ STRING_ARRAY is used only to store strings, and it provides a
+ method to sort the strings in ascending or descending order.
+ The sort methods uses the qsort() function of the C run time
+ library.
+
+Author:
+
+ Jaime F. Sasson (jaimes) 01-May-1991
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _STRING_ARRAY_ )
+
+#define _STRING_ARRAY_
+
+
+
+//
+// Default values for an STRING_ARRAY object.
+//
+// - Capacity is the total number of elemnts that can be stored in an STRING_ARRAY
+// - CapacityIncrement is the number of elemnts that the STRING_ARRAY's Capacity
+// will be increased by when it's Capacity is exceeded
+//
+
+CONST CHNUM DefaultPosition = 0;
+// CONST ULONG DefaultCapacity = 50;
+// CONST ULONG DefaultCapacityIncrement = 25;
+
+class STRING_ARRAY : public ARRAY {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( STRING_ARRAY );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize (
+ IN CHNUM Position DEFAULT DefaultPosition,
+ IN ULONG Capacity DEFAULT DefaultCapacity,
+ IN ULONG CapacityIncrement DEFAULT DefaultCapacityIncrement
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Sort(
+ IN BOOLEAN Ascending
+ );
+
+ private:
+
+ static
+ NONVIRTUAL
+ int _CRTAPI1
+ StringCompare(
+ IN const void * String1,
+ IN const void * String2
+ );
+
+ static CHNUM _Position;
+ static BOOLEAN _Ascending;
+};
+
+#endif // _STRING_ARRAY_
+
diff --git a/private/utils/ulib/inc/substrng.hxx b/private/utils/ulib/inc/substrng.hxx
new file mode 100644
index 000000000..c7faa0542
--- /dev/null
+++ b/private/utils/ulib/inc/substrng.hxx
@@ -0,0 +1,632 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ SUB_STRING
+
+Abstract:
+
+ This module contains the definition of the SUB_STRING class.
+
+Author:
+
+ Steve Rowe (stever)
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+ A substring is a subsequence of characters taken from a "base"
+ string. Substrings are useful in those cases in which we want
+ to operate on "chunks" of a given string (e.g. parsing), without
+ having to create separate strings for each one.
+
+ One must be careful when using substrings, though. Since
+ substrings depend on a base string, the base string must exist
+ during the life span of all its substrings. In other words,
+ the base string must not be deleted before having deleted all
+ the substrings obtained from it.
+
+ Note that GENERIC_STRINGs have no substring support. It is up to
+ the derived string classes to provide it.
+
+ Since substrings are just "windows" into a base string, any
+ modification of a substring will be reflected in the base
+ string (hence in all other substrings). This is why we have
+ two classes of substrings:
+
+ SUB_STRING allows only read operations. Note however that
+ one can modify the base string directly.
+
+ DYNAMIC_SUB_STRING is derived from the above, and it allows
+ write operations. Needless to say, you should
+ not use this class unless you're sure of what
+ you are doing.
+
+ Substring objects cannot be created and initialized directly by the
+ user, they must be obtained thru a base string class with substring
+ support.
+
+ Substrings pertaining to the same base string are chained together
+ in a doubly-linked queue. Since substrings have no knowledge of the
+ internals of their base string, the chain has a dummy element as its
+ head. In order to provide substring support, the base string must
+ follow these steps:
+
+
+ 1.- Before spawning any substring, the substring chain head must
+ be created and initialized using the InitializeChainHead() method.
+ Note that this substring is a dummy one, beknown only to the base
+ string.
+
+ 2.- Whenever spawning a new substring, it must be linked to the chain
+ using the InitializeChainNode() method. Any substring already in
+ the chain may be use as argument, but the obvious choice is the
+ chain head.
+
+ 3.- Each time that the size of the string changes, the Update() of the
+ chain head must be invoked.
+
+ 4.- Before destroying a base string, you have to make sure that all its
+ substrings have gone away. This means that the chain head must be
+ the only element of the chain. Use the HasLinks() method to
+ verify this.
+
+ 5.- Don't forget to destroy the chain head before destorying the base
+ string.
+
+
+--*/
+
+//
+// This class is no longer supported
+//
+
+#include "wstring.hxx"
+
+#define _SUB_STRING_
+
+#if !defined (_SUB_STRING_)
+
+#define _SUB_STRING_
+
+#include "string.hxx"
+
+DECLARE_CLASS( SUB_STRING );
+
+class SUB_STRING : public GENERIC_STRING {
+
+ friend SUB_STRING;
+
+ public:
+
+ DECLARE_CONSTRUCTOR( SUB_STRING );
+ DECLARE_CAST_MEMBER_FUNCTION( SUB_STRING );
+
+ VIRTUAL
+ ~SUB_STRING (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ HasLinks (
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ InitializeChainHead (
+ IN PGENERIC_STRING BaseString
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ InitializeChainNode (
+ IN OUT PSUB_STRING SubString,
+ IN CHNUM Position,
+ IN CHNUM Length
+ );
+
+ VIRTUAL
+ PBYTE
+ GetInternalBuffer (
+ IN CHNUM Position DEFAULT 0
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ IsChAt (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ MakeNumber (
+ OUT PLONG Number,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ ULONG
+ QueryByteCount (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ WCHAR
+ QueryChAt(
+ IN CHNUM Position DEFAULT 0
+ ) CONST;
+
+ VIRTUAL
+ CHNUM
+ QueryChCount (
+ ) CONST;
+
+ VIRTUAL
+ PGENERIC_STRING
+ QueryGenericString (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ PSTR
+ QuerySTR(
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN OUT PSTR Buffer DEFAULT NULL,
+ IN ULONG BufferSize DEFAULT 0
+ ) CONST;
+
+ VIRTUAL
+ PSUB_STRING
+ QuerySubString (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ OUT PSUB_STRING SubString DEFAULT NULL
+ );
+
+ VIRTUAL
+ PWSTR
+ QueryWSTR (
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN OUT PWSTR Buffer DEFAULT NULL,
+ IN ULONG BufferSize DEFAULT 0,
+ IN BOOLEAN ForceNull DEFAULT TRUE
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ Replace (
+ IN PCGENERIC_STRING String2,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ IN CHNUM Position2 DEFAULT 0,
+ IN CHNUM Length2 DEFAULT TO_END
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetChAt (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ );
+
+ VIRTUAL
+ CHNUM
+ Strchr (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ LONG
+ Strcmp (
+ IN PCGENERIC_STRING GenericString
+ ) CONST;
+
+ VIRTUAL
+ CHNUM
+ Strcspn (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ LONG
+ Stricmp (
+ IN PCGENERIC_STRING GenericString
+ ) CONST;
+
+ VIRTUAL
+ LONG
+ StringCompare (
+ IN CHNUM Position1,
+ IN CHNUM Length1,
+ IN PCGENERIC_STRING GenericString2,
+ IN CHNUM Position2,
+ IN CHNUM Length2,
+ IN USHORT CompareFlags DEFAULT COMPARE_IGNORECASE
+ ) CONST;
+
+
+ VIRTUAL
+ CHNUM
+ StrLen (
+ ) CONST;
+
+ VIRTUAL
+ CHNUM
+ Strrchr (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ CHNUM
+ Strspn (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ VIRTUAL
+ CHNUM
+ Strstr (
+ IN PCGENERIC_STRING GenericString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ Update (
+ IN CHNUM Length
+ );
+
+ protected:
+
+ NONVIRTUAL
+ PGENERIC_STRING
+ GetBaseString (
+ );
+
+ NONVIRTUAL
+ PSUB_STRING
+ GetNextInChain (
+ );
+
+ NONVIRTUAL
+ PSUB_STRING
+ GetPreviousInChain (
+ );
+
+ NONVIRTUAL
+ VOID
+ GetValidLength(
+ IN CHNUM Position,
+ IN OUT PCHNUM Length
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryStartingPosition (
+ ) CONST;
+
+ NONVIRTUAL
+ VOID
+ SetChCount(
+ IN CHNUM NewCount
+ );
+
+ private:
+
+ NONVIRTUAL
+ VOID
+ Construct (
+ );
+
+ NONVIRTUAL
+ VOID
+ Destroy (
+ );
+
+ PGENERIC_STRING _BaseString; // base string to take substring
+ CHNUM _StartingPosition; // starting index within base
+ CHNUM _CountOfChars; // # of chars in substring
+
+ PSUB_STRING _Previous; // Previous in chain
+ PSUB_STRING _Next; // Next in chain
+
+#if DBG==1
+ ULONG _Signature;
+ BOOLEAN _Initialized;
+#endif
+
+};
+
+INLINE
+PGENERIC_STRING
+SUB_STRING::GetBaseString (
+ )
+
+/*++
+
+Routine Description:
+
+ Gets a pointer to the base string
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to the base string
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ return _BaseString;
+}
+
+INLINE
+PSUB_STRING
+SUB_STRING::GetNextInChain (
+ )
+
+/*++
+
+Routine Description:
+
+ Gets a pointer to next substring in the chain
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to substring
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ return _Next;
+}
+
+INLINE
+PSUB_STRING
+SUB_STRING::GetPreviousInChain (
+ )
+
+/*++
+
+Routine Description:
+
+ Gets a pointer to previous substring in the chain
+
+Arguments:
+
+ none
+
+Return Value:
+
+ Pointer to the previous substring
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ return _Previous;
+}
+
+INLINE
+VOID
+SUB_STRING::GetValidLength (
+ IN CHNUM Position,
+ IN OUT PCHNUM Length
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ If the length passed has the magic value TO_END, then it is
+ updated to be the from the passed position up to the end of the
+ substring.
+
+Arguments:
+
+ Position - Supplies a starting position within the substring
+ Length - Supplies a length
+
+Return Value:
+
+ none
+
+--*/
+
+{
+
+ DebugAssert(_Initialized );
+
+ DebugAssert( Position <= _CountOfChars );
+
+ if ( *Length == TO_END ) {
+ *Length = _CountOfChars - Position;
+ }
+
+ DebugAssert( Position + *Length <= _CountOfChars );
+}
+
+INLINE
+BOOLEAN
+SUB_STRING::HasLinks (
+ )
+
+/*++
+
+Routine Description:
+
+ Determines if the substring has forward and backward links
+
+Arguments:
+
+ none
+
+Return Value:
+
+ TRUE if the stubstring has forward or backward links
+ FALSE otherwise
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ return ( (GetNextInChain() != NULL ) || (GetPreviousInChain() != NULL ) );
+
+}
+
+INLINE
+CHNUM
+SUB_STRING::QueryStartingPosition (
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ Returns the starting character position within the base string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The starting character position within the base string.
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ return _StartingPosition;
+}
+
+INLINE
+VOID
+SUB_STRING::SetChCount (
+ IN CHNUM NewCount
+ )
+
+/*++
+
+Routine Description:
+
+ Sets the number of characters in the substring
+
+Arguments:
+
+ NewCount - Supplies the new count of characters
+
+Return Value:
+
+ none
+
+--*/
+
+{
+ DebugAssert( _Initialized );
+ _CountOfChars = NewCount;
+}
+
+
+
+#endif // _SUB_STRING_
+
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ DYNAMIC_SUB_STRING
+
+Abstract:
+
+ This module contains the definition of the DYNAMIC_SUB_STRING class.
+
+Author:
+
+ steve rowe stever 2/1/91
+
+Notes:
+
+ DYNAMIC_SUB_STRINGs can modify the base string (see notes for
+ SUB_STRING class).
+
+
+Revision History:
+
+--*/
+
+#define _DYNAMIC_SUB_STRING_
+
+#if !defined (_DYNAMIC_SUB_STRING_)
+
+#define _DYNAMIC_SUB_STRING_
+
+DECLARE_CLASS( DYNAMIC_SUB_STRING );
+
+class DYNAMIC_SUB_STRING : public SUB_STRING {
+
+ public:
+
+ DECLARE_CONSTRUCTOR( DYNAMIC_SUB_STRING );
+ DECLARE_CAST_MEMBER_FUNCTION( DYNAMIC_SUB_STRING );
+
+ NONVIRTUAL
+ BOOLEAN
+ Copy (
+ IN PCGENERIC_STRING GenericString
+ );
+
+ VIRTUAL
+ BOOLEAN
+ SetChAt (
+ IN WCHAR Char,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ CHNUM
+ Truncate (
+ IN CHNUM Position DEFAULT 0
+ );
+
+ private:
+
+ VOID
+ Construct (
+ );
+
+};
+
+
+#endif // _DYNAMIC_SUB_STRING_
diff --git a/private/utils/ulib/inc/system.hxx b/private/utils/ulib/inc/system.hxx
new file mode 100644
index 000000000..a204e07a1
--- /dev/null
+++ b/private/utils/ulib/inc/system.hxx
@@ -0,0 +1,253 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ system.hxx
+
+Abstract:
+
+ This module contains the definition for the SYSTEM class. The SYSTEM
+ class is an abstract class which offers an interface for communicating
+ with the underlying operating system.
+
+Author:
+
+ David J. Gilman (davegi) 13-Jan-1991
+
+Environment:
+
+ ULIB, User Mode
+
+Notes:
+
+
+
+--*/
+
+#if ! defined( _SYSTEM_ )
+
+#define _SYSTEM_
+
+DECLARE_CLASS( FSN_DIRECTORY );
+DECLARE_CLASS( FSN_FILE );
+DECLARE_CLASS( FSNODE );
+DECLARE_CLASS( WSTRING );
+DECLARE_CLASS( STREAM );
+DECLARE_CLASS( TIMEINFO );
+
+#include "message.hxx"
+#include "path.hxx"
+#include "basesys.hxx"
+
+extern "C" {
+ #include <stdarg.h>
+}
+
+
+
+enum DRIVE_TYPE {
+ UnknownDrive,
+ RemovableDrive,
+ FixedDrive,
+ RemoteDrive,
+ CdRomDrive,
+ RamDiskDrive
+};
+
+enum FILE_TYPE {
+ UnknownFile,
+ DiskFile,
+ CharFile,
+ PipeFile
+};
+
+struct _VOL_SERIAL_NUMBER {
+ ULONG HighOrder32Bits;
+ ULONG LowOrder32Bits;
+};
+
+DEFINE_TYPE( struct _VOL_SERIAL_NUMBER, VOL_SERIAL_NUMBER );
+
+class SYSTEM : public BASE_SYSTEM {
+
+ friend
+ BOOLEAN
+ InitializeUlib(
+ IN HANDLE DllHandle,
+ IN ULONG Reason,
+ IN PVOID Reserved
+ );
+
+ public:
+
+ STATIC
+ ULIB_EXPORT
+ PFSN_DIRECTORY
+ MakeDirectory (
+ IN PCPATH Path,
+ IN PCPATH TemplatePath OPTIONAL
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PFSN_FILE
+ MakeFile (
+ IN PCPATH Path
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PFSN_FILE
+ MakeTemporaryFile (
+ IN PCWSTRING PrefixString,
+ IN PCPATH Path DEFAULT NULL
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ RemoveNode (
+ IN PFSNODE *PointerToNode,
+ IN BOOLEAN Force DEFAULT FALSE
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ IsCorrectVersion (
+ );
+
+ STATIC
+ PPATH
+ QueryCurrentPath (
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PFSN_DIRECTORY
+ QueryDirectory (
+ IN PCPATH Path,
+ IN BOOLEAN GetWhatYouCan DEFAULT FALSE
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PWSTRING
+ QueryEnvironmentVariable (
+ IN PCWSTRING Variable
+ );
+
+
+ STATIC
+ ULIB_EXPORT
+ PPATH
+ QuerySystemDirectory (
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PPATH
+ SearchPath(
+ PWSTRING pFileName,
+ PWSTRING pSearchPath DEFAULT NULL
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PFSN_FILE
+ QueryFile (
+ IN PCPATH Path
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ QueryCurrentDosDriveName(
+ OUT PWSTRING DosDriveName
+ );
+
+ STATIC
+ ULIB_EXPORT
+ DRIVE_TYPE
+ QueryDriveType(
+ IN PCWSTRING DosDriveName
+ );
+
+ STATIC
+ ULIB_EXPORT
+ FILE_TYPE
+ QueryFileType(
+ IN PCWSTRING DosFileName
+ );
+
+ STATIC
+ ULIB_EXPORT
+ PWSTRING
+ QueryVolumeLabel(
+ IN PPATH Path,
+ OUT PVOL_SERIAL_NUMBER SerialNumber
+ );
+
+ STATIC
+ ULIB_EXPORT
+ FARPROC
+ QueryLibraryEntryPoint(
+ IN PCWSTRING LibraryName,
+ IN PCWSTRING EntryPointName,
+ OUT PHANDLE LibraryHandle
+ );
+
+ STATIC
+ ULIB_EXPORT
+ VOID
+ FreeLibraryHandle(
+ IN HANDLE LibraryHandle
+ );
+
+ STATIC
+ BOOLEAN
+ PutStandardStream(
+ IN DWORD StdHandle,
+ IN PSTREAM pStream
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ QueryLocalTimeFromUTime(
+ IN PCTIMEINFO UTimeInfo,
+ OUT PTIMEINFO LocalTimeInfo
+ );
+
+ STATIC
+ BOOLEAN
+ QueryUTimeFromLocalTime(
+ IN PCTIMEINFO LocalTimeInfo,
+ OUT PTIMEINFO UTimeInfo
+ );
+
+ STATIC
+ ULIB_EXPORT
+ BOOLEAN
+ QueryWindowsErrorMessage(
+ IN ULONG WindowsErrorCode,
+ OUT PWSTRING ErrorMessage
+ );
+
+};
+
+
+INLINE
+PPATH
+SYSTEM::QueryCurrentPath (
+ )
+
+{
+ DebugAssert( FALSE );
+ return( NEW PATH );
+}
+
+
+#endif // SYSTEM_DEFN
diff --git a/private/utils/ulib/inc/timeinfo.hxx b/private/utils/ulib/inc/timeinfo.hxx
new file mode 100644
index 000000000..e9bf783b2
--- /dev/null
+++ b/private/utils/ulib/inc/timeinfo.hxx
@@ -0,0 +1,631 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ time.hxx
+
+Abstract:
+
+ This module contains the declaration for the TIMEINFO class.
+ The data members of the TIMEINFO class contain the date and
+ time information represented as a FILETIME structure and a
+ SYSTEMTIME structure. These two representations of date and
+ time are always initialized independently of the way that the
+ TIMEINFO class is initialized (as a FILETIME or a SYSTEMTIME).
+
+Author:
+
+ Jaime Sasson (jaimes) 13-Mar-1991
+
+Environment:
+
+ ULIB, User Mode
+
+
+--*/
+
+
+#if !defined( _TIMEINFO_ )
+
+#define _TIMEINFO_
+
+#include "wstring.hxx"
+
+
+DECLARE_CLASS( TIMEINFO );
+
+
+class TIMEINFO : public OBJECT {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( TIMEINFO );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PFILETIME FileTime
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN PSYSTEMTIME SystemTime
+ );
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ Initialize(
+ IN PCTIMEINFO TimeInfo
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ IN USHORT Year,
+ IN USHORT Month,
+ IN USHORT Day,
+ IN USHORT Hour,
+ IN USHORT Minute,
+ IN USHORT Second,
+ IN USHORT Milliseconds
+ );
+
+
+ NONVIRTUAL
+ SHORT
+ CompareTimeInfo(
+ IN PFILETIME FileTime
+ ) CONST;
+
+
+ NONVIRTUAL
+ SHORT
+ CompareTimeInfo(
+ IN PSYSTEMTIME SystemTime
+ ) CONST;
+
+
+ NONVIRTUAL
+ PFILETIME
+ GetFileTime(
+ ) CONST;
+
+
+ NONVIRTUAL
+ PSYSTEMTIME
+ GetSysTime(
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ IsLeapYear(
+ USHORT Year DEFAULT 0
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryYear(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryMonth(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryDay(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryDayOfWeek(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryHour(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryMinute(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QuerySecond(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryMilliseconds(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryDayOffset(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryDaysInMonth(
+ ) CONST;
+
+
+ NONVIRTUAL
+ USHORT
+ QueryDaysInYear(
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ SetDate(
+ USHORT Year,
+ USHORT Month,
+ USHORT Day
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ SetDate(
+ PCWSTRING Date
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetDateAndTime (
+ PCWSTRING DateAndTime
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ SetTime(
+ USHORT Hour DEFAULT 0,
+ USHORT Minute DEFAULT 0,
+ USHORT Second DEFAULT 0,
+ USHORT Millisecond DEFAULT 0
+ );
+
+
+ NONVIRTUAL
+ BOOLEAN
+ SetTime(
+ PCWSTRING Time
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryTime(
+ OUT PWSTRING FormattedTimeString
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryDate(
+ OUT PWSTRING FormattedDateString
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator== (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ operator!= (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ operator< (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ operator> (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ operator<= (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ NONVIRTUAL
+ BOOLEAN
+ operator>= (
+ IN TIMEINFO TimeInfo
+ ) CONST;
+
+
+ private:
+
+ VOID
+ Construct (
+ );
+
+ FILETIME _FileTime;
+ SYSTEMTIME _SystemTime;
+
+};
+
+
+
+INLINE
+BOOLEAN
+TIMEINFO::IsLeapYear(
+ USHORT Year
+ ) CONST
+
+/*++
+
+Routine Description:
+
+ This member function finds out if the year received as parameter
+ is a leap year.
+
+Arguments:
+
+ Year - Year to be verified. If the year specified is zero, then
+ the year stored in this class is verified.
+
+Return Value:
+
+ BOOLEAN - Indicates if it is a leap year (TRUE) or not (FALSE).
+
+
+--*/
+
+{
+ Year = ( Year == 0 )? (USHORT)_SystemTime.wYear : Year;
+ if( ( ( Year % 400 ) == 0 ) ||
+ ( ( Year % 100 ) != 0 ) && ( ( Year % 4 ) == 0 ) ) {
+ return( TRUE );
+ }
+ else {
+ return( FALSE );
+ }
+}
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryYear(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the year stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the year.
+
+
+--*/
+
+{
+ return( _SystemTime.wYear );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryMonth(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the month stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the month.
+
+
+--*/
+
+{
+ return( _SystemTime.wMonth );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryDay(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the day stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the day.
+
+
+--*/
+
+{
+ return( _SystemTime.wDay );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryDayOfWeek(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the day of the week stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the day of the week.
+
+
+--*/
+
+{
+ return( _SystemTime.wDayOfWeek );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryHour(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the hour stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the hour.
+
+
+--*/
+
+{
+ return( _SystemTime.wHour );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryMinute(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the minutes stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the minutes.
+
+
+--*/
+
+{
+ return( _SystemTime.wMinute );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QuerySecond(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the seconds stored in the data member of this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the secondss.
+
+
+--*/
+
+{
+ return( _SystemTime.wSecond );
+}
+
+
+
+
+INLINE
+USHORT
+TIMEINFO::QueryMilliseconds(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns the number of milliseconds stored in the data member of
+ this class.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ USHORT - Number representing the millisecondss.
+
+
+--*/
+
+{
+ return( _SystemTime.wMilliseconds );
+}
+
+
+
+INLINE
+PFILETIME
+TIMEINFO::GetFileTime(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns a pointer to the data member that contains the file time.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PFILETIME - Pointer to FileTime.
+
+--*/
+
+{
+ return( ( PFILETIME )&_FileTime );
+}
+
+
+
+INLINE
+PSYSTEMTIME
+TIMEINFO::GetSysTime(
+ ) CONST
+
+
+/*++
+
+Routine Description:
+
+ Returns a pointer to the data member that contains the system time.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ PSYSTEMTIME - Pointer to SystemTime.
+
+--*/
+
+{
+ return( ( PSYSTEMTIME )&_SystemTime );
+}
+
+
+
+#endif // _TIMEINFO_
diff --git a/private/utils/ulib/inc/ulib.hxx b/private/utils/ulib/inc/ulib.hxx
new file mode 100644
index 000000000..97ce0ceae
--- /dev/null
+++ b/private/utils/ulib/inc/ulib.hxx
@@ -0,0 +1,152 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ Ulib.hxx
+
+Abstract:
+
+
+Author:
+
+ David J. Gilman (davegi) 22-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if !defined ( _ULIB_DEFINED_ )
+
+#define _ULIB_DEFINED_
+
+//
+// Autocheck implies no windows header files so this helps make up the
+// difference. Autocheck also has a special Debug switch, since
+// it allows printing to the debugger but does not execute any other
+// debug-only code.
+//
+
+#if defined( _AUTOCHECK_ )
+
+#define _NTAPI_ULIB_
+
+#if DBG
+#define _AUTOCHECK_DBG_
+#endif
+
+#undef DBG
+
+#define DBG 0
+
+#else
+
+ #ifndef _NTAPI_ULIB_
+ #define _NTAPI_ULIB_
+ #endif
+
+#endif // _AUTOCHECK_
+
+
+extern "C" {
+
+ #if defined( _NTAPI_ULIB_ )
+
+ #include <nt.h>
+ #include <ntrtl.h>
+ #include <nturtl.h>
+ #include <ntdddisk.h>
+
+ #endif // _NTAPI_ULIB_
+
+ #if !defined( _AUTOCHECK_ )
+
+ #include <windows.h>
+
+ #endif // _AUTOCHECK_
+}
+
+
+//
+// Function prototypes for Ulib non member functions (see ulib.cxx)
+//
+
+extern "C"
+BOOLEAN
+InitializeUlib(
+ IN HANDLE DllHandle,
+ IN ULONG Reason,
+ IN PVOID Reserved
+ );
+
+
+//
+// Intrinsic functions
+//
+#if DBG==0
+
+ #pragma intrinsic( memset, memcpy, memcmp )
+
+#endif
+
+//
+// Here's the scoop...ntdef.h defined NULL to be ( PVOID ) 0.
+// Cfront barfs on this if you try and assign NULL to any other pointer type.
+// This leaves two options (a) cast all NULL assignments or (b) define NULL
+// to be zero which is what C++ expects.
+//
+
+#if defined( NULL )
+
+ #undef NULL
+
+#endif
+#define NULL ( 0 )
+
+//
+// Make sure const is not defined.
+//
+#if defined( const )
+ #undef const
+#endif
+
+#include "ulibdef.hxx"
+#include "object.hxx"
+#include "clasdesc.hxx"
+
+//
+// External definitions for global objects (see ulib.cxx)
+//
+
+DECLARE_CLASS( PATH );
+
+#if !defined( _AUTOCHECK_ )
+
+ DECLARE_CLASS( STREAM );
+
+ //
+ // Standard streams
+ //
+ extern PSTREAM Standard_Input_Stream;
+ extern PSTREAM Standard_Output_Stream;
+ extern PSTREAM Standard_Error_Stream;
+
+#endif // _AUTOCHECK
+
+#if !defined( _AUTOCHECK_ )
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ HANDLE
+ FindFirstFile (
+ IN PCPATH Path,
+ OUT PWIN32_FIND_DATA FileFindData
+ );
+
+#endif // _AUTOCHECK
+
+
+#endif // _ULIB_DEFINED_
diff --git a/private/utils/ulib/inc/ulibcl.hxx b/private/utils/ulib/inc/ulibcl.hxx
new file mode 100644
index 000000000..ca882184e
--- /dev/null
+++ b/private/utils/ulib/inc/ulibcl.hxx
@@ -0,0 +1,40 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ulibcl.hxx
+
+Abstract:
+
+ This module contains declarations that the clients of
+ ULIB.DLL require.
+
+Author:
+
+ Bill McJohn (billmc) 17-May-1991
+
+Environment:
+
+ ULIB Clients, User Mode
+
+--*/
+
+#if ! defined( _ULIBCLIENTDEFN_ )
+
+#define _ULIBCLIENTDEFN_
+
+ULIB_EXPORT
+PSTREAM
+Get_Standard_Input_Stream();
+
+ULIB_EXPORT
+PSTREAM
+Get_Standard_Output_Stream();
+
+ULIB_EXPORT
+PSTREAM
+Get_Standard_Error_Stream();
+
+#endif
diff --git a/private/utils/ulib/inc/ulibdef.hxx b/private/utils/ulib/inc/ulibdef.hxx
new file mode 100644
index 000000000..84c104e8d
--- /dev/null
+++ b/private/utils/ulib/inc/ulibdef.hxx
@@ -0,0 +1,460 @@
+/*++
+
+Copyright (c) 1990 Microsoft Corporation
+
+Module Name:
+
+ ulibdef.hxx
+
+Abstract:
+
+ This module contains primitive support for the ULIB class hierarchy
+ and it's clients. This support includes:
+
+ - type definitions
+ - manifest constants
+ - debugging support
+ - memory leakage support
+ - external references
+
+Author:
+
+ David J. Gilman (davegi) 19-Oct-1990
+
+Environment:
+
+ ULIB, User Mode
+
+--*/
+
+#if ! defined( _ULIBDEF_ )
+
+#define _ULIBDEF_
+
+extern "C" {
+ #include <stdlib.h>
+};
+
+// The ULIB_EXPORT macro marks functions that are to be
+// exported. The source files for ULIB.DLL will have _ULIB_MEMBER_
+// defined; clients will not.
+//
+#if defined ( _AUTOCHECK_ )
+#define ULIB_EXPORT
+#elif defined ( _ULIB_MEMBER_ )
+#define ULIB_EXPORT __declspec(dllexport)
+#else
+#define ULIB_EXPORT __declspec(dllimport)
+#endif
+
+
+
+#pragma warning(disable:4091) // Symbol not defined
+
+//
+// Macros for defining types:
+//
+// - pointers (Ptype)
+// - pointers to constants (PCtype)
+// - references (Rtype)
+// - references to constants (RCtype)
+//
+
+#define DEFINE_POINTER_TYPES( type ) \
+ typedef type* P##type; \
+ typedef const type* PC##type
+
+#define DEFINE_REFERENCE_TYPES( type ) \
+ typedef type& R##type; \
+ typedef const type& RC##type
+
+#define DEFINE_POINTER_AND_REFERENCE_TYPES( type ) \
+ DEFINE_POINTER_TYPES( type ); \
+ DEFINE_REFERENCE_TYPES( type )
+
+#define DEFINE_TYPE( basetype, newtype ) \
+ typedef basetype newtype; \
+ DEFINE_POINTER_AND_REFERENCE_TYPES( newtype )
+
+#define DECLARE_CLASS( c ) \
+ class c; \
+ DEFINE_POINTER_AND_REFERENCE_TYPES( c );\
+ extern PCCLASS_DESCRIPTOR c##_cd
+
+//
+// Primitive types.
+//
+
+DEFINE_TYPE( unsigned char, UCHAR );
+DEFINE_TYPE( unsigned short,USHORT );
+DEFINE_TYPE( unsigned long, ULONG );
+
+DEFINE_TYPE( char, CCHAR );
+DEFINE_TYPE( short, CSHORT );
+DEFINE_TYPE( ULONG, CLONG );
+
+DEFINE_TYPE( short, SSHORT );
+DEFINE_TYPE( long, SLONG );
+
+DEFINE_TYPE( UCHAR, BYTE );
+DEFINE_TYPE( char, STR );
+DEFINE_TYPE( UCHAR, BOOLEAN );
+DEFINE_TYPE( int, INT );
+DEFINE_TYPE( unsigned int, UINT );
+
+DEFINE_TYPE(USHORT, WCHAR );
+
+typedef WCHAR *LPWCH; // pwc
+typedef WCHAR *LPWSTR; // pwsz, 0x0000 terminated UNICODE strings only
+
+DEFINE_POINTER_AND_REFERENCE_TYPES( WCHAR );
+
+DEFINE_TYPE( WCHAR, WSTR );
+//DEFINE_TYPE( struct tagLC_ID, LC_ID );
+
+//
+// Augmented (beyond standard headers) VOID pointer types
+//
+
+DEFINE_POINTER_TYPES( VOID );
+
+//
+// Ulib specific, primitive types
+//
+
+DEFINE_TYPE( STR, CLASS_NAME );
+DEFINE_TYPE( ULONG, CLASS_ID );
+
+
+//
+// Member and non-member function/data modifiers
+//
+
+#define CONST const
+#define NONVIRTUAL
+#define PURE = 0
+#define STATIC static
+#define VIRTUAL virtual
+#define INLINE inline
+// #define INLINE // hack to build for mips
+#define FRIEND friend
+
+//
+// Argument modifiers
+//
+
+#define DEFAULT =
+#define IN
+#define OPTIONAL
+#define OUT
+#define INOUT
+
+#if !defined(max)
+ #define max(a,b) (((a) > (b)) ? (a) : (b) )
+#endif
+
+#if !defined(min)
+ #define min(a,b) (((a) < (b)) ? (a) : (b) )
+#endif
+
+#if DBG==1
+
+ #define REGISTER
+
+#else
+
+ #define REGISTER register
+
+#endif // DBG
+
+//
+// External constants
+//
+
+extern CONST CLASS_ID NIL_CLASS_ID;
+
+//
+// GetFileName returns the file name portion of the supplied path name.
+//
+
+extern "C" {
+ #include <string.h>
+};
+
+inline
+PCCHAR
+GetFileName (
+ IN PCCHAR PathName
+ )
+
+{
+ PCCHAR pch;
+
+ return((( pch = strrchr( PathName, '\\' )) != NULL ) ?
+ pch + 1 : PathName );
+}
+
+//
+// Cast (beProtocol) support
+//
+// If the ID of the passed object is equal to the ID in this class'
+// CLASS_DESCRIPTOR, then the object is of this type and the Cast succeeds
+// (i.e. returns Object) otherwise the Cast fails (i.e. returns NULL)
+//
+
+
+#define DECLARE_CAST_MEMBER_FUNCTION( type ) \
+ STATIC \
+ P##type \
+ Cast ( \
+ PCOBJECT Object \
+ )
+
+
+#define DEFINE_CAST_MEMBER_FUNCTION( type ) \
+ P##type \
+ type::Cast ( \
+ PCOBJECT Object \
+ ) \
+ { \
+ if( Object && ( Object->QueryClassId( ) == \
+ type##_cd->QueryClassId( ))) { \
+ return(( P##type ) Object ); \
+ } else { \
+ return NULL; \
+ } \
+ }
+
+#define DEFINE_EXPORTED_CAST_MEMBER_FUNCTION( type, export ) \
+ P##type \
+ export \
+ type::Cast ( \
+ PCOBJECT Object \
+ ) \
+ { \
+ if( Object && ( Object->QueryClassId( ) == \
+ type##_cd->QueryClassId( ))) { \
+ return(( P##type ) Object ); \
+ } else { \
+ return NULL; \
+ } \
+ }
+
+//
+// Constructor support
+//
+
+//
+// All classes have CLASS_DESCRIPTORS which are static and named
+// after the class appended with the suffix _cd. They are passed stored in
+// OBJECT and are set by the SetClassDescriptor function. The Construct
+// For debugging purposes the class' name is stored in the CLASS_DESCRIPTOR.
+// The Construct member function gas a no-op implementation in OBJECT and
+// could be overloaded as a private member in any derived class.
+//
+
+#define DECLARE_CONSTRUCTOR( c ) \
+ NONVIRTUAL \
+ c ( \
+ )
+
+#define DEFINE_CONSTRUCTOR( d, b ) \
+ PCCLASS_DESCRIPTOR d##_cd; \
+ d::d ( \
+ ) : b( ) \
+ { \
+ SetClassDescriptor( ##d##_cd ); \
+ Construct( ); \
+ }
+
+#define DEFINE_EXPORTED_CONSTRUCTOR( d, b, e ) \
+ PCCLASS_DESCRIPTOR d##_cd; \
+ e d::d ( \
+ ) : b( ) \
+ { \
+ SetClassDescriptor( ##d##_cd ); \
+ Construct( ); \
+ }
+
+
+
+//
+// Debug support.
+//
+// Use the Debug macros to invoke the following debugging functions.
+//
+// DebugAbort( str ) - Print a message and abort.
+// DebugAssert( exp ) - Assert that an expression is TRUE. Abort if FALSE.
+// DebugChkHeap( ) - Validate the heap. Abort if invalid.
+// DebugPrint( str ) - Print a string including location (file/line)
+// DebugPrintf( fmt, ... ) - Printf.
+//
+#if DBG==1
+
+#include <assert.h>
+
+#define DebugAbort( str ) \
+ DebugPrint( str ); \
+ ExitProcess( 99 )
+
+#define DebugAssert( exp ) \
+ assert( exp )
+
+#define DebugCheckHeap( )
+
+#define DebugPrint( str ) \
+ DebugPrintf( "%s in file: %s on line: %d.\n", \
+ str, \
+ __FILE__, \
+ __LINE__ )
+
+
+ULIB_EXPORT
+VOID
+DebugPrintf(
+ IN PCSTR Format,
+ IN ...
+ );
+
+#define DebugPtrAssert( ptr ) \
+ DebugAssert( ptr != NULL )
+
+//
+// UlibGlobalFlag is used to selectively enable debugging options at
+// run-time.
+//
+
+extern ULONG UlibGlobalFlag;
+
+#elif defined( _AUTOCHECK_DBG_ )
+
+// Autocheck uses the system's DbgPrint function.
+//
+#define DebugPrintf DbgPrint
+#define DebugPrint DbgPrint
+
+#define DebugAbort( str )
+
+#define DebugAssert( exp )
+
+#define DebugCheckHeap( )
+
+#define DebugPtrAssert( ptr )
+
+
+#else // DBG == 0 and _AUTOCHECK_DBG_ not defined.
+
+#define DebugAbort( str )
+
+#define DebugAssert( exp )
+
+#define DebugCheckHeap( )
+
+#define DebugPrint( str )
+
+#define DebugPtrAssert( ptr )
+
+inline
+VOID
+DebugPrintf(
+ IN PCSTR Format,
+ IN ...
+ )
+{
+}
+
+#endif // DBG
+
+//
+// DELETE macro that NULLifizes the pointer to the deleted object.
+//
+
+// Undo any previous definitions of DELETE.
+#undef DELETE
+
+// #define DELETE(x) FREE(x), x = NULL;
+
+#define DELETE( x ) \
+ delete x, x = NULL
+
+#define NEW new
+
+#define DumpStats
+
+#if defined( _AUTOCHECK_ )
+
+ #define MALLOC(bytes) (RtlAllocateHeap(RtlProcessHeap(), 0, bytes))
+
+ INLINE
+ PVOID
+ NtlibZeroAlloc(
+ ULONG Size
+ )
+ {
+ PVOID Result;
+
+ Result = MALLOC( Size );
+
+ if( Result != NULL ) {
+
+ memset( Result, 0, Size );
+ }
+
+ return Result;
+ }
+
+
+ #define CALLOC(nitems, size) (NtlibZeroAlloc(nitems*size))
+
+ ULIB_EXPORT PVOID UlibRealloc(PVOID, ULONG);
+
+ #define REALLOC(p,s) UlibRealloc(p,s)
+
+ #define FREE(x) ((x) ? (RtlFreeHeap(RtlProcessHeap(), 0, x), (x) = NULL) : 0)
+
+#else // _AUTOCHECK_ not defined
+
+ #if defined( _NTAPI_ULIB_ )
+
+ #define MALLOC(bytes) (RtlAllocateHeap(RtlProcessHeap(), 0, bytes))
+
+ #define CALLOC(nitems, size) \
+ (RtlAllocateHeap(RtlProcessHeap(), 0, nitems*size))
+
+ ULIB_EXPORT PVOID UlibRealloc(PVOID, ULONG);
+
+ #define REALLOC(p,s) UlibRealloc(p,s)
+
+ #define FREE(x) ((x) ? (RtlFreeHeap(RtlProcessHeap(), 0, x), (x) = NULL) : 0)
+
+ #else
+
+ #define MALLOC(bytes) ((PVOID) LocalAlloc(0, bytes))
+
+ #define CALLOC(nitems, size) ((PVOID) LocalAlloc(LMEM_ZEROINIT, nitems*size))
+
+ ULIB_EXPORT PVOID UlibRealloc(PVOID, ULONG);
+
+ #define REALLOC(x, size) ((PVOID) LocalReAlloc(x, size, LMEM_MOVEABLE))
+
+ #define FREE(x) ((x) ? (LocalFree(x), (x) = NULL) : 0)
+
+ #endif
+
+#endif // _AUTOCHECK
+
+#if !defined(_SETUP_LOADER_) && !defined(_AUTOCHECK_)
+
+__inline void * __cdecl operator new(size_t x)
+{
+ return(MALLOC(x));
+}
+
+__inline void __cdecl operator delete(void * x)
+{
+ FREE(x);
+}
+
+#endif
+
+#endif // _ULIBDEF_
diff --git a/private/utils/ulib/inc/winnls.old b/private/utils/ulib/inc/winnls.old
new file mode 100644
index 000000000..9ca9f7ddd
--- /dev/null
+++ b/private/utils/ulib/inc/winnls.old
@@ -0,0 +1,292 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ winnls.h
+
+Abstract:
+
+ This module defines the 32-Bit Windows NLS APIs.
+
+Author:
+
+ David J. Gilman (davegi) 22-Mar-1991
+
+Revision History:
+
+--*/
+
+#ifndef _WINNLS_
+#define _WINNLS_
+
+//
+// NLSAPI and wide character related types.
+//
+
+typedef char CHAR;
+typedef PDWORD LPWCHAR;
+typedef LPSTR LPCHAR;
+typedef DWORD HLCID;
+typedef DWORD HLOCALE;
+
+
+//
+// Length of locale strings.
+//
+
+#define MAX_LANG_LEN ( 128 )
+#define MAX_CTRY_LEN ( 128 )
+#define MAX_CP_LEN ( 128 )
+
+//
+// String based locale representation.
+//
+
+typedef struct tagLC_STRINGS {
+ CHAR szLanguage[MAX_LANG_LEN]; // language name
+ CHAR szCountry[MAX_CTRY_LEN]; // country name
+ CHAR szCodePage[MAX_CP_LEN]; // codepage name
+} LC_STRINGS, *LPLC_STRINGS, *PLC_STRINGS;
+
+//
+// Code based local representation.
+//
+
+typedef struct tagLC_ID {
+ WORD wLanguage; // language id
+ WORD wCountry; // country id
+ WORD wCodePage; // codepage id
+} LC_ID, *LPLC_ID, *PLC_ID;
+
+//
+// Locale information enumeration type.
+//
+
+#define LI_CPDATA ( 0 )
+#define LI_CTRYDATA ( 1 )
+#define LI_LANGDATA ( 2 )
+
+//
+// Locale information type.
+//
+
+#define LI_CPDATA ( 0 )
+#define LI_CTRYDATA ( 1 )
+#define LI_LANGDATA ( 2 )
+#define LI_LCMONETARY ( 3 )
+#define LI_LCNUMERIC ( 4 )
+#define LI_DATETIMEFMT ( 5 )
+#define LI_DATETIMESTR ( 6 )
+
+//
+// LC_ID and LC_STRINGS indicator.
+//
+
+#define QF_LCID ( 0 )
+#define QF_STRINGS ( 1 )
+
+//
+// Requested character type information.
+//
+#define CT_CTYPE1 ( 1 )
+#define CT_CTYPE2 ( 2 )
+
+//
+// Character type 1 (CT_CTYPE1) information
+//
+
+#define C1_ALPHA ( 0x100 )
+#define C1_CONTROLCHAR ( 0x020 )
+#define C1_DIACRITIC ( 0x200 )
+#define C1_DIGIT ( 0x004 )
+#define C1_LOWERCASE ( 0x002 )
+#define C1_PUNCTUATION ( 0x010 )
+#define C1_WHITESPACE ( 0x008 )
+#define C1_SYMBOL ( 0x400 )
+#define C1_UPPERCASE ( 0x001 )
+
+//
+// Extended character type 1 (CT_CTYPE1) information
+//
+
+#define C1_ALPHNUMERIC ( C1_ALPHA | C1_DIGIT )
+#define C1_GRAPHIC ( C1_PUNCTUATION | C1_ALPHNUMERIC )
+
+//
+// Character type 2 (CT_CTYPE2) information
+//
+
+#define C2_STRONGLEFTTORIGHT ( 0 )
+#define C2_STRONGRIGHTTOLEFT ( 1 )
+#define C2_WEAKLEFTTORIGHT ( 2 )
+#define C2_WEAKRIGHTTOLEFT ( 3 )
+#define C2_NEUTRAL ( 4 )
+#define C2_NUMERICCONTEXT ( 5 )
+#define C2_OPENPUNCTUATION ( 6 )
+#define C2_CLOSEPUNCTUATION ( 7 )
+
+//
+// Extended character type 2 (CT_CTYPE2) information
+//
+
+#define C2_UPSTREAM ( C2_CLOSEPUNCTUATION + 1 )
+#define C2_DOWNSTREAM ( C2_CLOSEPUNCTUATION + 2 )
+#define C2_IDEOGRAPHIC ( C2_CLOSEPUNCTUATION + 3 )
+#define C2_NONBREAKING ( C2_CLOSEPUNCTUATION + 4 )
+
+//
+// Comparison flags
+//
+
+#define CF_IGNORECASE ( 1 )
+#define CF_IGNOREDIACRITIC ( 2 )
+#define CF_IGNORESYMBOLS ( 4 )
+
+//
+// Map types and flags.
+//
+
+#define MAP_COLLATE ( 0 )
+#define MAP_CTYPE1 ( 1 )
+#define MAP_CTYPE2 ( 2 )
+#define MAP_UPPERCASE ( 3 )
+#define MAP_LOWERCASE ( 4 )
+#define MAP_UCTOMB ( 5 )
+#define MAP_MBTOUC ( 6 )
+#define MAP_SORTKEY ( 7 )
+
+//
+// Character traits.
+//
+
+#define STR_IGNORECASE ( 0 )
+#define STR_IGNOREDIACRITIC ( 1 )
+#define STR_IGNORESYMBOLS ( 2 )
+
+//
+// Low level NLSAPI routines.
+//
+
+HLCID
+BeginEnumLocale(
+ DWORD dwEnumType,
+ LPLC_ID lpLCID
+ );
+
+BOOL
+GetNextLocale(
+ HLCID hEnumHandle,
+ LPLC_ID lpLCID
+ );
+
+BOOL
+EndEnumLocale(
+ HLCID hEnumHandle
+ );
+
+DWORD
+GetLocaleInfo(
+ LPLC_ID lpLocale,
+ DWORD dwLCType,
+ LPVOID pvLCData,
+ DWORD cbBuf
+ );
+
+BOOL
+GetQualifiedLocale(
+ WORD wType,
+ LPVOID lpInput,
+ LPLC_ID lpOutID,
+ LPLC_STRINGS lpOutStr
+ );
+
+//
+// High level NLSAPI routines.
+//
+
+BOOL
+GetCharType(
+ HLOCALE hLocale,
+ WORD wInfoType,
+ WCHAR wcChar,
+ LPWORD lpCharType
+ );
+
+BOOL
+CloseLocale(
+ HLOCALE hLocale
+ );
+
+int
+CompareString(
+ HLOCALE hLocale,
+ DWORD dwCmpFlags,
+ LPWSTR lpwstrString1,
+ int nCount1,
+ LPWSTR lpwstrString2,
+ int nCount2
+ );
+
+int
+QueryMap(
+ HLOCALE hLocale,
+ WORD wMapType,
+ WORD wMapFlags,
+ WCHAR wcBeginMap,
+ WCHAR wcEndMap,
+ LPVOID pvOutMap,
+ DWORD dwOutSize
+ );
+
+int
+MapString(
+ HLOCALE hLocale,
+ DWORD dwMapFlags,
+ LPWSTR lpWCSrcStr,
+ int nWCSrc,
+ LPWSTR lpWCDestStr,
+ int nWCDest
+ );
+
+HLOCALE
+OpenLocale(
+ LPLC_ID lpLCID
+ );
+
+//
+// MBCS Support NLSAPI Routines
+//
+
+int
+WideCharToMultiByte(
+ WORD wCodePage,
+ LPWSTR lpWideCharStr,
+ int nWideChar,
+ LPSTR lpMultiByteStr,
+ int nChar,
+ LPCHAR lpDefaultChar
+ );
+
+int
+MultiByteToWideChar(
+ WORD wCodePage,
+ LPSTR lpMultiByteStr,
+ int nChar,
+ LPWSTR lpWideCharStr,
+ int nWideChar
+ );
+
+int
+MultiByteToMultiByte(
+ WORD wTranslations,
+ WORD wSrcCodePage,
+ LPSTR lpSrcString,
+ int nSrcChar,
+ WORD wDestCodePage,
+ LPSTR wDestString,
+ int nDestChar
+ );
+
+#endif // _WINNLS_
diff --git a/private/utils/ulib/inc/wstring.hxx b/private/utils/ulib/inc/wstring.hxx
new file mode 100644
index 000000000..d62283413
--- /dev/null
+++ b/private/utils/ulib/inc/wstring.hxx
@@ -0,0 +1,1250 @@
+/*++
+
+Copyright (c) 1992 Microsoft Corporation
+
+Module Name:
+
+ wstring.hxx
+
+Abstract:
+
+ This module defines the new WSTRING hierarchy:
+
+ WSTRING
+ FSTRING
+ DSTRING
+
+ WSTRING provides all of the desired methods on a string.
+ FSTRING provides an implementation of a WSTRING with fixed
+ size, user provided buffer.
+ DSTRING provides an implementation of a WSTRING with a
+ dynamic heap based buffer.
+
+
+ WSTRING is an abstract classes who's methods depend on the
+ implementation of two pure virtual methods: 'Resize' and 'NewBuf'.
+ A derived class must make use of the protected 'PutString' methods
+ in order to supply WSTRING with its string buffer. Use of
+ 'PutString' is constrained as follows:
+
+ 1. Supplying just a PWSTR to 'PutString' implies that
+ the PWSTR is null-terminated.
+ 2. Supplying a PWSTR and length to 'PutString' implies that
+ the PWSTR points to a buffer of characters that is at
+ least one longer than the given length.
+
+
+ All implementations of 'Resize' and 'NewBuf' must:
+
+ 1. Allocate an extra character for the NULL.
+ 2. NULL-terminate the buffer allocated.
+ 3. Always succeed if size <= current buffer size.
+ 4. Always work as soon as the derived class is initialized (i.e.
+ WSTRING::Initialize method need not be called.).
+ 5. Supply the buffer to WSTRING via 'PutString'.
+
+ Additionally 'Resize' must:
+
+ 1. Preserve the contents of the current buffer.
+
+ All of the comparison operators supplied by WSTRING are
+ case insensitive.
+
+Author:
+
+ Norbert P. Kusters (norbertk) 6-Aug-92
+
+--*/
+
+#if !defined(_WSTRING_DEFN_)
+
+#define _WSTRING_DEFN_
+
+
+//
+// The type of the index used to access individual characters within
+// a generic string.
+//
+DEFINE_TYPE( ULONG, CHNUM );
+
+
+//
+// Magic constants
+//
+#define INVALID_CHAR ((WCHAR)(-1))
+#define INVALID_CHNUM ((CHNUM)(-1))
+#define TO_END INVALID_CHNUM
+
+
+DECLARE_CLASS( WSTRING );
+
+class WSTRING : public OBJECT {
+
+ public:
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PCWSTRING InitialString,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PCWSTR InitialString,
+ IN CHNUM StringLength DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN PCSTR InitialString,
+ IN CHNUM StringLength DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ BOOLEAN
+ Initialize(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Initialize(
+ IN LONG Number
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ QueryString(
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ QueryNumber(
+ OUT PLONG Number,
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ QueryChCount(
+ ) CONST;
+
+
+#ifdef DBCS
+ NONVIRTUAL
+ ULIB_EXPORT
+ CHNUM
+ QueryByteCount(
+ ) CONST;
+#endif
+
+ NONVIRTUAL
+ CHNUM
+ SyncLength(
+ );
+
+ NONVIRTUAL
+ WCHAR
+ QueryChAt(
+ IN CHNUM Position
+ ) CONST;
+
+ NONVIRTUAL
+ WCHAR
+ SetChAt(
+ IN WCHAR Char,
+ IN CHNUM Position
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ VOID
+ DeleteChAt(
+ IN CHNUM Position,
+ IN CHNUM Length DEFAULT 1
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ InsertString(
+ IN CHNUM AtPosition,
+ IN PCWSTRING String,
+ IN CHNUM FromPosition DEFAULT 0,
+ IN CHNUM FromLength DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Replace(
+ IN CHNUM AtPosition,
+ IN CHNUM AtLength,
+ IN PCWSTRING String,
+ IN CHNUM FromPosition DEFAULT 0,
+ IN CHNUM FromLength DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ PCWSTR
+ GetWSTR(
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTR
+ QueryWSTR(
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ OUT PWSTR Buffer DEFAULT NULL,
+ IN CHNUM BufferLength DEFAULT 0,
+ IN BOOLEAN ForceNull DEFAULT TRUE
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PSTR
+ QuerySTR(
+ IN CHNUM Position DEFAULT 0,
+ IN CHNUM Length DEFAULT TO_END,
+ OUT PSTR Buffer DEFAULT NULL,
+ IN CHNUM BufferLength DEFAULT 0,
+ IN BOOLEAN ForceNull DEFAULT TRUE
+ ) CONST;
+
+ NONVIRTUAL
+ LONG
+ Strcmp(
+ IN PCWSTRING String
+ ) CONST;
+
+ STATIC
+ INT
+ Strcmp(
+ IN PWSTR String1,
+ IN PWSTR String2
+ ) ;
+
+ STATIC
+ INT
+ Stricmp(
+ IN PWSTR String1,
+ IN PWSTR String2
+ ) ;
+
+ NONVIRTUAL
+ LONG
+ Strcmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition
+ ) CONST;
+
+ NONVIRTUAL
+ LONG
+ Strcmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition,
+ IN CHNUM LeftLength,
+ IN CHNUM RightPosition DEFAULT 0,
+ IN CHNUM RightLength DEFAULT TO_END
+ ) CONST;
+
+ NONVIRTUAL
+ LONG
+ Stricmp(
+ IN PCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ LONG
+ Stricmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition
+ ) CONST;
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ LONG
+ Stricmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition,
+ IN CHNUM LeftLength,
+ IN CHNUM RightPosition DEFAULT 0,
+ IN CHNUM RightLength DEFAULT TO_END
+ ) CONST;
+
+ ULIB_EXPORT
+ STATIC
+ INT
+ Strcmps(
+ IN PWSTR p1,
+ IN PWSTR p2
+ );
+
+ ULIB_EXPORT
+ STATIC
+ INT
+ Strcmpis(
+ IN PWSTR p1,
+ IN PWSTR p2
+ );
+
+ STATIC
+ PWSTR
+ SkipWhite(
+ IN PWSTR p
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Strcat(
+ IN PCWSTRING String
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ Strupr(
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ Strupr(
+ IN CHNUM StartPosition,
+ IN CHNUM Length DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ PWSTRING
+ Strlwr(
+ );
+
+ NONVIRTUAL
+ ULIB_EXPORT
+ PWSTRING
+ Strlwr(
+ IN CHNUM StartPosition,
+ IN CHNUM Length DEFAULT TO_END
+ );
+
+ NONVIRTUAL
+ CHNUM
+ Strchr(
+ IN WCHAR Char,
+ IN CHNUM StartPosition DEFAULT 0
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ Strrchr(
+ IN WCHAR Char,
+ IN CHNUM StartPosition DEFAULT 0
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ Strstr(
+ IN PCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ Strspn(
+ IN PCWSTRING String,
+ IN CHNUM StartPosition DEFAULT 0
+ ) CONST;
+
+ NONVIRTUAL
+ CHNUM
+ Strcspn(
+ IN PCWSTRING String,
+ IN CHNUM StartPosition DEFAULT 0
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator==(
+ IN RCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator!=(
+ IN RCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator<(
+ IN RCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator>(
+ IN RCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator<=(
+ IN RCWSTRING String
+ ) CONST;
+
+ NONVIRTUAL
+ BOOLEAN
+ operator>=(
+ IN RCWSTRING String
+ ) CONST;
+
+ VIRTUAL
+ BOOLEAN
+ Resize(
+ IN CHNUM NewStringLength
+ ) PURE;
+
+ VIRTUAL
+ BOOLEAN
+ NewBuf(
+ IN CHNUM NewStringLength
+ ) PURE;
+
+ NONVIRTUAL
+ CHNUM
+ Truncate(
+ IN CHNUM Position DEFAULT 0
+ );
+
+ STATIC
+ ULIB_EXPORT
+ VOID
+ SetAnsiConversions(
+ );
+
+ STATIC
+ ULIB_EXPORT
+ VOID
+ SetOemConversions(
+ );
+
+ STATIC
+ ULIB_EXPORT
+ VOID
+ SetConsoleConversions(
+ );
+
+#if defined DBCS
+ STATIC
+ ULIB_EXPORT
+ VOID
+ ResetConversions(
+ );
+#endif // DBCS
+
+ protected:
+
+ DECLARE_CONSTRUCTOR( WSTRING );
+
+ NONVIRTUAL
+ VOID
+ Construct(
+ );
+
+ NONVIRTUAL
+ VOID
+ PutString(
+ IN OUT PWSTR String
+ );
+
+ NONVIRTUAL
+ VOID
+ PutString(
+ IN OUT PWSTR String,
+ IN CHNUM Length
+ );
+
+ private:
+
+ STATIC BOOLEAN _UseAnsiConversions;
+ STATIC BOOLEAN _UseConsoleConversions;
+#if defined DBCS
+ STATIC BOOLEAN _UseAnsiConversionsPrev;
+ STATIC BOOLEAN _UseConsoleConversionsPrev;
+#endif // DBCS
+
+#if defined DBCS
+ STATIC
+ INT
+ CheckSpace(
+ IN PWSTR p
+ );
+#endif // DBCS
+
+ STATIC
+ BOOLEAN
+ ConvertOemToUnicodeN(
+ PWSTR UnicodeString,
+ ULONG MaxBytesInUnicodeString,
+ PULONG BytesInUnicodeString,
+ PCHAR OemString,
+ ULONG BytesInOemString
+ );
+
+ STATIC
+ BOOLEAN
+ ConvertUnicodeToOemN(
+ PCHAR OemString,
+ ULONG MaxBytesInOemString,
+ PULONG BytesInOemString,
+ PWSTR UnicodeString,
+ ULONG BytesInUnicodeString
+ );
+
+ PWSTR _s; // Beginning of string.
+ CHNUM _l; // Strlen of string.
+
+};
+
+
+INLINE
+VOID
+WSTRING::PutString(
+ IN OUT PWSTR String
+ )
+/*++
+
+Routine Description:
+
+ This routine initializes this string with the given null
+ terminated buffer.
+
+Arguments:
+
+ String - Supplies the buffer to initialize the string with.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _s = String;
+ _l = wcslen(_s);
+}
+
+
+INLINE
+VOID
+WSTRING::PutString(
+ IN OUT PWSTR String,
+ IN CHNUM Length
+ )
+/*++
+
+Routine Description:
+
+ This routine initializes this string with the given buffer
+ and string length.
+
+Arguments:
+
+ String - Supplies the buffer to initialize the string with.
+ Length - Supplies the length of the string.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _s = String;
+ _l = Length;
+ _s[_l] = 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::Initialize(
+ )
+/*++
+
+Routine Description:
+
+ This routine initializes this string to an empty null-terminated
+ string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ FALSE - Failure.
+ TRUE - Success.
+
+--*/
+{
+ return Resize(0);
+}
+
+
+INLINE
+CHNUM
+WSTRING::QueryChCount(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the number of characters in the string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The number of characters in this string.
+
+--*/
+{
+ return _l;
+}
+
+
+INLINE
+CHNUM
+WSTRING::SyncLength(
+ )
+/*++
+
+Routine Description:
+
+ This routine recalculates the correct length of the string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ The recomputed length of the string.
+
+--*/
+{
+ return _l = wcslen(_s);
+}
+
+
+INLINE
+WCHAR
+WSTRING::QueryChAt(
+ IN CHNUM Position
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the character at the given position.
+ The position is a zero-based index into the string.
+ The position must be in the range of the string.
+
+Arguments:
+
+ Position - Supplies an index into the string.
+
+Return Value:
+
+ The character at the given position.
+
+--*/
+{
+ return (Position < _l) ? _s[Position] : INVALID_CHAR;
+}
+
+
+INLINE
+WCHAR
+WSTRING::SetChAt(
+ IN WCHAR Char,
+ IN CHNUM Position
+ )
+/*++
+
+Routine Description:
+
+ This routine sets the given character at the given position in
+ the string.
+
+Arguments:
+
+ Char - Supplies the character to set into the string.
+ Position - Supplies the position at which to set the character.
+
+Return Value:
+
+ The character that was set.
+
+--*/
+{
+ DebugAssert(Position < _l);
+ return _s[Position] = Char;
+}
+
+
+INLINE
+PCWSTR
+WSTRING::GetWSTR(
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns this string internal buffer.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ A pointer to the strings buffer.
+
+--*/
+{
+ return _s;
+}
+
+
+INLINE
+LONG
+WSTRING::Strcmp(
+ IN PCWSTRING String
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine compares two strings.
+
+Arguments:
+
+ String - Supplies the string to compare to.
+
+Return Value:
+
+ < 0 - This string is less than the given string.
+ 0 - This string is equal to the given string.
+ > 0 - This string is greater than the given string.
+
+--*/
+{
+ return wcscoll(_s, String->_s);
+}
+
+
+INLINE
+INT
+WSTRING::Strcmp(
+ IN PWSTR String1,
+ IN PWSTR String2
+ )
+{
+ return wcscoll( String1, String2 );
+}
+
+INLINE
+INT
+WSTRING::Stricmp(
+ IN PWSTR String1,
+ IN PWSTR String2
+ )
+{
+ return _wcsicoll( String1, String2 );
+}
+
+INLINE
+LONG
+WSTRING::Strcmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine compares two strings. It starts comparing the
+ current string at the given position.
+
+Arguments:
+
+ String - Supplies the string to compare to.
+ LeftPosition - Supplies the starting position to start comparison
+ on the current string.
+
+Return Value:
+
+ < 0 - This string is less than the given string.
+ 0 - This string is equal to the given string.
+ > 0 - This string is greater than the given string.
+
+--*/
+{
+ return wcscoll(_s + LeftPosition, String->_s);
+}
+
+
+INLINE
+LONG
+WSTRING::Stricmp(
+ IN PCWSTRING String
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine compares two strings insensitive of case.
+
+Arguments:
+
+ String - Supplies the string to compare to.
+
+Return Value:
+
+ < 0 - This string is less than the given string.
+ 0 - This string is equal to the given string.
+ > 0 - This string is greater than the given string.
+
+--*/
+{
+ return _wcsicoll(_s, String->_s);
+}
+
+
+INLINE
+LONG
+WSTRING::Stricmp(
+ IN PCWSTRING String,
+ IN CHNUM LeftPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine compares two strings insensitive of case.
+
+Arguments:
+
+ String - Supplies the string to compare to.
+ LeftPosition - Supplies the position in this string to start
+ comparison.
+
+Return Value:
+
+ < 0 - This string is less than the given string.
+ 0 - This string is equal to the given string.
+ > 0 - This string is greater than the given string.
+
+--*/
+{
+ return _wcsicoll(_s + LeftPosition, String->_s);
+}
+
+
+INLINE
+PWSTRING
+WSTRING::Strupr(
+ )
+/*++
+
+Routine Description:
+
+ This routine uppercases this string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _wcsupr(_s);
+ return this;
+}
+
+
+INLINE
+PWSTRING
+WSTRING::Strlwr(
+ )
+/*++
+
+Routine Description:
+
+ This routine lowercases this string.
+
+Arguments:
+
+ None.
+
+Return Value:
+
+ None.
+
+--*/
+{
+ _wcslwr(_s);
+ return this;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Strchr(
+ IN WCHAR Char,
+ IN CHNUM StartPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the position of the first occurance of
+ the given character.
+
+Arguments:
+
+ Char - Supplies the character to find.
+
+Return Value:
+
+ The position of the given character or INVALID_CHNUM.
+
+--*/
+{
+ PWSTR p;
+
+ DebugAssert(StartPosition <= _l);
+ p = wcschr(_s + StartPosition, Char);
+ return p ? (p - _s) : INVALID_CHNUM;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Strrchr(
+ IN WCHAR Char,
+ IN CHNUM StartPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the position of the last occurance of
+ the given character.
+
+Arguments:
+
+ Char - Supplies the character to find.
+
+Return Value:
+
+ The position of the given character or INVALID_CHNUM.
+
+--*/
+{
+ PWSTR p;
+
+ p = wcsrchr(_s + StartPosition, Char);
+ return p ? (p - _s) : INVALID_CHNUM;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Strstr(
+ IN PCWSTRING String
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine finds the given string withing this string.
+
+Arguments:
+
+ String - Supplies the string to find.
+
+Return Value:
+
+ The position of the given string in this string or INVALID_CHNUM.
+
+--*/
+{
+ PWSTR p;
+
+ p = wcsstr(_s, String->_s);
+ return p ? (p - _s) : INVALID_CHNUM;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Strspn(
+ IN PCWSTRING String,
+ IN CHNUM StartPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the position of the first character in this
+ string that does not belong to the set of characters in the given
+ string.
+
+Arguments:
+
+ String - Supplies the list of characters to search for.
+
+Return Value:
+
+ The position of the first character found that does not belong
+ to the given string.
+
+--*/
+{
+ CHNUM r;
+
+ DebugAssert(StartPosition <= _l);
+ r = wcsspn(_s + StartPosition, String->_s) + StartPosition;
+ return r < _l ? r : INVALID_CHNUM;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Strcspn(
+ IN PCWSTRING String,
+ IN CHNUM StartPosition
+ ) CONST
+/*++
+
+Routine Description:
+
+ This routine returns the position of the first character in this
+ string that belongs to the set of characters in the given
+ string.
+
+Arguments:
+
+ String - Supplies the list of characters to search for.
+
+Return Value:
+
+ Returns the position of the first character in this string
+ belonging to the given string or INVALID_CHNUM.
+
+--*/
+{
+ CHNUM r;
+
+ DebugAssert(StartPosition <= _l);
+ r = wcscspn(_s + StartPosition, String->_s) + StartPosition;
+ return r < _l ? r : INVALID_CHNUM;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator==(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) == 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator!=(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) != 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator<(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) < 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator>(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) > 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator<=(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) <= 0;
+}
+
+
+INLINE
+BOOLEAN
+WSTRING::operator>=(
+ IN RCWSTRING String
+ ) CONST
+{
+ return Stricmp(&String) >= 0;
+}
+
+
+INLINE
+CHNUM
+WSTRING::Truncate(
+ IN CHNUM Position
+ )
+{
+ DebugAssert(Position <= _l);
+ Resize(Position);
+ return _l;
+}
+
+
+DECLARE_CLASS( FSTRING );
+
+class FSTRING : public WSTRING {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( FSTRING );
+
+ NONVIRTUAL
+ PWSTRING
+ Initialize(
+ IN OUT PWSTR InitialString,
+ IN CHNUM BufferLength DEFAULT TO_END
+ );
+
+ VIRTUAL
+ ULIB_EXPORT
+ BOOLEAN
+ Resize(
+ IN CHNUM NewStringLength
+ );
+
+ VIRTUAL
+ BOOLEAN
+ NewBuf(
+ IN CHNUM NewStringLength
+ );
+
+ private:
+
+ CHNUM _buffer_length;
+
+};
+
+
+INLINE
+PWSTRING
+FSTRING::Initialize(
+ IN OUT PWSTR InitialString,
+ IN CHNUM BufferLength
+ )
+/*++
+
+Routine Description:
+
+ This routine initializes this class with a null-terminated
+ unicode string. This routine does not make a copy of the string
+ but uses it as is.
+
+Arguments:
+
+ NullTerminatedString - Supplies a null-terminated unicode string.
+ BufferLength - Supplies the buffer length.
+
+Return Value:
+
+ A pointer to this class.
+
+--*/
+{
+ PutString(InitialString);
+ _buffer_length = ((BufferLength == TO_END) ?
+ (QueryChCount() + 1) : BufferLength);
+ return this;
+}
+
+
+DECLARE_CLASS( DSTRING );
+
+class DSTRING : public WSTRING {
+
+ public:
+
+ ULIB_EXPORT
+ DECLARE_CONSTRUCTOR( DSTRING );
+
+ VIRTUAL
+ ULIB_EXPORT
+ ~DSTRING(
+ );
+
+ VIRTUAL
+ BOOLEAN
+ Resize(
+ IN CHNUM NewStringLength
+ );
+
+ VIRTUAL
+ BOOLEAN
+ NewBuf(
+ IN CHNUM NewStringLength
+ );
+
+ private:
+
+ VOID
+ Construct(
+ );
+
+ PWSTR _buf; // String buffer.
+ CHNUM _length; // Number of characters in buffer.
+
+};
+
+
+#endif // _WSTRING_DEFN_