They were moved to the "press-media" and "project-tools" repositories now.
svn path=/trunk/; revision=49986
+++ /dev/null
-// irc_test.cpp
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 )
-#endif//_MSC_VER
-
-#include <time.h>
-#include <stdio.h>
-
-#include "File.h"
-#include "ssprintf.h"
-#include "trim.h"
-
-#include "IRCClient.h"
-#include "config.h"
-
-using std::string;
-using std::vector;
-
-//vector<string> tech, module, dev, stru, period, status, type, func, irql, curse, cursecop;
-
-class List
-{
-public:
- string name;
- bool macro;
- std::vector<std::string> list;
- string tag;
- int last;
- List() { last = -1; }
- List ( const char* _name, bool _macro ) : name(_name), macro(_macro)
- {
- tag = ssprintf("%%%s%%",_name);
- last = -1;
- }
-};
-
-vector<List> lists;
-vector<string> ops;
-
-void ImportList ( const char* listname, bool macro )
-{
- lists.push_back ( List ( listname, macro ) );
- List& list = lists.back();
- File f ( ssprintf("%s.txt",listname).c_str(), "r" );
- string line;
- while ( f.next_line ( line, true ) )
- list.list.push_back ( line );
-}
-
-const char* ListRand ( List& list )
-{
- vector<string>& l = list.list;
- if ( !l.size() )
- {
- static string nothing;
- nothing = ssprintf ( "<list '%s' empty>", list.name.c_str() );
- return nothing.c_str();
- }
- else if ( l.size() == 1 )
- return l[0].c_str();
- int sel = list.last;
- while ( sel == list.last )
- sel = rand()%l.size();
- list.last = sel;
- return l[sel].c_str();
-}
-
-const char* ListRand ( int i )
-{
- return ListRand ( lists[i] );
-}
-
-int GetListIndex ( const char* listname )
-{
- for ( int i = 0; i < lists.size(); i++ )
- {
- if ( !stricmp ( lists[i].name.c_str(), listname ) )
- return i;
- }
- return -1;
-}
-
-List& GetList ( const char* listname )
-{
- return lists[GetListIndex(listname)];
-}
-
-const char* ListRand ( const char* list )
-{
- int i = GetListIndex ( list );
- if ( i < 0 )
- return NULL;
- return ListRand(i);
-}
-
-string TaggedReply ( const char* listname )
-{
- string t = ListRand(listname);
- string out;
- const char* p = t.c_str();
- while ( *p )
- {
- if ( *p == '%' )
- {
- bool found = false;
- for ( int i = 0; i < lists.size() && !found; i++ )
- {
- if ( lists[i].macro && !strnicmp ( p, lists[i].tag.c_str(), lists[i].tag.size() ) )
- {
- out += ListRand(i);
- p += lists[i].tag.size();
- found = true;
- }
- }
- if ( !found )
- out += *p++;
- }
- const char* p2 = strchr ( p, '%' );
- if ( !p2 )
- p2 = p + strlen(p);
- if ( p2 > p )
- {
- out += string ( p, p2-p );
- p = p2;
- }
- }
- return out;
-}
-
-string gobble ( string& s, const char* delim )
-{
- const char* p = s.c_str();
- p += strspn ( p, delim );
- const char* p2 = strpbrk ( p, delim );
- if ( !p2 ) p2 = p + strlen(p);
- string out ( p, p2-p );
- p2 += strspn ( p2, delim );
- s = string ( p2 );
- return out;
-}
-
-bool isop ( const string& who )
-{
- for ( int i = 0; i < ops.size(); i++ )
- {
- if ( ops[i] == who )
- return true;
- }
- return false;
-}
-
-
-// do custom stuff with the IRCClient from your subclass via the provided callbacks...
-class MyIRCClient : public IRCClient
-{
- File flog;
- clock_t brake_silence;
-
- // wait another 30 mins to brake the silence
- #define NOIDLE brake_silence = clock () + 30 * CLK_TCK * 60
-
- void CheckIdle ( void )
- {
- while (true) // _inRun
- {
- while (clock() < brake_silence)
- Sleep(10000);
-
- string out = TaggedReply("idle");
-
- if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
- Action ( CHANNEL, &out[4] );
- else
- PrivMsg ( CHANNEL, out );
-
- NOIDLE;
- }
- }
-
- static void THREADAPI CallMe ( MyIRCClient* irc )
- {
- irc->CheckIdle();
- }
-
-public:
-
- MyIRCClient()
- {
- NOIDLE;
- ThreadPool::Instance().Launch ( (ThreadPoolFunc*)MyIRCClient::CallMe, this );
- flog.open ( "arch.log", "r+" );
- }
- // see IRCClient.h for documentation on these callbacks...
- bool OnConnected()
- {
- return true;
- }
- bool OnJoin ( const string& user, const string& channel )
- {
- //printf ( "user '%s' joined channel '%s'\n", user.c_str(), channel.c_str() );
- return true;
- }
- bool OnPart ( const std::string& user, const std::string& channel )
- {
- std::vector<std::string>::iterator it = ops.begin();
- for ( ; it != ops.end(); it++ )
- {
- if ( *it == user )
- {
- printf ( "remove '%s' to ops list\n", user.c_str() );
- ops.erase ( it );
- }
- }
- return true;
- }
- bool OnNick ( const std::string& oldNick, const std::string& newNick )
- {
- for ( int i = 0; i < ops.size(); i++ )
- {
- if ( ops[i] == oldNick )
- {
- printf ( "op '%s' changed nick to '%s'\n", oldNick.c_str(), newNick.c_str() );
- ops[i] = newNick;
- return true;
- }
- }
- return true;
- }
- bool OnEndChannelUsers ( const string& channel )
- {
- return true;
- }
- bool OnPrivMsg ( const string& from, const string& text )
- {
- //flog.flush();
- printf ( "<%s> %s\n", from.c_str(), text.c_str() );
- flog.printf ( "<%s> %s\n", from.c_str(), text.c_str() );
-
- if ( !isop(from) )
- return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
-
- else if ( strnicmp ( text.c_str(), "!say ", 5 ) )
- return PrivMsg ( from, "Talk to me on normal Chanel" );
-
- string say = trim(&text[5]);
-
- if ( !strnicmp ( say.c_str(), "/me ", 4 ) )
- return Action ( CHANNEL, trim(&say[4]) );
- else
- return PrivMsg ( CHANNEL, trim(say) );
- }
- bool OnChannelMsg ( const string& channel, const string& from, const string& text )
- {
- fflush ( flog );
- printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
- flog.printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
- NOIDLE; // add 30 mins till idle
-
- bool found_name = false;
- string text2 ( text );
- strlwr ( &text2[0] );
-
- if ( !strnicmp ( text.c_str(), BOTNAME, strlen(BOTNAME) ) )
- found_name = true;
-
- string s ( text );
-
- if ( found_name )
- gobble ( s, " \t" ); // remove bot name
-
- // command
- if ( s[0] == '!' )
- {
- bool from_op = isop(from);
- string cmd = gobble ( s, " \t" );
-
- // from all
- if ( false && cmd == "!svn" && from == "TechBot" ) // || cmd == "!help" && !TechBotOnline
- {
- PrivMsg ( channel, "For my help try !what." );
- }
-
- // from normel user
- else if ( !from_op )
- {
- if ( cmd == "!grovel" )
- {
- string out = ssprintf(TaggedReply("nogrovel").c_str(),from.c_str());
- if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
- return Action ( channel, &out[4] );
- else
- return PrivMsg ( channel, out );
- }
-
- else if ( cmd == "!what" )
- {
- return PrivMsg ( channel, ssprintf("For you, %s, I only support the \"!grovel\" command.", from.c_str()).c_str() );
- }
-
- else if ( cmd == "!grovel" || cmd == "!kiss" || cmd == "!hug"
- || cmd == "!give" || cmd == "!what" || cmd == "!add" || cmd == "!remove" )
- {
- PrivMsg ( channel, ssprintf("%s: I only take commands from ops",from.c_str()) );
- }
- }
-
- // from op
- else if ( cmd == "!grovel" )
- {
- string out = ssprintf(TaggedReply("grovel").c_str(),from.c_str());
- if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
- return Action ( channel, &out[4] );
- else
- return PrivMsg ( channel, out );
- }
- else if ( cmd == "!kiss" )
- {
- if ( s.size() )
- return Action ( channel, ssprintf("kisses %s",s.c_str()) );
- else
- return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
- }
- else if ( cmd == "!hug" )
- {
- if ( s.size() )
- return Action ( channel, ssprintf("hugs %s",s.c_str()) );
- else
- return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
- }
- else if ( cmd == "!give" )
- {
- string who = gobble(s," \t");
- if ( who.size() && s.size() )
- return Action ( channel, ssprintf("gives %s a %s",who.c_str(),s.c_str()) );
- else
- return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
- }
- else if ( cmd == "!what" )
- {
- PrivMsg ( channel, "For ops I support the following commands:" );
- PrivMsg ( channel, "!grovel" );
- PrivMsg ( channel, "!kiss" );
- PrivMsg ( channel, "!hug" );
- PrivMsg ( channel, "!give" );
- PrivMsg ( channel, "!say (the input is a private message)" );
- PrivMsg ( channel, "!add" );
- PrivMsg ( channel, "!remove" );
- PrivMsg ( channel, " - for more info see wiki" );
- }
- else if ( cmd == "!add" )
- {
- string listname = gobble ( s, " \t" );
- int i = GetListIndex ( listname.c_str() );
- if ( i == -1 )
- return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
- List& list = lists[i];
- if ( s[0] == '\"' || s[0] == '\'' )
- {
- char delim = s[0];
- const char* p = &s[1];
- const char* p2 = strchr ( p, delim );
- if ( !p2 )
- return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
- s = string ( p, p2-p );
- }
- for ( i = 0; i < list.list.size(); i++ )
- {
- if ( list.list[i] == s )
- return PrivMsg ( channel, ssprintf("%s: entry already exists in list '%s'",from.c_str(),listname.c_str()) );
- }
- if ( !stricmp ( listname.c_str(), "curse" ) )
- strlwr ( &s[0] );
- list.list.push_back ( s );
- {
- File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
- for ( i = 0; i < list.list.size(); i++ )
- f.printf ( "%s\n", list.list[i].c_str() );
- }
- return PrivMsg ( channel, ssprintf("%s: entry added to list '%s'",from.c_str(),listname.c_str()) );
- }
- else if ( cmd == "!remove" )
- {
- string listname = gobble ( s, " \t" );
- int i = GetListIndex ( listname.c_str() );
- if ( i == -1 )
- return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
- List& list = lists[i];
- if ( s[0] == '\"' || s[0] == '\'' )
- {
- char delim = s[0];
- const char* p = &s[1];
- const char* p2 = strchr ( p, delim );
- if ( !p2 )
- return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
- s = string ( p, p2-p );
- }
- std::vector<std::string>::iterator it = list.list.begin();
- for ( ; it != list.list.end(); it++ )
- {
- if ( *it == s )
- {
- list.list.erase ( it );
- {
- File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
- it = list.list.begin();
- for ( ; it < list.list.end(); it++ )
- f.printf ( "%s\n", it->c_str() );
- }
- return PrivMsg ( channel, ssprintf("%s: entry removed from list '%s'",from.c_str(),listname.c_str()) );
- }
- }
- return PrivMsg ( channel, ssprintf("%s: entry doesn't exist in list '%s'",from.c_str(),listname.c_str()) );
- }
- else
- {
- if (found_name)
- return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
- }
-
- } // if (command)
-
- bool found_curse = false;
- static vector<string>& curse = GetList("curse").list;
- text2 = " " + text2 + " ";
-
- for ( int i = 0; i < curse.size() && !found_curse; i++ )
- {
- if ( strstr ( text2.c_str(), curse[i].c_str() ) )
- found_curse = true;
- }
- if ( found_curse )
- {
- static List& cursecop = GetList("cursecop");
- return PrivMsg ( channel, ssprintf("%s: %s", from.c_str(), ListRand(cursecop)) );
- }
-
- string botname (BOTNAME);
- strlwr ( &botname[0] );
- //botname = " " + botname + " ";
-
- if ( strstr(text2.c_str(), botname.c_str()) || strstr(text2.c_str(), " arch ") || found_name )
- {
- string out = ssprintf("%s: %s", from.c_str(), TaggedReply("tech").c_str());
- flog.printf ( "TECH-REPLY: %s\n", out.c_str() );
- if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
- return Action ( channel, &out[4] );
- else
- return PrivMsg ( channel, out );
- }
- return true;
-
- } // On Chanel Message
-
- bool OnChannelMode ( const string& channel, const string& mode )
- {
- //printf ( "OnChannelMode(%s,%s)\n", channel.c_str(), mode.c_str() );
- return true;
- }
- bool OnUserModeInChannel ( const string& src, const string& channel, const string& mode, const string& target )
- {
- printf ( "OnUserModeInChannel(%s,%s,%s,%s)\n", src.c_str(), channel.c_str(), mode.c_str(), target.c_str() );
- const char* p = mode.c_str();
- if ( !p )
- return true;
- while ( *p )
- {
- switch ( *p++ )
- {
- case '+':
- while ( *p != 0 && *p != ' ' )
- {
- if ( *p == 'o' )
- {
- printf ( "adding '%s' to ops list\n", target.c_str() );
- ops.push_back ( target );
- }
- break;
- }
- break;
- case '-':
- while ( *p != 0 && *p != ' ' )
- {
- if ( *p == 'o' )
- {
- std::vector<std::string>::iterator it = ops.begin();
- for ( ; it != ops.end(); it++ )
- {
- if ( *it == target )
- {
- printf ( "remove '%s' to ops list\n", target.c_str() );
- ops.erase ( it );
- }
- }
- break;
- }
- }
- }
- }
- return true;
- }
- bool OnMode ( const string& user, const string& mode )
- {
- //printf ( "OnMode(%s,%s)\n", user.c_str(), mode.c_str() );
- return true;
- }
- bool OnChannelUsers ( const string& channel, const vector<string>& users )
- {
- //printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
- for ( int i = 0; i < users.size(); i++ )
- {
- if ( users[i][0] == '@' )
- ops.push_back ( &users[i][1] );
- /*if ( i )
- printf ( ", " );
- printf ( "%s", users[i].c_str() );*/
- }
- //printf ( "\n" );
- return true;
- }
- bool OnKick ( void )
- {
- Join(CHANNEL);
- return true;
- }
- bool OnBanned ( const std::string& channel )
- {
- Sleep(10000);
- return Join(CHANNEL);
- }
-};
-
-int main ( int argc, char** argv )
-{
- srand ( time(NULL) );
-
- ImportList ( "dev", true );
- ImportList ( "func", true );
- ImportList ( "dev", true );
- ImportList ( "func", true );
- ImportList ( "irql", true );
- ImportList ( "module", true );
- ImportList ( "period", true );
- ImportList ( "status", true );
- ImportList ( "stru", true );
- ImportList ( "type", true );
-
- ImportList ( "tech", false );
- ImportList ( "curse", false );
- ImportList ( "cursecop", false );
- ImportList ( "grovel", false );
- ImportList ( "nogrovel", false );
- ImportList ( "idle", false );
-
-#ifdef _DEBUG
- printf ( "initializing IRCClient debugging\n" );
- IRCClient::SetDebug ( true );
-#endif//_DEBUG
-
- while (true)
- {
- printf ( "calling suStartup()\n" );
- suStartup();
- printf ( "creating IRCClient object\n" );
- MyIRCClient irc;
- printf ( "connecting to freenode\n" );
-
- if ( !irc.Connect ( SERVER ) ) // irc.freenode.net
- {
- printf ( "couldn't connect to server\n" );
- Sleep(10000);
- continue;
- }
- printf ( "sending user command\n" );
- if ( !irc.User ( BOTNAME, "reactos.com", SERVER, "ArchBlackmann" ) )
- {
- printf ( "USER command failed, retying ...\n" );
- Sleep(10000);
- continue;
- }
- printf ( "sending nick\n" );
- if ( !irc.Nick ( BOTNAME ) )
- {
- printf ( "NICK command failed, retying ...\n" );
- Sleep(10000);
- continue;
- }
- printf ( "setting mode\n" );
- if ( !irc.Mode ( MODE ) )
- {
- printf ( "MODE command failed, retying ...\n" );
- Sleep(10000);
- continue;
- }
- printf ( "joining channel\n" );
- if ( !irc.Join ( CHANNEL ) )
- {
- printf ( "JOIN command failed, retying ...\n" );
- Sleep(10000);
- continue;
- }
-
- printf ( "entering irc client processor\n" );
- irc.Run ( false ); // do the processing in this thread...
- }
-
- return 0;
-}
+++ /dev/null
-# Microsoft Developer Studio Project File - Name="ArchBlackmann" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=ArchBlackmann - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "ArchBlackmann.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ArchBlackmann.mak" CFG="ArchBlackmann - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ArchBlackmann - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "ArchBlackmann - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "ArchBlackmann - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "ArchBlackmann - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "ArchBlackmann - Win32 Release"
-# Name "ArchBlackmann - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\ArchBlackmann.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\auto_ptr.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\auto_vector.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\base64.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\chomp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\chomp.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\cram_md5.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\cram_md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\File.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\File.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\IRCClient.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\IRCClient.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\MD5.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\MD5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\panic.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\panic.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\QueueT.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Reli.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ReliMT.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ReliMT.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SockUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SockUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SplitJoin.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\SplitJoin.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ssprintf.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ssprintf.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ThreadPool.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\ThreadPool.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\trim.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\trim.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\verify.h
-# End Source File
-# End Target
-# End Project
+++ /dev/null
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "ArchBlackmann"=.\ArchBlackmann.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+++ /dev/null
-// File.cpp
-// (C) 2002-2004 Royce Mitchell III
-// Dually licensed under BSD & LGPL
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 )
-#endif//_MSC_VER
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "File.h"
-
-#ifndef nelem
-#define nelem(x) ( sizeof(x) / sizeof(x[0]) )
-#endif//nelem
-
-typedef File::filesize_t filesize_t;
-typedef File::fileoff_t fileoff_t;
-
-
-fileoff_t File::seek ( fileoff_t offset )
-{
-#ifdef WIN32
- if ( _f->_flag & _IOWRT ) // is there pending output?
- fflush ( _f );
-
- // reset "buffered input" variables
- _f->_cnt = 0;
- _f->_ptr = _f->_base;
-
- // make sure we're going forward
- if ( _f->_flag & _IORW )
- _f->_flag &= ~(_IOREAD|_IOWRT);
-
- return _lseeki64 ( _fileno(_f), offset, SEEK_SET );
-#else//UNIX
- return lseek64 ( fileno(_f), offset, SEEK_SET );
-#endif
-}
-
-std::string File::getline ( bool strip_crlf /*= false*/ )
-{
- std::string s = "";
- char buf[256];
- for ( ;; )
- {
- *buf = 0;
- fgets ( buf, nelem(buf)-1, _f );
- if ( !*buf )
- break;
- s += buf;
- if ( strchr ( "\r\n", buf[strlen(buf)-1] ) )
- break;
- }
- if ( strip_crlf && s.size() )
- {
- char* p = strpbrk ( &s[0], "\r\n" );
- if ( p )
- {
- *p = '\0';
- s.resize ( p-&s[0] );
- }
- }
- return s;
-}
-
-std::wstring File::wgetline ( bool strip_crlf /*= false*/ )
-{
- std::wstring s = L"";
- wchar_t buf[256];
- for ( ;; )
- {
- *buf = 0;
- fgetws ( buf, nelem(buf)-1, _f );
- if ( !*buf )
- break;
- s += buf;
- if ( wcschr ( L"\r\n", buf[wcslen(buf)-1] ) )
- break;
- }
- if ( strip_crlf && s.size() )
- {
- wchar_t* p = wcspbrk ( &s[0], L"\r\n" );
- if ( p )
- {
- *p = L'\0';
- s.resize ( (p-&s[0])/sizeof(wchar_t) );
- }
- }
- return s;
-}
-
-// this function searches for the next end-of-line and puts all data it
-// finds until then in the 'line' parameter.
-//
-// call continuously until the function returns false ( no more data )
-bool File::next_line ( std::string& line, bool strip_crlf )
-{
- line = getline(strip_crlf);
- // indicate that we're done *if*:
- // 1) there's no more data, *and*
- // 2) we're at the end of the file
- return line.size()>0 || !eof();
-}
-
-bool File::next_line ( std::wstring& line, bool strip_crlf )
-{
- line = wgetline ( strip_crlf );
- return line.size()>0 || !eof();
-}
-
-/*
-example usage:
-
-bool mycallback ( const std::string& line, int line_number, long lparam )
-{
- std::cout << line << std::endl;
- return true; // continue enumeration
-}
-
-File f ( "file.txt", "rb" ); // open file for binary read-only ( i.e. "rb" )
-f.enum_lines ( mycallback, 0, true );
-*/
-
-/*bool File::enum_lines ( bool (*callback)(const std::string& line, int line_number, long lparam), long lparam, bool strip_crlf )
-{
- int line_number = 0;
- for ( ;; )
- {
- std::string s = getline(strip_crlf);
- line_number++;
- if ( !s.size() )
- {
- if ( eof() )
- return true;
- else
- continue;
- }
- if ( !(*callback) ( s, line_number, lparam ) )
- return false;
- }
-}*/
-
-filesize_t File::length() const
-{
-#ifdef WIN32
- return _filelengthi64 ( _fileno(_f) );
-#elif defined(UNIX)
- struct stat64 file_stat;
- verify(fstat64(fileno(_f), &file_stat) == 0);
- return file_stat.st_size;
-#endif
-}
-
-void File::close()
-{
- if ( _f )
- {
- fclose(_f);
- _f = 0;
- }
-}
-
-void File::printf ( const char* fmt, ... )
-{
- va_list arg;
- int done;
-
- va_start(arg, fmt);
- assert(_f);
- done = vfprintf ( _f, fmt, arg );
- va_end(arg);
-}
-
-/*static*/ bool File::LoadIntoString ( std::string& s, const std::string& filename )
-{
- File in ( filename, "rb" );
- if ( !in.isopened() )
- return false;
- filesize_t flen = in.length();
- size_t len = size_t(flen);
- if ( len != flen )
- return false; // file too big...
- s.resize ( len + 1 );
- if ( !in.read ( &s[0], len ) )
- return false;
- s[len] = '\0';
- s.resize ( len );
- return true;
-}
-
-/*static*/ bool File::LoadIntoString ( std::string& s, const std::wstring& filename )
-{
- File in ( filename, L"rb" );
- if ( !in.isopened() )
- return false;
- filesize_t flen = in.length();
- size_t len = size_t(flen);
- if ( len != flen )
- return false; // file too big...
- s.resize ( len + 1 );
- if ( !in.read ( &s[0], len ) )
- return false;
- s[len] = '\0';
- s.resize ( len );
- return true;
-}
-
-/*static*/ bool File::SaveFromString ( const std::string& filename, const std::string& s, bool binary )
-{
- File out ( filename, binary ? "wb" : "w" );
- if ( !out.isopened() )
- return false;
- out.write ( s.c_str(), s.size() );
- return true;
-}
-
-/*static*/ bool File::SaveFromString ( const std::wstring& filename, const std::string& s, bool binary )
-{
- File out ( filename, binary ? L"wb" : L"w" );
- if ( !out.isopened() )
- return false;
- out.write ( s.c_str(), s.size() );
- return true;
-}
-
-/*static*/ bool File::SaveFromBuffer ( const std::string& filename, const char* buf, size_t buflen, bool binary )
-{
- File out ( filename, binary ? "wb" : "w" );
- if ( !out.isopened() )
- return false;
- out.write ( buf, buflen );
- return true;
-}
-
-/*static*/ bool File::SaveFromBuffer ( const std::wstring& filename, const char* buf, size_t buflen, bool binary )
-{
- File out ( filename, binary ? L"wb" : L"w" );
- if ( !out.isopened() )
- return false;
- out.write ( buf, buflen );
- return true;
-}
-
-/*static*/ std::string File::TempFileName ( const std::string& prefix )
-{
-#ifdef WIN32
- std::string s ( _tempnam ( ".", prefix.c_str() ) );
- return s;
-#else
- // FIXME
- return string("");
-#endif
-}
-
-/*static*/ std::wstring File::TempFileName ( const std::wstring& prefix )
-{
-#ifdef WIN32
- std::wstring s ( _wtempnam ( L".", prefix.c_str() ) );
- return s;
-#else
- // FIXME
- return std::wstring(L"");
-#endif
-}
+++ /dev/null
-// File.h
-// (C) 2002-2004 Royce Mitchell III
-// Dually licensed under BSD & LGPL
-
-#ifndef FILE_H
-#define FILE_H
-
-#ifdef WIN32
-# include <stdio.h> // fgetc
-# include <io.h>
-#elif defined(UNIX)
-# include <sys/stat.h>
-# include <unistd.h>
-#endif
-#include <assert.h>
-#include <string>
-
-class File
-{
-public:
-#ifdef WIN32
- typedef __int64 fileoff_t;
- typedef unsigned __int64 filesize_t;
-#else//_MSC_VER
- typedef __off64_t fileoff_t;
- typedef __size64_t filesize_t;
-#endif//_MSC_VER
-
- File() : _f(0)
- {
- }
-
- File ( const std::string& filename, const char* mode ) : _f(0)
- {
- open ( filename, mode );
- }
-
- File ( const std::wstring& filename, const wchar_t* mode ) : _f(0)
- {
- open ( filename, mode );
- }
-
- File ( const char* filename, const char* mode ) : _f(0)
- {
- open ( filename, mode );
- }
-
- File ( const wchar_t* filename, const wchar_t* mode ) : _f(0)
- {
- open ( filename, mode );
- }
-
- ~File()
- {
- close();
- }
-
- bool open ( const std::string& filename, const char* mode )
- {
- assert ( !_f );
- return ( _f = fopen ( filename.c_str(), mode ) ) != 0;
- }
-
- bool open ( const std::wstring& filename, const wchar_t* mode )
- {
- assert ( !_f );
- return ( _f = _wfopen ( filename.c_str(), mode ) ) != 0;
- }
-
- bool open ( const char* filename, const char* mode )
- {
- assert ( !_f );
- return ( _f = fopen ( filename, mode ) ) != 0;
- }
-
- bool open ( const wchar_t* filename, const wchar_t* mode )
- {
- assert ( !_f );
- return ( _f = _wfopen ( filename, mode ) ) != 0;
- }
-
- fileoff_t seek ( fileoff_t offset );
-
- int get()
- {
- return fgetc ( _f );
- }
-
- bool put ( int c )
- {
- return fputc ( c, _f ) != EOF;
- }
-
- std::string getline ( bool strip_crlf = false );
- std::wstring wgetline ( bool strip_crlf = false );
-
- // this function searches for the next end-of-line and puts all data it
- // finds until then in the 'line' parameter.
- //
- // call continuously until the function returns false ( no more data )
- bool next_line ( std::string& line, bool strip_crlf );
- bool next_line ( std::wstring& line, bool strip_crlf );
-
- bool read ( void* data, unsigned len )
- {
- return len == fread ( data, 1, len, _f );
- }
-
- bool write ( const void* data, unsigned len )
- {
- return len == fwrite ( data, 1, len, _f );
- }
-
- bool write ( const std::string& data )
- {
- return data.length() == fwrite ( data.c_str(), 1, data.length(), _f );
- }
-
- bool write ( const std::wstring& data )
- {
- return data.length() == fwrite ( data.c_str(), sizeof(data[0]), data.length(), _f );
- }
-
- filesize_t length() const;
-
- void close();
-
- bool isopened() const
- {
- return _f != 0;
- }
-
- bool is_open() const
- {
- return _f != 0;
- }
-
- bool eof() const
- {
- return feof(_f) ? true : false;
- }
-
- FILE* operator * ()
- {
- return _f;
- }
-
- operator FILE*()
- {
- return _f;
- }
-
- void printf ( const char* fmt, ... );
- void printf ( const wchar_t* fmt, ... );
-
- static bool LoadIntoString ( std::string& s, const std::string& filename );
- static bool LoadIntoString ( std::string& s, const std::wstring& filename );
- static bool SaveFromString ( const std::string& filename, const std::string& s, bool binary );
- static bool SaveFromString ( const std::wstring& filename, const std::string& s, bool binary );
- static bool SaveFromBuffer ( const std::string& filename, const char* buf, size_t buflen, bool binary );
- static bool SaveFromBuffer ( const std::wstring& filename, const char* buf, size_t buflen, bool binary );
-
- static std::string TempFileName ( const std::string& prefix );
- static std::wstring TempFileName ( const std::wstring& prefix );
-
-private:
- File(const File&) {}
- const File& operator = ( const File& ) { return *this; }
-
- FILE * _f;
-};
-
-#endif//FILE_H
+++ /dev/null
-// IRCClient.cpp
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 )
-#endif//_MSC_VER
-
-#include <vector>
-#include <sstream>
-
-#include "IRCClient.h"
-#include "MD5.h"
-#include "cram_md5.h"
-#include "trim.h"
-#include "chomp.h"
-#include "SplitJoin.h"
-#include "base64.h"
-#include "config.h"
-
-using std::string;
-using std::stringstream;
-using std::vector;
-
-bool IRCClient::_debug = true;
-
-// see rfc1459 for IRC-Protocoll Reference
-
-IRCClient::IRCClient()
- : _timeout(10*60*1000), _inRun(false)
-{
-}
-
-bool IRCClient::Connect ( const string& server, short port )
-{
- string buf;
- Close();
- Attach ( suTcpSocket() );
- if ( !suConnect ( *this, server.c_str(), port ) )
- return false;
- return true;
-}
-
-bool
-IRCClient::User ( const string& user, const string& mode,
- const string& network, const string& realname )
-{
- string buf;
- buf = "USER " + user + " \"" + mode + "\" \"" + network + "\" :" + realname + "\n";
- return Send ( buf );
-}
-
-bool
-IRCClient::Nick ( const string& nick )
-{
- _nick = nick;
- Send ( "NICK " + _nick + "\n" );
- PrivMsg ("NickServ", "IDENTIFY " + (string)PASS);
- return true;
-}
-
-bool
-IRCClient::Mode ( const string& mode )
-{
- return Send ( "MODE " + _nick + " " + mode + "\n" );
-}
-
-bool
-IRCClient::Names ( const string& channel )
-{
- return Send ( "NAMES " + channel + "\n" );
-}
-
-bool
-IRCClient::Mode ( const string& channel, const string& mode, const string& target )
-{
- return Send ( "MODE " + channel + " " + mode + " " + target + "\n" );
-}
-
-bool
-IRCClient::Join ( const string& channel )
-{
- return Send("JOIN " + channel + "\n");
-}
-
-bool
-IRCClient::PrivMsg ( const string& to, const string& text )
-{
- return Send ( "PRIVMSG " + to + " :" + text + '\n' );
-}
-
-bool
-IRCClient::Action ( const string& to, const string& text )
-{
- return Send ( "PRIVMSG " + to + " :" + (char)1 + "ACTION " + text + (char)1 + '\n' );
-}
-
-bool
-IRCClient::Part ( const string& channel, const string& text )
-{
- return Send ( "PART " + channel + " :" + text + "\n" );
-}
-
-bool
-IRCClient::Quit ( const string& text )
-{
- return Send( "QUIT :" + text + "\n");
-}
-
-bool IRCClient::_Recv ( string& buf )
-{
- bool b = (recvUntil ( buf, '\n', _timeout ) > 0);
- if ( b && _debug )
- {
- printf ( ">> %s", buf.c_str() );
- if ( buf[buf.length()-1] != '\n' )
- printf ( "\n" );
- }
- return b;
-}
-
-bool IRCClient::Send ( const string& buf )
-{
- if ( _debug )
- {
- printf ( "<< %s", buf.c_str() );
- if ( buf[buf.length()-1] != '\n' )
- printf ( "\n" );
- }
- return ( buf.length() == (size_t)send ( *this, buf.c_str(), buf.length(), 0 ) );
-}
-
-bool IRCClient::OnPing( const string& text )
-{
- return Send( "PONG " + text + "\n" );
-}
-
-
-int THREADAPI IRCClient::Callback ( IRCClient* irc )
-{
- return irc->Run ( false );
-}
-
-int IRCClient::Run ( bool launch_thread )
-{
- if ( (SOCKET)*this == INVALID_SOCKET )
- return 0;
- if ( _inRun ) return 1;
- if ( launch_thread )
- {
- ThreadPool::Instance().Launch ( (ThreadPoolFunc*)IRCClient::Callback, this );
- return 1;
- }
- _inRun = true;
- if ( _debug ) printf ( "IRCClient::Run() - waiting for responses\n" );
- string buf;
- while ( _Recv(buf) )
- {
- if ( !strnicmp ( buf.c_str(), "NOTICE ", 7 ) )
- {
- //printf ( "recv'd NOTICE msg...\n" );
- // TODO...
- //OnAuth (
- }
- else if ( !strnicmp ( buf.c_str(), "PING ", 5 ) )
- {
- const char* p = &buf[5]; // point to first char after "PING "
- while ( *p == ':' ) // then read past the colons
- p++;
- const char* p2 = strpbrk ( p, "\r\n" ); // find the end of line
- string text ( p, p2-p ); // and set the text
- OnPing( text );
- }
- else if ( buf[0] == ':' )
- {
- const char* p = &buf[1]; // skip first colon...
- const char* p2 = strpbrk ( p, " !" );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 0: ", buf.c_str() );
- continue;
- }
- string src ( p, p2-p );
- if ( !src.length() )
- {
- printf ( "!!!:OnRecv failure 0.5: %s", buf.c_str() );
- continue;
- }
- p = p2 + 1;
- if ( *p2 == '!' )
- {
- p2 = strchr ( p, ' ' );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 1: %s", buf.c_str() );
- continue;
- }
- //string srchost ( p, p2-p );
- p = p2 + 1;
- }
- p2 = strchr ( p, ' ' );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 2: %s", buf.c_str() );
- continue;
- }
- string cmd ( p, p2-p );
- p = p2 + 1;
- p2 = strpbrk ( p, " :" );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 3: %s", buf.c_str() );
- continue;
- }
- string tgt ( p, p2-p );
- p = p2 + 1;
- p += strspn ( p, " " );
- if ( *p == '=' )
- {
- p++;
- p += strspn ( p, " " );
- }
- if ( *p == ':' )
- p++;
- p2 = strpbrk ( p, "\r\n" );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 4: %s", buf.c_str() );
- continue;
- }
- string text ( p, p2-p );
- strlwr ( &cmd[0] );
- if ( cmd == "privmsg" )
- {
- if ( !tgt.length() )
- {
- printf ( "!!!:OnRecv failure 5 (PRIVMSG w/o target): %s", buf.c_str() );
- continue;
- }
- if ( *p == 1 )
- {
- p++;
- p2 = strchr ( p, ' ' );
- if ( !p2 ) p2 = p + strlen(p);
- cmd = string ( p, p2-p );
- strlwr ( &cmd[0] );
- p = p2 + 1;
- p2 = strchr ( p, 1 );
- if ( !p2 )
- {
- printf ( "!!!:OnRecv failure 6 (no terminating \x01 for initial \x01 found: %s", buf.c_str() );
- continue;
- }
- text = string ( p, p2-p );
- if ( cmd == "action" )
- {
- if ( tgt[0] == '#' )
- OnChannelAction ( tgt, src, text );
- else
- OnPrivAction ( src, text );
- }
- else
- {
- printf ( "!!!:OnRecv failure 7 (unrecognized \x01 command '%s': %s", cmd.c_str(), buf.c_str() );
- continue;
- }
- }
- else
- {
- if ( tgt[0] == '#' )
- OnChannelMsg ( tgt, src, text );
- else
- OnPrivMsg ( src, text );
- }
- }
- else if ( cmd == "mode" )
- {
- // two diff. kinds of mode notifications...
- //printf ( "[MODE] src='%s' cmd='%s' tgt='%s' text='%s'", src.c_str(), cmd.c_str(), tgt.c_str(), text.c_str() );
- //OnMode (
- // self mode change:
- // [MODE] src=Nick cmd=mode tgt=Nick text=+i
- // channel mode change:
- // [MODE] src=Nick cmd=mode tgt=#Channel text=+o Nick
- if ( tgt[0] == '#' )
- {
- p = text.c_str();
- p2 = strchr ( p, ' ' );
- if ( p2 && *p2 )
- {
- string mode ( p, p2-p );
- p = p2 + 1;
- p += strspn ( p, " " );
- OnUserModeInChannel ( src, tgt, mode, trim(p) );
- }
- else
- OnChannelMode ( tgt, text );
- }
- else
- OnMode ( tgt, text );
- }
- else if ( cmd == "join" )
- {
- mychannel = text;
- OnJoin ( src, text );
- }
- else if ( cmd == "part" )
- {
- OnPart ( src, text );
- }
- else if ( cmd == "nick" )
- {
- OnNick ( src, text );
- }
- else if ( cmd == "kick" )
- {
- OnKick ();
- }
- else if ( isdigit(cmd[0]) )
- {
- int i = atoi(cmd.c_str());
- switch ( i )
- {
-
- case 1: // "Welcome!" - i.e. it's okay to issue commands now...
- OnConnected();
- break;
-
- case 353: // user list for channel....
- {
- p = text.c_str();
- p2 = strpbrk ( p, " :" );
- if ( !p2 ) continue;
- string channel ( p, p2-p );
- p = strchr ( p2, ':' );
- if ( !p ) continue;
- p++;
- vector<string> users;
- while ( *p )
- {
- p2 = strchr ( p, ' ' );
- if ( !p2 )
- p2 = p + strlen(p);
- users.push_back ( string ( p, p2-p ) );
- p = p2+1;
- p += strspn ( p, " " );
- }
- OnChannelUsers ( channel, users );
- }
- break;
-
- case 366: // END of user list for channel
- {
- p = text.c_str();
- p2 = strpbrk ( p, " :" );
- if ( !p2 ) continue;
- string channel ( p, p2-p );
- OnEndChannelUsers ( channel );
- }
- break;
-
- case 474: // You are banned
- {
- p = text.c_str();
- p2 = strpbrk ( p, " :" );
- if ( !p2 ) continue;
- string channel ( p, p2-p );
- OnBanned ( channel );
- }
- break;
-
- case 433: // Nick in Use
- {
- string nick = _nick;
- Nick (nick + "_");
-
- PrivMsg ("NickServ", "GHOST " + nick + " " + PASS);
-
- // HACK HACK HACK
- Mode ( "+i" );
- Join ( CHANNEL ); // this is because IRC client does not review if his commands were sucessfull
-
- Sleep ( 1000 );
- Nick ( nick );
- }
- break;
-
- case 2: //MOTD
- case 376: //MOTD
- case 372:
- break;
-
- default:
- if ( _debug ) printf ( "unknown command %i: %s", i, buf.c_str() );
- break;
- }
- }
- else
- {
- if ( strstr ( buf.c_str(), "ACTION" ) )
- {
- printf ( "ACTION: " );
- for ( int i = 0; i < buf.size(); i++ )
- printf ( "%c(%xh)", buf[i], (unsigned)(unsigned char)buf[i] );
- }
- else if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
- }
- }
- else
- {
- if ( _debug ) printf ( "unrecognized irc msg: %s", buf.c_str() );
- }
- //OnRecv ( buf );
- }
- if ( _debug ) printf ( "IRCClient::Run() - exiting\n" );
- _inRun = false;
- return 0;
-}
+++ /dev/null
-// IRCClient.h
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef IRCCLIENT_H
-#define IRCCLIENT_H
-
-#include <string>
-#include <vector>
-#include "SockUtils.h"
-#include "ThreadPool.h"
-
-class IRCClient : public suBufferedRecvSocket
-{
-
-public:
- IRCClient();
-
- std::string mychannel;
- static bool GetDebug() { return _debug; }
- static bool SetDebug ( bool debug ) { bool old = _debug; _debug = debug; return old; }
-
- // connect to server ( record greeting for apop if it exists )
- bool Connect ( const std::string& server, short port = 6667 );
-
- bool Running() { return _inRun; }
-
- ////////////////////////// IRC Client Protocol commands ///////////////////////
-
- // first thing you must call... mode can be ""
- // network can be same as name of server used in Connect() above
- bool User ( const std::string& user, const std::string& mode,
- const std::string& network, const std::string& realname );
-
- // change nick...
- bool Nick ( const std::string& nick );
-
- // change mode for self...
- bool Mode ( const std::string& mode );
-
- // set someone's mode in channel ( like oping someone )
- bool Mode ( const std::string& channel, const std::string& mode, const std::string& target );
-
- // request a list of names of clients in a channel
- bool Names ( const std::string& channel );
-
- // join a channel...
- bool Join ( const std::string& channel );
-
- // send message to someone or some channel
- bool PrivMsg ( const std::string& to, const std::string& text );
-
- // send /me to someone or some channel
- bool Action ( const std::string& to, const std::string& text );
-
- // leave a channel
- bool Part ( const std::string& channel, const std::string& text );
-
- // log off
- bool Quit ( const std::string& text );
-
- ////////////////////// callback functions ////////////////////////////
-
- // OnConnected: you just successfully logged into irc server
- virtual bool OnConnected() = 0;
-
- virtual bool OnNick ( const std::string& oldNick, const std::string& newNick ) { return true; }
-
- // OnJoin: someone just successfully joined a channel you are in ( also sent when you successfully join a channel )
- virtual bool OnJoin ( const std::string& user, const std::string& channel ) { return true; }
-
- // OnPart: someone just left a channel you are in
- virtual bool OnPart ( const std::string& user, const std::string& channel ) { return true; }
-
- // OnPrivMsg: you just received a private message from a user
- virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) { return true; }
-
- virtual bool OnPrivAction ( const std::string& from, const std::string& text ) { return true; }
-
- // OnChannelMsg: you just received a chat line in a channel
- virtual bool OnChannelMsg ( const std::string& channel, const std::string& from,
- const std::string& text ) { return true; }
-
- // OnChannelAction: you just received a "/me" line in a channel
- virtual bool OnChannelAction ( const std::string& channel, const std::string& from,
- const std::string& text ) { return true; }
-
- // OnChannelMode: notification of a change of a channel's mode
- virtual bool OnChannelMode ( const std::string& channel, const std::string& mode )
- { return true; }
-
- // OnUserModeInChannel: notification of a mode change of a user with respect to a channel.
- // f.ex.: this will be called when someone is oped in a channel.
- virtual bool OnUserModeInChannel ( const std::string& src, const std::string& channel,
- const std::string& mode, const std::string& target ) { return true; }
-
- // OnMode: you will receive this when you change your own mode, at least...
- virtual bool OnMode ( const std::string& user, const std::string& mode ) { return true; }
-
- // notification of what users are in a channel ( you may get multiple of these... )
- virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users )
- { return true; }
-
- // OnKick: if the client has been kicked
- virtual bool OnKick ( void ) { return true; }
-
- // OnKick: if the client has been kicked
- virtual bool OnBanned ( const std::string& channel ) { return true; }
-
- // notification that you have received the entire list of users for a channel
- virtual bool OnEndChannelUsers ( const std::string& channel ) { return true; }
-
- // OnPing - default implementation replies to PING with a valid PONG. required on some systems to
- // log in. Most systems require a response in order to stay connected, used to verify a client hasn't
- // dropped.
- virtual bool OnPing ( const std::string& text );
-
- ////////////////////// other functions ////////////////////////////
-
- // this is for sending data to irc server. it's public in case you need to send some
- // command not supported by this base class...
- bool Send ( const std::string& buf );
-
- // if launch_thread is true, this function will spawn a thread that will process
- // incoming packets until the socket dies.
- // otherwise ( launch_thread is false ) this function will do that processing
- // in *this* thread, and not return until the socket dies.
- int Run ( bool launch_thread );
-
- ////////////////////// private stuff ////////////////////////////
-private:
- bool _Recv ( std::string& buf );
-
- static int THREADAPI Callback ( IRCClient* irc );
-
- static bool _debug;
- std::string _nick;
- int _timeout;
- std::string _apop_challenge;
-
- volatile bool _inRun;
-
- // disable copy semantics
- IRCClient ( const IRCClient& );
- IRCClient& operator = ( const IRCClient& );
-};
-
-#endif//IRCCLIENT_H
+++ /dev/null
-// MD5.CPP - RSA Data Security, Inc., MD5 message-digest algorithm
-
-/*
-Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
-*/
-
-//#include <assert.h>
-#include <memory.h>
-#include <ctype.h>
-#include <vector>
-#include "MD5.h"
-
-using std::string;
-using std::vector;
-
-// Constants for MD5Transform routine.
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform ( UINT4 [4], const uchar [64] );
-static void Encode ( unsigned char *, UINT4 *, unsigned int );
-static void Decode ( UINT4 *, const uchar *, unsigned int );
-
-static unsigned char PADDING[64] =
-{
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-// F, G, H and I are basic MD5 functions.
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-// ROTATE_LEFT rotates x left n bits.
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-// Rotation is separate from addition to prevent recomputation.
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-// MD5 initialization. Begins an MD5 operation, writing a new context.
-void MD5Init (
- MD5_CTX *context ) // context
-{
- context->count[0] = context->count[1] = 0;
- // Load magic initialization constants.
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-
-// MD5 block update operation. Continues an MD5 message-digest
-// operation, processing another message block, and updating the
-// context.
-void MD5Update (
- MD5_CTX *context, // context
- const char *input_, // input block
- unsigned int inputLen ) // length of input block
-{
- unsigned int i, index, partLen;
- const uchar* input = (const uchar*)input_;
-
- // Compute number of bytes mod 64
- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
- // Update number of bits
- if ((context->count[0] += ((UINT4)inputLen << 3))
- < ((UINT4)inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4)inputLen >> 29);
-
- partLen = 64 - index;
-
- // Transform as many times as possible.
- if (inputLen >= partLen)
- {
- memcpy
- ((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
-
- index = 0;
- }
- else
- i = 0;
-
- // Buffer remaining input
- memcpy
- ((POINTER)&context->buffer[index], (POINTER)&input[i],
- inputLen-i);
-}
-
-// MD5 finalization. Ends an MD5 message-digest operation, writing the
-// the message digest and zeroizing the context.
-void MD5Final (
- unsigned char digest[16], // message digest
- MD5_CTX *context ) // context
-{
- uchar bits[8];
- unsigned int index, padLen;
-
- // Save number of bits
- Encode (bits, context->count, 8);
-
- // Pad out to 56 mod 64.
- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- MD5Update (context, (const char*)PADDING, padLen);
-
- // Append length (before padding)
- MD5Update (context, (const char*)bits, 8);
-
- // Store state in digest
- Encode (digest, context->state, 16);
-
- // Zeroize sensitive information.
- memset ((POINTER)context, 0, sizeof (*context));
-}
-
-// MD5 basic transformation. Transforms state based on block.
-static void MD5Transform (
- UINT4 state[4],
- const uchar block[64] )
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode (x, block, 64);
-
- // Round 1
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); // 1
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); // 2
- FF (c, d, a, b, x[ 2], S13, 0x242070db); // 3
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); // 4
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); // 5
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); // 6
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); // 7
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); // 8
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); // 9
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); // 10
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); // 11
- FF (b, c, d, a, x[11], S14, 0x895cd7be); // 12
- FF (a, b, c, d, x[12], S11, 0x6b901122); // 13
- FF (d, a, b, c, x[13], S12, 0xfd987193); // 14
- FF (c, d, a, b, x[14], S13, 0xa679438e); // 15
- FF (b, c, d, a, x[15], S14, 0x49b40821); // 16
-
- // Round 2
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); // 17
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); // 18
- GG (c, d, a, b, x[11], S23, 0x265e5a51); // 19
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); // 20
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); // 21
- GG (d, a, b, c, x[10], S22, 0x2441453); // 22
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); // 23
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); // 24
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); // 25
- GG (d, a, b, c, x[14], S22, 0xc33707d6); // 26
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); // 27
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); // 28
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); // 29
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); // 30
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); // 31
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); // 32
-
- // Round 3
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); // 33
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); // 34
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); // 35
- HH (b, c, d, a, x[14], S34, 0xfde5380c); // 36
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); // 37
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); // 38
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); // 39
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); // 40
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); // 41
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); // 42
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); // 43
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); // 44
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); // 45
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); // 46
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); // 47
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); // 48
-
- // Round 4
- II (a, b, c, d, x[ 0], S41, 0xf4292244); // 49
- II (d, a, b, c, x[ 7], S42, 0x432aff97); // 50
- II (c, d, a, b, x[14], S43, 0xab9423a7); // 51
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); // 52
- II (a, b, c, d, x[12], S41, 0x655b59c3); // 53
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); // 54
- II (c, d, a, b, x[10], S43, 0xffeff47d); // 55
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); // 56
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); // 57
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); // 58
- II (c, d, a, b, x[ 6], S43, 0xa3014314); // 59
- II (b, c, d, a, x[13], S44, 0x4e0811a1); // 60
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); // 61
- II (d, a, b, c, x[11], S42, 0xbd3af235); // 62
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); // 63
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); // 64
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- // Zeroize sensitive information.
- memset ((POINTER)x, 0, sizeof (x));
-}
-
-// Encodes input (UINT4) into output (unsigned char). Assumes len is
-// a multiple of 4.
-static void Encode (
- unsigned char *output,
- UINT4 *input,
- unsigned int len )
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
- }
-}
-
-// Decodes input (unsigned char) into output (UINT4). Assumes len is
-// a multiple of 4.
-static void Decode (
- UINT4 *output,
- const uchar *input,
- unsigned int len )
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-void digest2ascii ( char *ascii, const unsigned char *digest )
-{
- int i;
- static char* table = "0123456789abcdef";
- for ( i = 0; i < 16; i++ )
- {
- *ascii++ = table[(*digest)>>4];
- *ascii++ = table[(*digest++)%16];
- }
- *ascii++ = 0;
-}
-
-void ascii2digest ( unsigned char *digest, const char *ascii )
-{
- int i;
-#define CONV(c) (unsigned char)( (toupper(c)>='A') ? (toupper(c)+10-'A') : ((c)-'0') )
-#define MAKECHAR(a,b) ((CONV(a)%16)<<4)|(CONV(b)%16)
- for ( i = 0; i < 16; i++ )
- {
- *digest++ = MAKECHAR(ascii[0],ascii[1]);
- ascii += 2;
- }
-}
-
-#ifdef __cplusplus
-MD5::MD5()
-{
- Init();
-}
-
-void MD5::Init()
-{
- MD5Init(&_ctx);
-}
-
-void MD5::Update ( const string& s )
-{
- MD5Update ( &_ctx, s.c_str(), s.size() );
-}
-
-string MD5::Final ( char* digest )
-{
- vector<uchar> v;
- v.resize(16);
- MD5Final ( &v[0], &_ctx );
- if ( digest )
- memmove ( digest, &v[0], 16 );
- string s;
- static char* tohex = "0123456789abcdef";
- for ( int i = 0; i < 16; i++ )
- {
- uchar c = v[i];
- s += tohex[ (c>>4) & 0xF ];
- s += tohex[ c & 0xF ];
- }
- return s;
-}
-
-string MD5Hex ( const string& s )
-{
- MD5 md5;
- md5.Update ( s );
- return md5.Final();
-}
-
-string MD5Bin ( const string& s )
-{
- MD5 md5;
- md5.Update ( s );
- char digest[16];
- md5.Final ( digest );
- return string ( digest, 16 );
-}
-
-string HMAC_MD5 ( const string& key, const string& text, char* out_bin )
-{
- MD5 md5;
- char k_ipad[65]; // inner padding - key XORd with ipad
- char k_opad[65]; // outer padding - key XORd with opad
- string tmp;
- char digest[16];
- int i;
- // if key is longer than 64 bytes reset it to key=MD5(key)
- if ( key.length() > 64 )
- {
- md5.Init();
- md5.Update ( key );
- md5.Final ( digest );
- tmp = string ( digest, 16 );
- }
- else
- tmp = key;
-
- // start out by storing key in pads
- memset ( k_ipad, 0, sizeof(k_ipad) );
- memset ( k_opad, 0, sizeof(k_opad) );
- memcpy ( k_ipad, tmp.c_str(), tmp.length() );
- memcpy ( k_opad, tmp.c_str(), tmp.length() );
-
- // XOR key with ipad and opad values
- for ( i=0; i<64; i++ )
- {
- k_ipad[i] ^= 0x36;
- k_opad[i] ^= 0x5c;
- }
-
- // "inner" MD5
- md5.Init();
- md5.Update(k_ipad);
- md5.Update(text);
- md5.Final ( digest );
-
- // "outer" MD5
- md5.Init();
- md5.Update(k_opad);
- md5.Update(string(digest,16));
- return md5.Final(out_bin);
-}
-#endif//__cplusplus
+++ /dev/null
-// MD5.H - header file for MD5.CPP
-
-/*
-Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
-*/
-
-#ifndef __MD5_H
-#define __MD5_H
-
-#ifdef __cplusplus
-#include <string>
-#endif//__cplusplus
-
-#ifndef uchar
-#define uchar unsigned char
-#endif//uchar
-
-#ifndef ushort
-#define ushort unsigned short
-#endif//ushort
-
-#ifndef ulong
-#define ulong unsigned long
-#endif//ulong
-
-#ifdef __cplusplus
-extern "C" {
-#endif//__cplusplus
-
-typedef uchar *POINTER; // POINTER defines a generic pointer type
-typedef ushort UINT2; // UINT2 defines a two byte word
-typedef ulong UINT4; // UINT4 defines a four byte word
-
-// MD5 context.
-typedef struct
-{
- UINT4 state[4]; // state (ABCD)
- UINT4 count[2]; // number of bits, modulo 2^64 (lsb first)
- unsigned char buffer[64]; // input buffer
-} MD5_CTX;
-
-void MD5Init ( MD5_CTX * );
-void MD5Update ( MD5_CTX *, const char *, unsigned int );
-void MD5Final ( uchar [16], MD5_CTX * );
-
-void digest2ascii ( char *ascii, const uchar *digest );
-void ascii2digest ( uchar *digest, const char *ascii );
-
-#ifdef __cplusplus
-
-} // extern "C"
-
-class MD5
-{
-public:
- MD5();
- void Init();
- void Update ( const std::string& s );
- std::string Final ( char* digest = 0 );
-
-private:
- MD5_CTX _ctx;
-};
-
-std::string MD5Hex ( const std::string& s );
-
-std::string MD5Bin ( const std::string& s );
-
-std::string HMAC_MD5 (
- const std::string& key,
- const std::string& text,
- char* out_bin = NULL );
-
-#endif//__cplusplus
-
-#endif//__MD5_H
+++ /dev/null
-/*
-** Author: Samuel R. Blackburn
-** Internet: wfc@pobox.com
-**
-** You can use it any way you like as long as you don't try to sell it.
-**
-** Any attempt to sell WFC in source code form must have the permission
-** of the original author. You can produce commercial executables with
-** WFC but you can't sell WFC.
-**
-** Copyright, 2000, Samuel R. Blackburn
-**
-** NOTE: I modified the info block below so it hopefully wouldn't conflict
-** with the original file. Royce Mitchell III
-*/
-
-#ifndef QUEUET_CLASS_HEADER
-#define QUEUET_CLASS_HEADER
-
-#include "ReliMT.h"
-
-#ifdef WIN32
-#include <sys/types.h> // off_t
-#define HEAPCREATE(size) m_Heap = ::HeapCreate ( HEAP_NO_SERIALIZE, size, 0 )
-#define HEAPALLOC(size) ::HeapAlloc ( m_Heap, HEAP_NO_SERIALIZE, size )
-#define HEAPREALLOC(p,size) ::HeapReAlloc( m_Heap, HEAP_NO_SERIALIZE, p, size )
-#define HEAPFREE(p) ::HeapFree ( m_Heap, HEAP_NO_SERIALIZE, p )
-#define HEAPDESTROY() ::HeapDestroy ( m_Heap ); m_Heap = 0;
-#else
-#define HEAPCREATE(size)
-#define HEAPALLOC(size) malloc(size)
-#define HEAPREALLOC(p,size) realloc(p,size);
-#define HEAPFREE(p) free(p)
-#define HEAPDESTROY()
-#endif
-
-template <class T>
-class CQueueT : public Uncopyable
-{
-protected:
-
- // What we want to protect
-
- Mutex m_AddMutex;
- Mutex m_GetMutex;
-
- T* m_Items;
-
- off_t m_AddIndex;
- off_t m_GetIndex;
- size_t m_Size;
-
-#ifdef WIN32
- HANDLE m_Heap;
-#endif//WIN32
- inline void m_GrowBy ( size_t number_of_new_items );
-
-public:
-
- inline CQueueT ( size_t initial_size = 1024 );
- inline ~CQueueT();
-
- inline bool Add( const T& new_item );
- inline void Empty() { m_AddIndex = 0; m_GetIndex = 0; };
- inline bool Get( T& item );
- inline size_t GetLength() const;
- inline size_t GetMaximumLength() const { return( m_Size ); };
- inline bool AddArray ( const T* new_items, int item_count );
- inline int GetArray ( T* items, const int maxget, const T& tEnd );
- inline bool Contains ( const T& t );
-};
-
-template <class T>
-inline CQueueT<T>::CQueueT ( size_t initial_size )
-{
- m_AddIndex = 0;
- m_GetIndex = 0;
- m_Items = NULL;
-
- if ( initial_size == 0 )
- initial_size = 1;
-
- /*
- ** 1999-11-05
- ** We create our own heap because all of the pointers used are allocated
- ** and freed be us. We don't have to worry about a non-serialized thread
- ** accessing something we allocated. Because of this, we can perform our
- ** memory allocations in a heap dedicated to queueing. This means when we
- ** have to allocate more memory, we don't have to wait for all other threads
- ** to pause while we allocate from the shared heap (like the C Runtime heap)
- */
-
- HEAPCREATE( ( ( ( 2 * initial_size * sizeof(T) ) < 65536 ) ? 65536 : (2 * initial_size * sizeof(T) ) ) );
-
- m_Items = (T*)HEAPALLOC ( initial_size * sizeof(T) );
-
- m_Size = ( m_Items == NULL ) ? 0 : initial_size;
-}
-
-template <class T>
-inline CQueueT<T>::~CQueueT()
-{
- m_AddIndex = 0;
- m_GetIndex = 0;
- m_Size = 0;
-
- if ( m_Items != NULL )
- {
- HEAPFREE(m_Items);
- m_Items = NULL;
- }
-
- HEAPDESTROY();
-}
-
-template <class T>
-inline bool CQueueT<T>::Add ( const T& item )
-{
- // Block other threads from entering Add();
- Mutex::Lock addlock ( m_AddMutex );
-
- // Add the item
-
- m_Items[ m_AddIndex ] = item;
-
- // 1999-12-08
- // Many many thanks go to Lou Franco (lfranco@spheresoft.com)
- // for finding an bug here. It rare but recreatable situations,
- // m_AddIndex could be in an invalid state.
-
- // Make sure m_AddIndex is never invalid
-
- off_t new_add_index = ( ( m_AddIndex + 1 ) >= (off_t)m_Size ) ? 0 : m_AddIndex + 1;
-
- if ( new_add_index == m_GetIndex )
- {
- // The queue is full. We need to grow.
- // Stop anyone from getting from the queue
- Mutex::Lock getlock ( m_GetMutex );
-
- m_AddIndex = new_add_index;
-
- // One last double-check.
-
- if ( m_AddIndex == m_GetIndex )
- {
- m_GrowBy ( m_Size );
- }
-
- }
- else
- {
- m_AddIndex = new_add_index;
- }
-
- return true;
-}
-
-template <class T>
-inline bool CQueueT<T>::Get( T& item )
-{
- // Prevent other threads from entering Get()
- Mutex::Lock getlock ( m_GetMutex );
-
- if ( m_GetIndex == m_AddIndex )
- {
- // Let's check to see if our queue has grown too big
- // If it has, then shrink it
-
- if ( m_Size > 1024 )
- {
- // Yup, we're too big for our britches
- Mutex::TryLock addlock ( m_AddMutex );
- if ( addlock )
- {
- // Now, no one can add to the queue
-
- if ( m_GetIndex == m_AddIndex ) // is queue empty?
- {
- // See if we can just shrink it...
- T* return_value = (T*)HEAPREALLOC(m_Items,1024 * sizeof(T));
-
- if ( return_value != NULL )
- {
- m_Items = (T*) return_value;
- }
- else
- {
- // Looks like we'll have to do it the hard way
- HEAPFREE ( m_Items );
- m_Items = (T*) HEAPALLOC ( 1024 * sizeof(T) );
- }
-
- m_Size = ( m_Items == NULL ) ? 0 : 1024;
- m_AddIndex = 0;
- m_GetIndex = 0;
- }
- else
- {
- // m_GetIndex != m_AddIndex, this means that someone added
- // to the queue between the time we checked m_Size for being
- // too big and the time we entered the add critical section.
- // If this happened then we are too busy to shrink
- }
- }
- }
- return false;
- }
-
- item = m_Items[ m_GetIndex ];
-
- // Make sure m_GetIndex is never invalid
-
- m_GetIndex = ( ( m_GetIndex + 1 ) >= (off_t)m_Size ) ? 0 : m_GetIndex + 1;
-
- return true;
-}
-
-template <class T>
-inline int CQueueT<T>::GetArray ( T* items, const int maxget, const T& tEnd )
-{
- // TODO - oooh baby does this need to be optimized
- // Prevent other threads from entering Get()
- Mutex::Lock getlock ( m_GetMutex ); //::EnterCriticalSection( &m_GetCriticalSection );
-
- int iResult = 0;
- for ( int i = 0; i < maxget; i++ )
- {
- if ( !Get(items[i]) )
- break;
- iResult++;
- if ( items[i] == tEnd )
- break;
- }
- // Let other threads call Get() now
- //::LeaveCriticalSection( &m_GetCriticalSection );
- return iResult;
-}
-
-template <class T>
-inline size_t CQueueT<T>::GetLength() const
-{
- // This is a very expensive process!
- // No one can call Add() or Get() while we're computing this
-
- size_t number_of_items_in_the_queue = 0;
-
- Mutex::Lock addlock ( m_AddMutex );
- Mutex::Lock getlock ( m_GetMutex );
-
- number_of_items_in_the_queue = ( m_AddIndex >= m_GetIndex ) ?
- ( m_AddIndex - m_GetIndex ) :
- ( ( m_AddIndex + m_Size ) - m_GetIndex );
-
- return number_of_items_in_the_queue;
-}
-
-template <class T>
-inline void CQueueT<T>::m_GrowBy ( size_t number_of_new_items )
-{
- // Prevent other threads from calling Get().
- // We don't need to enter the AddCriticalSection because
- // m_GrowBy() is only called from Add();
-
- T* new_array = NULL;
- T* pointer_to_free = NULL;
-
- size_t new_size = m_Size + number_of_new_items;
-
- { // Prevent other threads from getting
- Mutex::Lock getlock ( m_GetMutex );
-
- // 2000-05-16
- // Thanks go to Royce Mitchell III (royce3@aim-controls.com) for finding
- // a HUGE bug here. I was using HeapReAlloc as a short cut but my logic
- // was flawed. In certain circumstances, queue items were being dropped.
-
- new_array = (T*)HEAPALLOC ( new_size * sizeof(T) );
-
- // Now copy all of the old items from the old queue to the new one.
-
- // Get the entries from the get-index to the end of the array
- memcpy ( new_array, &m_Items[m_GetIndex], ( m_Size - m_GetIndex ) * sizeof(T) );
-
- // Get the entries from the beginning of the array to the add-index
- memcpy ( &new_array[m_Size-m_GetIndex], m_Items, m_AddIndex * sizeof(T) );
-
- m_AddIndex = (off_t)m_Size;
- m_GetIndex = 0;
- m_Size = new_size;
- pointer_to_free = m_Items;
- m_Items = new_array;
- } // Mutex::Lock
- HEAPFREE ( pointer_to_free );
-}
-
-template <class T>
-inline bool CQueueT<T>::Contains ( const T& t )
-{
- Mutex::Lock addlock ( m_AddMutex );
- Mutex::Lock getlock ( m_GetMutex );
-
- for ( int i = m_GetIndex; i != m_AddIndex; i++ )
- {
- if ( i == m_Size )
- i = 0;
- if ( m_Items[i] == t )
- return true;
- }
- return m_Items[m_AddIndex] == t;
-}
-
-typedef CQueueT<char> CCharQueue;
-
-#endif // QUEUE_CLASS_HEADER
+++ /dev/null
-// Reli.h
-// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
-// The rest is (C) 2002-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#ifndef __RELI_H
-#define __RELI_H
-
-////////////////////////////////////////////////////////////////////////////////
-// Assert
-
-#undef Assert
-#ifdef NDEBUG
- #define Assert(exp) ((void)0)
-#else
- void _wassert (char* szExpr, char* szFile, int line);
- #define Assert(exp) (void)( (exp) || (_wassert(#exp, __FILE__, __LINE__), 0) )
-#endif /* NDEBUG */
-
-////////////////////////////////////////////////////////////////////////////////
-// Swap
-
-template <class T>
-void Swap(T a,T b)
-{
- T t = a;
- a = b;
- b = t;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Uncopyable - base class disabling copy ctors
-class Uncopyable
-{
-public:
- Uncopyable(){} // need a default ctor
-private:
- Uncopyable ( const Uncopyable& );
- const Uncopyable& operator = ( const Uncopyable& );
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// SPtr - Smart Pointer's must be passed by reference or const reference
-
-template <class T>
-class SPtr : public Uncopyable
-{
-public:
- virtual ~SPtr () { Destroy(); }
- T * operator->() { return _p; }
- T const * operator->() const { return _p; }
- operator T&() { Assert(_p); return *_p; }
- operator const T&() const { Assert(_p); return *_p; }
- void Acquire ( SPtr<T>& t ) { Destroy(); Swap(_p,t._p); }
- void Destroy() { if ( _p ) { delete _p; _p = 0; } }
-protected:
- SPtr (): _p (0) {}
- explicit SPtr (T* p): _p (p) {}
- T * _p;
-private:
- operator T* () { return _p; }
-};
-
-#define DECLARE_SPTR(cls,init,init2) \
-class S##cls : public SPtr<cls> \
-{ \
-public: \
- S##cls ( cls* p ) : SPtr<cls>(p) {} \
- explicit S##cls init : SPtr<cls> (new cls init2) {} \
-};
-/* Example Usage of DECLARE_SPTR:
-class MyClass
-{
-public: // can be protected
- MyClass ( int i )
- {
- ...
- }
- ...
-}; DECLARE_SPTR(MyClass,(int i),(i))
-SMyClass ptr(i);
-*/
-#define DECLARE_SPTRV(cls) typedef SPtr<cls> S##cls;
-/* Example Usage of DECLARE_SPTRV:
-class MyAbstractClass
-{
-public: // can be protected
- MyAbstractClass ( int i )
- {
- ...
- }
- void MyPureVirtFunc() = 0;
- ...
-}; DECLARE_SPTRV(MyAbstractClass)
-SMyAbstractClass ptr ( new MySubClass(i) );
-*/
-
-#define DECLARE_PTR(cls,init,init2) \
- class Ptr : public SPtr<cls> \
- { \
- Ptr(cls* p) : SPtr<cls> ( p ) \
- { \
- } \
- Ptr init : SPtr<cls> ( new cls init2 ) {} \
- };
-/* Example Usage of DECLARE_PTR:
-class MyClass
-{
- DECLARE_PTR(MyClass,(int i),(i))
-public: // can be protected
- MyClass ( int i )
- {
- ...
- }
- void MyPureVirtFunc() = 0;
- ...
-};
-MyClass::Ptr ptr ( i );
-*/
-
-#define DECLARE_PTRV(cls) \
- class Ptr : public SPtr<cls> \
- { \
- Ptr(cls* p) : SPtr<cls> ( p ) \
- { \
- } \
- };
-/* Example Usage of DECLARE_PTRV:
-class MyAbstractClass
-{
- DECLARE_PTRV(MyAbstractClass)
-public: // can be protected
- MyAbstractClass ( int i )
- {
- ...
- }
- void MyPureVirtFunc() = 0;
- ...
-};
-MyAbstractClass::Ptr ptr ( new MySubClass(i) );
-*/
-
-#endif//__RELI_H
+++ /dev/null
-// ReliMT.cpp
-// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
-// The rest is (C) 2002-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#include <stdlib.h>
-#include <stdio.h>
-#ifdef WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# define snprintf _snprintf
-#elif defined(UNIX)
-# include <errno.h>
-# include <sys/sem.h>
-#else
-# error unrecognized target
-#endif//WIN32|UNIX
-#include "verify.h"
-#include "ReliMT.h"
-
-////////////////////////////////////////////////////////////////////////////////
-// Assert
-
-void _wassert ( char* szExpr, char* szFile, int line )
-{
- fprintf ( stderr, "Assertion Failure: \"%s\" in file %s, line %d", szExpr, szFile, line );
- exit (-1);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Thread
-
-Thread::Thread ( long (THREADAPI * pFun) (void* arg), void* pArg )
-{
-#ifdef WIN32
- verify ( _handle = CreateThread (
- 0, // Security attributes
- 0, // Stack size
- (DWORD (WINAPI*)(void*))pFun,
- pArg,
- 0, // don't create suspended.
- &_tid ));
-#elif defined(UNIX)
- // set up the thread attribute: right now, we do nothing with it.
- pthread_attr_t attr;
- pthread_attr_init(&attr);
-
- // this will make the threads created by this process really concurrent
- verify ( !pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) );
-
- // create the new OS thread object
- verify ( !pthread_create ( &_threadId, &attr, (void* (*) (void*))pFun, pArg ) );
-
- verify ( !pthread_attr_destroy(&attr) );
-#else
-# error unrecognized target
-#endif//WIN32|UNIX
-}
-
-Thread::~Thread()
-{
-#ifdef WIN32
- verify ( CloseHandle ( _handle ) );
-#elif defined(UNIX)
- verify ( !pthread_cancel ( _threadId ) );
-#else
-# error unrecognized target
-#endif//WIN32|UNIX
-}
-
-/*void Thread::Resume()
-{
-#ifdef WIN32
- ResumeThread (_handle);
-#elif defined(UNIX)
-# error how to resume thread in unix?
-#else
-# error unrecognized target
-#endif//WIN32|UNIX
-}*/
-
-void Thread::WaitForDeath()
-{
-#ifdef WIN32
- DWORD dw = WaitForSingleObject ( _handle, 2000 );
- ASSERT ( dw != WAIT_FAILED );
-#elif defined(UNIX)
- verify ( !pthread_join ( _threadId, (void**)NULL ) );
-#else
-# error unrecognized target
-#endif//WIN32|UNIX
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// ActiveObject
-
-// The constructor of the derived class
-// should call
-// _thread.Resume();
-// at the end of construction
-
-ActiveObject::ActiveObject() : _isDying (0), _thread (0)
-{
-}
-
-ActiveObject::~ActiveObject()
-{
- ASSERT ( !_thread ); // call Kill() from subclass's dtor
- // Kill() - // You can't call a virtual function from a dtor, EVEN INDIRECTLY
- // so, you must call Kill() in the subclass's dtor
-}
-
-// FlushThread must reset all the events on which the thread might be waiting.
-void ActiveObject::Kill()
-{
- if ( _thread )
- {
- _isDying++;
- FlushThread();
- // Let's make sure it's gone
- _thread->WaitForDeath();
- delete _thread;
- _thread = 0;
- }
-}
-
-void ActiveObject::Start()
-{
- ASSERT ( !_thread );
- _thread = new Thread ( ThreadEntry, this );
-}
-
-long THREADAPI ActiveObject::ThreadEntry ( void* pArg )
-{
- ActiveObject * pActive = (ActiveObject*)pArg;
- pActive->InitThread();
- pActive->Run();
- pActive->Kill();
- return 0;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Mutex
-
-Mutex::Mutex()
-{
-#ifdef WIN32
- verify ( _h = CreateMutex ( NULL, FALSE, NULL ) );
-#elif defined(UNIX)
- pthread_mutexattr_t attrib;
- verify ( !pthread_mutexattr_init( &attrib ) );
- // allow recursive locks
- verify ( !pthread_mutexattr_settype( &attrib, PTHREAD_MUTEX_RECURSIVE ) );
- verify ( !pthread_mutex_init ( &_mutex, &attrib ) );
-#else
-# error unrecognized target
-#endif
-}
-
-Mutex::~Mutex()
-{
-#ifdef WIN32
- verify ( CloseHandle ( _h ) );
-#elif defined(UNIX)
- verify ( !pthread_mutex_destroy(&_mutex) );
-#else
-# error unrecognized target
-#endif
-}
-
-void Mutex::Acquire()
-{
-#ifdef WIN32
- DWORD dw = WaitForSingleObject ( _h, INFINITE );
- ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_ABANDONED );
-#elif defined(UNIX)
- verify ( !pthread_mutex_lock(&_mutex) );
-#else
-# error unrecognized target
-#endif
-}
-
-bool Mutex::TryAcquire()
-{
-#ifdef WIN32
- DWORD dw = WaitForSingleObject ( _h, 1 );
- ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_TIMEOUT || dw == WAIT_ABANDONED );
- return (dw != WAIT_TIMEOUT);
-#elif defined(UNIX)
- int err = pthread_mutex_trylock(&_mutex);
- ASSERT ( err == EBUSY || err == 0 );
- return (err == 0);
-#else
-# error unrecognized target
-#endif
-}
-
-void Mutex::Release()
-{
-#ifdef WIN32
- verify ( ReleaseMutex ( _h ) );
-#elif defined(UNIX)
- verify ( !pthread_mutex_unlock(&_mutex) );
- // we could allow EPERM return value too, but we are forcing user into RIIA
-#else
-# error unrecognized target
-#endif
-}
-
-Mutex::Lock::Lock ( Mutex& m ) : _m(m)
-{
- _m.Acquire();
-}
-
-Mutex::Lock::~Lock()
-{
- _m.Release();
-}
-
-Mutex::TryLock::TryLock ( Mutex& m ) : _m(m)
-{
- _bLocked = _m.TryAcquire();
-}
-
-Mutex::TryLock::~TryLock()
-{
- if ( _bLocked )
- _m.Release();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Event
-
-Event::Event()
-{
-#ifdef WIN32
- // start in non-signaled state (red light)
- // auto reset after every Wait
- verify ( _handle = CreateEvent ( 0, FALSE, FALSE, 0 ) );
-#elif defined(UNIX)
- //verify ( !pthread_cond_init ( &_cond, NULL /* default attributes */) );
- sem_init();
- //verify(sem_init());
-#else
-# error unrecognized target
-#endif
-}
-
-Event::~Event()
-{
-#ifdef WIN32
- verify ( CloseHandle ( _handle ) );
-#elif defined(UNIX)
- //verify ( !pthread_cond_destroy ( &_cond ) );
- sem_destroy();
-#else
-# error unrecognized target
-#endif
-}
-
-void Event::Release() // put into signaled state
-{
-#ifdef WIN32
- verify ( SetEvent ( _handle ) );
-#elif defined(UNIX)
- //verify ( !pthread_cond_signal ( &_cond ) );
- verify(!sem_V());
-#else
-# error unrecognized target
-#endif
-}
-
-void Event::Wait()
-{
-#ifdef WIN32
- // Wait until event is in signaled (green) state
- DWORD dw = WaitForSingleObject ( _handle, INFINITE );
- ASSERT ( dw == WAIT_OBJECT_0 || dw == WAIT_ABANDONED );
-#elif defined(UNIX)
- // According to docs: The pthread_cond_wait() and pthread_cond_timedwait()
- // functions are used to block on a condition variable. They are called
- // with mutex locked by the calling thread or undefined behaviour will
- // result.
- //Mutex::Lock lock ( _mutex );
- //verify ( !pthread_cond_wait ( &_cond, _mutex ) );
- verify(!sem_P());
-#else
-# error unrecognized target
-#endif
-}
-
-#ifdef UNIX
-void Event::sem_init()
-{
- sem_id = semget(IPC_PRIVATE, 1, 0666 | IPC_CREAT);
- ASSERT(sem_id != -1);
-}
-
-int Event::sem_P()
-{
- struct sembuf sb;
- sb.sem_num = 0;
- sb.sem_op = -1;
- sb.sem_flg = 0;
- return semop(sem_id, &sb, 1);
-}
-
-int Event::sem_V()
-{
- struct sembuf sb;
- sb.sem_num = 0;
- sb.sem_op = 1;
- sb.sem_flg = 0;
- return semop(sem_id, &sb, 1);
-}
-
-void Event::sem_destroy()
-{
-#ifdef MACOSX
- semun mactmp;
- mactmp.val = 0;
- semctl(sem_id, 0, IPC_RMID, mactmp);
-#else
- semctl(sem_id, 0, IPC_RMID, 0);
-#endif
-}
-#endif
-
+++ /dev/null
-// ReliMT.h
-// lots of code here is (c) Bartosz Milewski, 1996, www.relisoft.com
-// The rest is (C) 2003-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-
-#ifndef __RELIMT_H
-#define __RELIMT_H
-
-#include "Reli.h"
-
-#ifdef WIN32
-# ifndef _WINDOWS_
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# endif
-# define THREADAPI WINAPI
-#elif defined(UNIX)
-# include <pthread.h>
-# include <stdlib.h>
-# include "string.h"
-# include <sys/types.h> //Semaphore
-# include <sys/ipc.h> //Semaphore
-# include <sys/sem.h> //Semaphore
-# define THREADAPI
-#else
-# error unrecognized target
-#endif
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Thread
-
-class Thread : public Uncopyable
-{
-public:
- Thread ( long (THREADAPI * pFun) (void* arg), void* pArg );
- ~Thread();
- //void Resume();
- void WaitForDeath();
-
- // platform-specific stuff:
-private:
-#ifdef WIN32
- HANDLE _handle;
- DWORD _tid; // thread id
-#elif defined(UNIX)
- pthread_t _threadId; // id of the thread
-#else
-# error unrecognized target
-#endif
- //DECLARE_PTR(Thread,(long (THREADAPI * pFun) (void* arg), void* pArg),(pFun,pArg));
-}; //DECLARE_SPTR(Thread,(long (THREADAPI * pFun) (void* arg), void* pArg),(pFun,pArg));
-
-////////////////////////////////////////////////////////////////////////////////
-// ActiveObject
-
-class ActiveObject : public Uncopyable
-{
-public:
- ActiveObject();
- virtual ~ActiveObject();
- void Kill();
- void Start();
-
-protected:
- virtual void InitThread() = 0;
- virtual void Run() = 0;
- virtual void FlushThread() = 0;
-
- int _isDying;
-
- static long THREADAPI ThreadEntry ( void *pArg );
- Thread *_thread;
-
- //DECLARE_PTRV(ActiveObject);
-}; //DECLARE_SPTRV(ActiveObject);
-
-// Last thing in the constructor of a class derived from
-// ActiveObject you must call
-// Start();
-// Inside the loop the Run method you must keep checking _isDying
-// if (_isDying)
-// return;
-// FlushThread must reset all the events on which the thread might be waiting.
-// Example:
-#if 0
-// MyAsyncOutputter - class that outputs strings to a file asynchronously
-class MyAsyncOutputter : public ActiveObject
-{
-public:
- MyAsyncOutputter ( const string& filename ) : _filename(filename), _currentBuf(0)
- {
- Start(); // start thread
- }
- void InitThread()
- {
- _f.open ( _filename, "wb" );
- }
- void Output ( const string& s )
- {
- {
- // acquire lock long enough to add the string to the active buffer
- Mutex::Lock lock ( _mutex );
- _buf[_currentBuf].push_back ( s );
- }
- _event.Release(); // don't need the lock fire the event
- }
- void Run()
- {
- while ( !_isDying )
- {
- // wait for signal from Output() or FlushThread()
- _event.Wait();
- {
- // acquire lock long enough to switch active buffers
- Mutex::Lock lock ( _mutex );
- _currentBuf = 1-_currentBuf;
- ASSERT ( !_buf[_currentBuf].size() );
- }
- // get a reference to the old buffer
- vector<string>& buf = _buf[1-_currentBuf];
- // write each string out to file and then empty the buffer
- for ( int i = 0; i < buf.size(); i++ )
- _f.write ( buf[i].c_str(), buf[i].size() );
- buf.resize(0);
- }
- }
- void FlushThread()
- {
- // _isDying is already set: signal thread so it can see that too
- _event.Release();
- }
-private:
- string _filename;
- File _f;
- int _currentBuf;
- vector<string> _buf[2];
- Event _event;
- Mutex _mutex;
-};
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// Mutex
-
-class Mutex : public Uncopyable
-{
-public:
- Mutex();
- ~Mutex();
-private:
- void Acquire();
- bool TryAcquire();
- void Release();
-public:
- // sub-class used to lock the Mutex
- class Lock : public Uncopyable
- {
- public:
- Lock ( Mutex& m );
- ~Lock();
-
- private:
- // private data
- Mutex& _m;
- };
- friend class Mutex::Lock;
-
-
- // sub-class used to attempt to lock the mutex. Use operator bool()
- // to test if the lock was successful
- class TryLock : public Uncopyable
- {
- public:
- TryLock ( Mutex& m );
- ~TryLock();
- operator bool () { return _bLocked; }
-
- private:
- // private data
- bool _bLocked;
- Mutex& _m;
- };
- friend class Mutex::TryLock;
-
-private:
- // platform-specific stuff:
-#ifdef WIN32
- HANDLE _h;
-#elif defined(UNIX)
- pthread_mutex_t _mutex;
-public: operator pthread_mutex_t* () { return &_mutex; }
-#else
-# error unrecognized target
-#endif
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Event
-
-class Event : public Uncopyable
-{
-public:
- Event();
- ~Event();
- void Release(); // put into signaled state
- void Wait();
-
-private:
-#ifdef WIN32
- HANDLE _handle;
-#elif defined(UNIX)
- //Sem util functions
- void sem_init();
- int sem_P();
- int sem_V();
- void sem_destroy();
-
- int sem_id;
- //pthread_cond_t _cond;
- //Mutex _mutex;
-#else
-# error unrecognized target
-#endif
- //DECLARE_PTR(Event,(),());
-}; //DECLARE_SPTR(Event,(),());
-
-#endif//__RELIWIN32_H
+++ /dev/null
-// SockUtils.cpp - Some basic socket utility functions.
-// (C) 2002-2004 Royce Mitchell III
-// This file is under the BSD & LGPL licenses
-
-#include <stdio.h>
-#include "SockUtils.h"
-#ifdef WIN32
-# ifndef SD_SEND // defined in winsock2.h, but not winsock.h
-# define SD_SEND 1
-# endif
-# define snprintf _snprintf
-# ifdef _MSC_VER
-# pragma comment ( lib, "ws2_32.lib" )
-# endif//_MSC_VER
-#elif defined(UNIX)
-# include <errno.h>
-# include "string.h" // memset
-# include <netdb.h> // hostent
-# include <arpa/inet.h> //inet_addr
-# include <sys/time.h>
-# define SD_SEND SHUT_WR //bah thou shalt name thy defines the same
-#else
-# error unrecognized target
-#endif
-//// Constants /////////////////////////////////////////////////////////
-const int kBufferSize = 1024;
-// creates broadcast address
-SockAddrIn::SockAddrIn()
-{
- memset ( this, 0, sizeof(sockaddr_in) );
- sin_family = AF_INET;
-}
-SockAddrIn::SockAddrIn ( const char* szAddr, u_short iPort )
-{
- memset ( this, 0, sizeof(sockaddr_in) );
- sin_family = AF_INET;
- sin_addr.s_addr = suLookupAddress(szAddr);
- sin_port = htons(iPort);
-}
-SockAddrIn::SockAddrIn ( in_addr_t iAddr, u_short iPort )
-{
- memset ( this, 0, sizeof(sockaddr_in) );
- sin_family = AF_INET;
- sin_addr.s_addr = iAddr;
- sin_port = htons(iPort);
-}
-bool suStartup()
-{
-#ifdef WIN32
- WSADATA wsaData;
- if ( WSAStartup ( MAKEWORD(2,0), &wsaData ) )
- return false;
- if ( wsaData.wVersion != MAKEWORD(2,0) )
- {
- WSACleanup();
- return false;
- }
- return true;
-#elif defined(UNIX)
- // nothing special required here
- return true;
-#else
-# error unrecognized target
-#endif
-}
-//// suTcpSocket ////////////////////////////////////////////////
-// Creates a TCP socket.
-SOCKET suTcpSocket()
-{
- SOCKET so = socket ( AF_INET, SOCK_STREAM, 0 );
-#if defined(_DEBUG) && defined(WIN32)
- if ( so == INVALID_SOCKET && WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
- return so;
-}
-//// suUdpSocket ////////////////////////////////////////////////
-// Creates a UDP socket. Compensates for new "functionality" introduced
-// in Win2K with regards to select() calls
-// MS Transport Provider IOCTL to control
-// reporting PORT_UNREACHABLE messages
-// on UDP sockets via recv/WSARecv/etc.
-// Path TRUE in input buffer to enable (default if supported),
-// FALSE to disable.
-#ifndef SIO_UDP_CONNRESET
-#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
-#endif//SIO_UDP_CONNRESET
-SOCKET suUdpSocket()
-{
- SOCKET so = socket ( AF_INET, SOCK_DGRAM, 0 );
-#if defined(_DEBUG) && defined(WIN32)
- if ( so == INVALID_SOCKET && WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
-#ifdef WIN32
- // for Windows 2000, disable new behavior...
- // see: http://www-pc.uni-regensburg.de/systemsw/W2KPRO/UPDATE/POSTSP1/Q263823.htm
- // this code is innocuous on other win32 platforms
- DWORD dwBytesReturned = 0;
- BOOL bNewBehavior = FALSE;
- // disable new Win2K behavior using
- // IOCTL: SIO_UDP_CONNRESET
- // we don't care about return value :)
- WSAIoctl(so, SIO_UDP_CONNRESET,
- &bNewBehavior, sizeof(bNewBehavior),
- NULL, 0, &dwBytesReturned,
- NULL, NULL);
-#endif
- return so;
-}
-//// suShutdownConnection ////////////////////////////////////////////////
-// Gracefully shuts the connection sd down. Returns true if it was able
-// to shut it down nicely, false if we had to "slam" it shut.
-// (either way, the socket does get closed)
-bool suShutdownConnection(SOCKET sd)
-{
- if ( sd == INVALID_SOCKET )
- return true;
- // Disallow any further data sends. This will tell the other side
- // that we want to go away now. If we skip this step, we don't
- // shut the connection down nicely.
- if (shutdown(sd, SD_SEND) == SOCKET_ERROR)
- {
- closesocket(sd);
- return false;
- }
- // Receive any extra data still sitting on the socket. After all
- // data is received, this call will block until the remote host
- // acknowledges the TCP control packet sent by the shutdown above.
- // Then we'll get a 0 back from recv, signalling that the remote
- // host has closed its side of the connection.
- char acReadBuffer[kBufferSize];
- for ( ;; )
- {
- int nNewBytes = recv(sd, acReadBuffer, kBufferSize, 0);
- if (nNewBytes == SOCKET_ERROR)
- {
- closesocket(sd);
- return false;
- }
- else if (nNewBytes != 0)
- {
- // FYI, received (nNewBytes) unexpected bytes during shutdown.
- }
- else
- {
- // Okay, we're done!
- break;
- }
- }
- // Close the socket.
- if (closesocket(sd) == SOCKET_ERROR)
- {
- return false;
- }
- return true;
-}
-//// suLookupAddress ////////////////////////////////////////////////
-// Basically converts a name address to an ip address
-in_addr_t suLookupAddress ( const char* pcHost )
-{
- in_addr_t nRemoteAddr = inet_addr(pcHost);
- if ( nRemoteAddr == INADDR_NONE )
- {
- // pcHost isn't a dotted IP, so resolve it through DNS
- hostent* pHE = gethostbyname(pcHost);
- if ( pHE == 0 )
- {
-#if defined(_DEBUG) && defined(WIN32)
- if ( WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
- return INADDR_NONE;
- }
- nRemoteAddr = *((in_addr_t*)pHE->h_addr_list[0]);
- }
- return nRemoteAddr;
-}
-bool suConnect ( SOCKET so, in_addr_t iAddress, u_short iPort )
-{
- SockAddrIn sinRemote ( iAddress, iPort );
- if ( SOCKET_ERROR == connect(so,sinRemote,sizeof(sinRemote)) )
- {
-#if defined(_DEBUG) && defined(WIN32)
- if ( WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
- return false;
- }
- return true;
-}
-bool suConnect ( SOCKET so, const char* szAddress, u_short iPort )
-{
- return suConnect ( so, suLookupAddress(szAddress), iPort );
-}
-//// suEstablishConnection ////////////////////////////////////////////////
-// creates a socket of the specified type, connects to the ip address/port
-// requested, and returns the SOCKET created
-SOCKET suEstablishConnection ( in_addr_t iAddress, u_short iPort, int type )
-{
- // Create a socket
- if ( type != SOCK_STREAM && type != SOCK_DGRAM )
- return INVALID_SOCKET;
- SOCKET so = socket(AF_INET, type, 0);
- if ( so == INVALID_SOCKET )
- return so;
- if ( !suConnect(so, iAddress, iPort) )
- {
- closesocket(so);
- return INVALID_SOCKET;
- }
- return so;
-}
-//// suEstablishConnection ////////////////////////////////////////////////
-// creates a socket of the specified type, connects to the address/port
-// requested, and returns the SOCKET created
-SOCKET suEstablishConnection ( const char* szAddress, u_short iPort, int type )
-{
- return suEstablishConnection ( suLookupAddress ( szAddress ), iPort, type );
-}
-//// suBroadcast ////////////////////////////////////////////////
-// takes a previously created broadcast-enabled UDP socket, and broadcasts
-// a message on the local network
-bool suBroadcast ( SOCKET so, u_short port, const char* buf, int len /* = -1 */ )
-{
- if ( len == -1 )
- len = (int)strlen(buf);
-#if 1
- SockAddrIn to ( INADDR_BROADCAST, port );
-#else // some strange MS OS's don't broadcast to localhost...
- SockAddrIn to ( "127.0.0.1", port );
- if ( SOCKET_ERROR == sendto ( so, buf, len, 0, to, sizeof(to) ) )
- return false;
- to.sin_addr.s_addr = INADDR_BROADCAST;
-#endif
- if ( SOCKET_ERROR == sendto ( so, buf, len, 0, to, sizeof(to) ) )
- return false;
- return true;
-}
-//// suRecv ////////////////////////////////////////////////
-// retrieves data sent to our TCP socket. If no data, waits for
-// a period of timeout ms.
-// returns bytes received
-// -1 == SOCKET_ERROR
-// -2 == timed out waiting for data
-int suRecv ( SOCKET so, char* buf, int buflen, int timeout )
-{
- struct timeval to;
- fd_set rread;
- int res;
- FD_ZERO(&rread); // clear the fd_set
- FD_SET(so,&rread); // indicate which socket(s) we want to check
- memset((char *)&to,0,sizeof(to)); // clear the timeval struct
- to.tv_sec = timeout; // timeout select after (timeout) seconds
- // select returns > 0 if there is an event on the socket
- res = select((int)so+1, &rread, (fd_set *)0, (fd_set *)0, &to );
- if (res < 0)
- return -1; // socket error
- // there was an event on the socket
- if ( (res>0) && (FD_ISSET(so,&rread)) )
- return recv ( so, buf, buflen, 0 );
- return -2;
-}
-//// suRecvFrom ////////////////////////////////////////////////
-// retrieves data sent to our UDP socket. If no data, waits for
-// a period of timeout ms.
-// returns bytes received
-// returns bytes received
-// -1 == SOCKET_ERROR
-// -2 == timed out waiting for data
-int suRecvFrom ( SOCKET so, char* buf, int buflen, int timeout, sockaddr_in* from, socklen_t* fromlen )
-{
- struct timeval to;
- fd_set rread;
- int res;
- FD_ZERO(&rread); // clear the fd_set
- FD_SET(so,&rread); // indicate which socket(s) we want to check
- memset((char *)&to,0,sizeof(to)); // clear the timeval struct
- to.tv_sec = timeout; // timeout select after (timeout) seconds
- // select returns > 0 if there is an event on the socket
- res = select((int)so+1, &rread, (fd_set *)0, (fd_set *)0, &to );
- if (res < 0)
- return -1; // socket error
- // there was an event on the socket
- if ( (res>0) && (FD_ISSET(so,&rread)) )
- return recvfrom ( so, buf, buflen, 0, (sockaddr*)from, fromlen );
- return -2; // timeout
-}
-//// suBind ////////////////////////////////////////////////
-// binds a UDP socket to an interface & port to receive
-// data on that port
-bool suBind ( SOCKET so, in_addr_t iInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
-{
- SockAddrIn sinInterface ( iInterfaceAddress, iListenPort );
- if ( bReuseAddr )
- {
- int optval = -1; // true
- if ( SOCKET_ERROR == setsockopt ( so, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optval) ) )
- {
-#if defined(_DEBUG) && defined(WIN32)
- if ( WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
- return false;
- }
- }
- if ( SOCKET_ERROR == bind(so, sinInterface, sizeof(sinInterface)) )
- {
- int err = SUERRNO;
- if ( err != EADDRINUSE )
- return false;
-#if defined(_DEBUG) && defined(WIN32)
- if ( WSANOTINITIALISED == WSAGetLastError() )
- MessageBox ( NULL, "You forgot to call suStartup()!", "SockUtils", MB_OK|MB_ICONEXCLAMATION );
-#endif
- }
- return true;
-}
-//// suBind ////////////////////////////////////////////////
-// binds a UDP socket to an interface & port to receive
-// data on that port
-bool suBind ( SOCKET so, const char* szInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
-{
- in_addr_t iInterfaceAddr = inet_addr(szInterfaceAddress);
- if ( iInterfaceAddr == INADDR_NONE )
- return false;
- return suBind ( so, iInterfaceAddr, iListenPort, bReuseAddr );
-}
-//// suEnableBroadcast ////////////////////////////////////////////////
-// in order to send broadcast messages on a UDP socket, this function
-// must be called first
-bool suEnableBroadcast ( SOCKET so, bool bEnable /* = true */ )
-{
- int optval = bEnable ? -1 : 0;
- if ( SOCKET_ERROR == setsockopt ( so, SOL_SOCKET, SO_BROADCAST, (const char*)&optval, sizeof(optval) ) )
- return false;
- return true;
-}
-//// suErrDesc ////////////////////////////////////////////////
-// returns text description of error code
-const char* suErrDesc ( int err )
-{
- static char errbuf[256];
-#ifdef WIN32
- switch ( err )
- {
-#define X(E) case E: return #E;
- X(WSAEINTR) X(WSAEBADF)
- X(WSAEACCES) X(WSAEFAULT)
- X(WSAEINVAL) X(WSAEMFILE)
- X(WSAEWOULDBLOCK) X(WSAEINPROGRESS)
- X(WSAEALREADY) X(WSAENOTSOCK)
- X(WSAEDESTADDRREQ) X(WSAEMSGSIZE)
- X(WSAEPROTOTYPE) X(WSAENOPROTOOPT)
- X(WSAEPROTONOSUPPORT) X(WSAESOCKTNOSUPPORT)
- X(WSAEOPNOTSUPP) X(WSAEPFNOSUPPORT)
- X(WSAEAFNOSUPPORT) X(WSAEADDRINUSE)
- X(WSAEADDRNOTAVAIL) X(WSAENETDOWN)
- X(WSAENETUNREACH) X(WSAENETRESET)
- X(WSAECONNABORTED) X(WSAECONNRESET)
- X(WSAENOBUFS) X(WSAEISCONN)
- X(WSAENOTCONN) X(WSAESHUTDOWN)
- X(WSAETOOMANYREFS) X(WSAETIMEDOUT)
- X(WSAECONNREFUSED) X(WSAELOOP)
- X(WSAENAMETOOLONG) X(WSAEHOSTDOWN)
- X(WSAEHOSTUNREACH) X(WSAENOTEMPTY)
- X(WSAEPROCLIM) X(WSAEUSERS)
- X(WSAEDQUOT) X(WSAESTALE)
- X(WSAEREMOTE) X(WSASYSNOTREADY)
- X(WSAVERNOTSUPPORTED) X(WSANOTINITIALISED)
- X(WSAEDISCON) X(WSAENOMORE)
- X(WSAECANCELLED) X(WSAEINVALIDPROCTABLE)
- X(WSAEINVALIDPROVIDER) X(WSAEPROVIDERFAILEDINIT)
- X(WSASYSCALLFAILURE) X(WSASERVICE_NOT_FOUND)
- X(WSATYPE_NOT_FOUND) X(WSA_E_NO_MORE)
- X(WSA_E_CANCELLED) X(WSAEREFUSED)
-#undef X
- }
- snprintf ( errbuf, sizeof(errbuf), "Unknown socket error (%lu)", err );
- errbuf[sizeof(errbuf)-1] = '\0';
- return errbuf;
-#elif defined(UNIX)
- perror(errbuf);
- return errbuf;
-#else
-# error unrecognized target
-#endif
-}
-#if defined(UNICODE) || defined(_UNICODE)
-in_addr_t suLookupAddress ( const wchar_t* pcHost )
-{
- int len = wcslen(pcHost);
- char* p = new char[len+1];
- wcstombs ( p, pcHost, len );
- p[len] = 0;
- in_addr_t rc = suLookupAddress ( p );
- delete[] p;
- return rc;
-}
-bool suBroadcast ( SOCKET so, u_short port, const wchar_t* buf, int len /* = -1 */ )
-{
- char* p = new char[len+1];
- wcstombs ( p, buf, len );
- p[len] = 0;
- bool rc = suBroadcast ( so, port, p, len );
- delete[] p;
- return rc;
-}
-int suRecv ( SOCKET so, wchar_t* buf, int buflen, int timeout )
-{
- char* p = new char[buflen+1];
- int rc = suRecv ( so, p, buflen, timeout );
- p[buflen] = 0;
- mbstowcs ( buf, p, buflen );
- delete[] p;
- return rc;
-}
-int suRecvFrom ( SOCKET so, wchar_t* buf, int buflen, int timeout, sockaddr_in* from, int* fromlen )
-{
- char* p = new char[buflen+1];
- int rc = suRecvFrom ( so, p, buflen, timeout, from, fromlen );
- p[buflen] = 0;
- mbs2wcs ( buf, p, buflen );
- delete[] p;
- return rc;
-}
-bool suBind ( SOCKET so, const wchar_t* szInterfaceAddress, u_short iListenPort, bool bReuseAddr /* = false */ )
-{
- int len = wcslen(szInterfaceAddress);
- char* p = new char[len+1];
- wcstombs ( p, szInterfaceAddress, len );
- p[len] = 0;
- bool rc = suBind ( so, p, iListenPort, bReuseAddr );
- delete[] p;
- return rc;
-}
-#endif//UNICODE
-
-suBufferedRecvSocket::suBufferedRecvSocket ( SOCKET so )
- : suSocket ( so ), _off(0), _len(0)
-{
-}
-
-int suBufferedRecvSocket::recvUntil ( std::string& buf, char until, int timeout )
-{
- if ( !_len )
- _off = 0;
- else if ( _off > (sizeof(_buf)>>1) )
- {
- memmove ( _buf, &_buf[_off], _len );
- _off = 0;
- }
- char* poff = &_buf[_off];
- for ( ;; )
- {
- char* p = (char*)memchr ( poff, until, _len );
- if ( p /*&& p < &poff[_len]*/ )
- {
- int ret_len = p-poff+1;
- buf.resize ( ret_len );
- memmove ( &buf[0], poff, ret_len );
- _off += ret_len;
- _len -= ret_len;
- return ret_len;
- }
- int rc = suRecv ( *this, &poff[_len], sizeof(_buf)-_len-_off, timeout );
- if ( rc < 0 )
- {
- if ( _len )
- {
- rc = _len;
- buf.resize ( rc );
- memmove ( &buf[0], &_buf[_off], rc );
- _len = 0;
- }
- return rc;
- }
- _len += rc;
- }
-}
-
-void suBufferedRecvSocket::recvPending()
-{
- if ( !_len )
- _off = 0;
- else if ( _off > (sizeof(_buf)>>1) )
- {
- memmove ( _buf, &_buf[_off], _len );
- _off = 0;
- }
- char* poff = &_buf[_off];
- while ( sizeof(_buf)-_len-_off )
- {
- int rc = suRecv ( *this, &poff[_len], sizeof(_buf)-_len-_off, 1 );
- if ( rc <= 0 )
- break;
- _len += rc;
- }
-}
-
-bool suBufferedRecvSocket::recvInStr ( char c )
-{
- return NULL != memchr ( &_buf[_off], c, _len );
-}
+++ /dev/null
-// SockUtils.h - Declarations for the Winsock utility functions module.
-// (C) 2002-2004 Royce Mitchell III
-// This file is under the BSD & LGPL licenses
-
-#ifndef __SOCKUTILS_H
-#define __SOCKUTILS_H
-
-#include <string>
-#ifdef WIN32
-# include <winsock2.h>
-# define in_addr_t u_long
-# define SUERRNO WSAGetLastError()
-# define EADDRINUSE WSAEADDRINUSE
-# define ENOTSOCK WSAENOTSOCK
-# define socklen_t int
-#elif defined(UNIX)
-# include <sys/types.h>
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <unistd.h>
-# include <errno.h>
-# define closesocket(so) close(so)
-# define SOCKET int
-# define INVALID_SOCKET -1
-# define SOCKET_ERROR -1
-# define SUERRNO errno
-# ifdef MACOSX
-# define socklen_t int //Stupid mac
-# endif
-#else
-# error unrecognized target
-#endif
-
-#include <assert.h>
-
-extern bool suStartup();
-extern SOCKET suTcpSocket();
-extern SOCKET suUdpSocket();
-extern bool suShutdownConnection(SOCKET sd);
-extern in_addr_t suLookupAddress ( const char* pcHost );
-extern bool suConnect ( SOCKET so, in_addr_t iAddress, u_short iPort );
-extern bool suConnect ( SOCKET so, const char* szAddress, u_short iPort );
-extern SOCKET suEstablishConnection ( in_addr_t iAddress, u_short iPort, int type );
-extern SOCKET suEstablishConnection ( const char* szAddress, u_short iPort, int type );
-extern bool suBroadcast ( SOCKET so, u_short port, const char* buf, int len = -1 );
-extern int suRecv ( SOCKET so, char* buf, int buflen, int timeout );
-extern int suRecvFrom ( SOCKET so, char* buf, int buflen, int timeout, sockaddr_in* from, socklen_t* fromlen );
-extern bool suBind ( SOCKET so, in_addr_t iInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
-extern bool suBind ( SOCKET so, const char* szInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
-extern bool suEnableBroadcast ( SOCKET so, bool bEnable = true );
-extern const char* suErrDesc ( int err );
-
-#if defined(UNICODE) || defined(_UNICODE)
-extern in_addr_t suLookupAddress ( const wchar_t* pcHost );
-extern bool suBroadcast ( SOCKET so, u_short port, const wchar_t* buf, int len = -1 );
-extern int suRecv ( SOCKET so, wchar_t* buf, int buflen, int timeout );
-extern int suRecvFrom ( SOCKET so, wchar_t* buf, int buflen, int timeout, sockaddr_in* from, int* fromlen );
-extern bool suBind ( SOCKET so, const wchar_t* szInterfaceAddress, u_short iListenPort, bool bReuseAddr = false );
-#endif//UNICODE
-
-class suSocket
-{
- SOCKET _so;
-public:
- suSocket ( SOCKET so = INVALID_SOCKET ) : _so(so)
- {
- }
- const suSocket& operator = ( SOCKET so )
- {
- assert ( _so == INVALID_SOCKET ); // must Detach() or Close() existing socket first
- _so = so;
- return *this;
- }
- virtual ~suSocket()
- {
- Close();
- }
- void Close()
- {
- if ( _so != INVALID_SOCKET )
- {
- //suShutdownConnection ( _so ); // TODO - only valid on TCP sockets
- closesocket ( _so );
- _so = INVALID_SOCKET;
- }
- }
- operator SOCKET() const
- {
- return _so;
- }
- SOCKET Attach ( SOCKET so )
- {
- SOCKET old = Detach();
- _so = so;
- return old;
- }
- SOCKET Detach()
- {
- SOCKET so = _so;
- _so = INVALID_SOCKET;
- return so;
- }
-
-private:
- // disable copy semantics
- suSocket ( const suSocket& );
- const suSocket& operator = ( const suSocket& );
-};
-
-class suBufferedRecvSocket : public suSocket
-{
- char _buf[2048];
- int _off;
- int _len;
-public:
- suBufferedRecvSocket ( SOCKET so = INVALID_SOCKET );
- int recvUntil ( std::string& buf, char until, int timeout );
- void recvPending();
- bool recvInStr ( char c );
-};
-
-class SockAddrIn : public sockaddr_in
-{
-public:
- SockAddrIn(); // creates broadcast address
- SockAddrIn ( const char* szAddr, u_short iPort );
- SockAddrIn ( in_addr_t iAddr, u_short iPort );
- operator sockaddr* () { return (sockaddr*)this; }
- operator sockaddr_in* () { return (sockaddr_in*)this; }
-};
-
-#endif//__SOCKUTILS_H
+++ /dev/null
-// SplitJoin.cpp
-//
-// This code is copyright 2003-2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4786 ) // MSVC6 can't handle too-long template names
-#endif//_MSC_VER
-
-//#include <sstream>
-
-#include "SplitJoin.h"
-
-#include <string.h>
-
-using std::string;
-using std::vector;
-//using std::stringstream;
-
-static const char* quotes = "\"\'";
-
-bool Split ( vector<string>& vec, const char* csv, char sep, bool merge )
-{
- string scsv ( csv );
- char* col = &scsv[0];
- vec.resize ( 0 );
- for ( ;; )
- {
- char* p = col;
- while ( isspace(*p) && *p != sep )
- p++;
- char quote = 0;
- if ( strchr ( quotes, *p ) )
- quote = *p++;
- while ( *p && (*p != sep || quote) )
- {
- if ( *p++ == quote )
- break;
- }
-
- while ( isspace(*p) && *p != sep )
- p++;
-
- if ( *p && *p != sep )
- return false;
-
- string scol ( col, p-col );
-
- //quote = scol[0];
- if ( quote )
- {
- if ( scol[scol.size()-1] == quote )
- scol = string ( &scol[1], scol.size()-2 );
- }
-
- if ( scol.length() || !merge )
- vec.push_back ( scol );
-
- if ( !*p )
- break;
-
- col = p + 1;
- }
- return true;
-}
-
-bool Join ( string& csv, vector<string>& vec, char sep )
-{
- csv.resize(0);
- for ( int i = 0; i < vec.size(); i++ )
- {
- if ( i )
- csv += sep;
- string& s = vec[i];
- if ( strchr ( s.c_str(), sep ) )
- {
- if ( strchr ( s.c_str(), '\"' ) )
- {
- if ( strchr ( s.c_str(), '\'' ) )
- return false; // the sep, " and ' are all in the string, can't build valid output
- csv += '\'';
- csv += s;
- csv += '\'';
- }
- else
- {
- csv += '\"';
- csv += s;
- csv += '\"';
- }
- }
- else
- csv += s;
- }
- return true;
-}
+++ /dev/null
-// SplitJoin.h
-//
-// This code is copyright 2003-2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef SPLITJOIN_H
-#define SPLITJOIN_H
-
-#include <vector>
-#include <string>
-
-bool Split (
- std::vector<std::string>& vec,
- const char* csv,
- char sep=',',
- bool merge=false );
-
-bool Join (
- std::string& csv,
- std::vector<std::string>& vec,
- char sep=',' );
-
-inline bool Split (
- std::vector<std::string>& vec,
- const std::string& csv,
- char sep=',',
- bool merge=false )
-{
- return Split ( vec, csv.c_str(), sep, merge );
-}
-
-#endif//SPLIT_H
+++ /dev/null
-// ThreadPool.cpp
-// This file is (C) 2003-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#include <vector>
-using std::vector;
-#include "ThreadPool.h"
-#include "QueueT.h"
-#include "auto_vector.h"
-#include "verify.h"
-#include "ReliMT.h"
-
-class PoolableThread : public ActiveObject
-{
-public:
- PoolableThread ( ThreadPoolImpl& );
- ~PoolableThread()
- {
- Kill();
- }
- void InitThread();
- void Run();
- void FlushThread();
-
- ThreadPoolImpl& _pool;
-};
-
-class ThreadPoolLaunchData
-{
-public:
- ThreadPoolFunc* pFun;
- void* pArg;
-};
-
-template <class T>
-class AtomicCounter : public Uncopyable
-{
- Mutex _m;
- T _t;
-public:
- AtomicCounter ( T init = 0 ) : _t(init)
- {
- }
- AtomicCounter ( const AtomicCounter<T>& t )
- {
- //Mutex::Lock l ( _m ); // don't need to lock since this is a ctor
- Mutex::Lock l2 ( t._m );
- _t = t._t;
- }
- const AtomicCounter<T>& operator = ( const AtomicCounter<T>& t )
- {
- Mutex::Lock l ( _m );
- Mutex::Lock l2 ( t._m );
- _t = t._t;
- return *this;
- }
- T operator ++ ()
- {
- Mutex::Lock l ( _m );
- T t = _t++;
- return t;
- }
- const AtomicCounter<T>& operator ++ ( int )
- {
- Mutex::Lock l ( _m );
- ++_t;
- return *this;
- }
- T operator -- ()
- {
- Mutex::Lock l ( _m );
- T t = _t--;
- return t;
- }
- const AtomicCounter<T>& operator -- ( int )
- {
- Mutex::Lock l ( _m );
- --_t;
- return *this;
- }
- const AtomicCounter<T>& operator += ( T t )
- {
- Mutex::Lock l ( _m );
- return _t += t;
- return *this;
- }
- const AtomicCounter<T>& operator -= ( T t )
- {
- Mutex::Lock l ( _m );
- return _t -= t;
- return *this;
- }
- operator const T& () const
- {
- //Mutex::Lock l ( _m );
- return _t;
- }
- T operator !() const
- {
- //Mutex::Lock l ( _m );
- return !_t;
- }
-};
-
-class ThreadPoolImpl : public Uncopyable
-{
-public:
- ThreadPoolImpl() : _isDying(false), _idleThreads(0)
- {
- }
-
- ~ThreadPoolImpl()
- {
- }
-
- void Shutdown()
- {
- _isDying = true;
- while ( _idleThreads )
- {
- _threadWaitEvent.Release();
- _threadStartEvent.Wait(); // let thread actually get a grip
- }
- }
-
- void Launch ( ThreadPoolFunc* pFun, void* pArg )
- {
- // this mutex is necessary to make sure we never have a conflict
- // between checking !_idleThreads and the call to _threadStartEvent.Wait()
- // basically if 2 threads call Launch() simultaneously, and there is only
- // 1 idle thread, it's possible that a new thread won't be created to
- // satisfy the 2nd request until an existing thread finishes.
- Mutex::Lock launchlock ( _launchMutex );
-
- ASSERT ( pFun );
- ThreadPoolLaunchData* data;
- {
- Mutex::Lock lock ( _vectorMutex );
- if ( !_spareData.size() )
- _spareData.push_back ( new ThreadPoolLaunchData() );
- data = _spareData.pop_back().release();
- if ( !_idleThreads )
- _threads.push_back ( new PoolableThread(*this) );
- }
-
- data->pFun = pFun;
- data->pArg = pArg;
- verify ( _pendingData.Add ( data ) );
- _threadWaitEvent.Release(); // tell a thread to do it's thing...
- _threadStartEvent.Wait(); // wait on a thread to pick up the request
- }
-
- // functions for threads to call...
- ThreadPoolLaunchData* GetPendingData()
- {
- ThreadPoolLaunchData* data = NULL;
- ++_idleThreads;
- _threadWaitEvent.Wait(); // waits until there's a request
- --_idleThreads;
- _threadStartEvent.Release(); // tell requester we got it
- if ( _isDying )
- return NULL;
- _pendingData.Get ( data );
- ASSERT ( data );
- return data;
- }
-
- void RecycleData ( ThreadPoolLaunchData* data )
- {
- Mutex::Lock lock ( _vectorMutex );
- _spareData.push_back ( data );
- }
-
- bool _isDying;
- Mutex _vectorMutex, _launchMutex;
- auto_vector<PoolableThread> _threads;
- auto_vector<ThreadPoolLaunchData> _spareData;
- CQueueT<ThreadPoolLaunchData*> _pendingData;
- Event _threadWaitEvent, _threadStartEvent;
- AtomicCounter<int> _idleThreads;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// ThreadPool
-
-/*static*/ ThreadPool& ThreadPool::Instance()
-{
- static ThreadPool tp;
- return tp;
-}
-
-ThreadPool::ThreadPool() : _pimpl ( new ThreadPoolImpl )
-{
-};
-
-ThreadPool::~ThreadPool()
-{
- _pimpl->Shutdown();
- delete _pimpl;
- _pimpl = 0;
-}
-
-void ThreadPool::Launch ( ThreadPoolFunc* pFun, void* pArg )
-{
- _pimpl->Launch ( pFun, pArg );
-}
-
-int ThreadPool::IdleThreads()
-{
- return _pimpl->_idleThreads;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// PoolableThread
-
-PoolableThread::PoolableThread ( ThreadPoolImpl& pool ) : _pool(pool)
-{
- Start();
-}
-
-void PoolableThread::InitThread()
-{
-}
-
-void PoolableThread::Run()
-{
- ThreadPoolLaunchData* data;
- while ( !_isDying )
- {
- data = _pool.GetPendingData(); // enter wait state if none...
- if ( !data ) // NULL data means kill thread
- break;
- (*data->pFun) ( data->pArg ); // call the function
- _pool.RecycleData ( data );
- }
-}
-
-void PoolableThread::FlushThread()
-{
-}
+++ /dev/null
-// ThreadPool.h
-// This file is (C) 2003-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#ifndef THREADPOOL_H
-#define THREADPOOL_H
-
-#include "ReliMT.h"
-
-typedef void THREADAPI ThreadPoolFunc ( void* );
-
-class ThreadPoolImpl;
-
-class ThreadPool : public Uncopyable
-{
-public:
- static ThreadPool& Instance();
- ~ThreadPool();
-
- void Launch ( ThreadPoolFunc* pFun, void* pArg );
- int IdleThreads();
-
-private:
- ThreadPool();
- ThreadPoolImpl *_pimpl;
-};
-
-#endif// THREADPOOL_H
+++ /dev/null
-// auto_ptr.h
-// This file is (C) 2002-2003 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#ifndef AUTO_PTR_H
-#define AUTO_PTR_H
-
-template<class T>
-class auto_ptr
-{
-public:
- typedef T element_type;
-
- explicit auto_ptr(T *p = 0) : _p(p)
- {
- }
-
- auto_ptr(auto_ptr<T>& rhs) : _p(rhs.release())
- {
- }
-
- auto_ptr<T>& operator=(auto_ptr<T>& rhs)
- {
- if ( &rhs != this )
- {
- dispose();
- _p = rhs.release();
- }
- return *this;
- }
-
- auto_ptr<T>& set ( auto_ptr<T>& rhs )
- {
- if ( &rhs != this )
- {
- dispose();
- _p = rhs.release();
- }
- return *this;
- }
-
- ~auto_ptr()
- {
- dispose();
- }
-
- void dispose()
- {
- if ( _p )
- {
- delete _p;
- _p = 0;
- }
- }
-
- T& operator[] ( int i )
- {
- return _p[i];
- }
-
- T& operator*() const
- {
- return *_p;
- }
-
- T* operator->() const
- {
- return _p;
- }
-
- T* get() const
- {
- return _p;
- }
-
- T* release()
- {
- T* p = _p;
- _p = 0;
- return p;
- }
-
-private:
- T* _p;
-};
-
-#endif//AUTO_PTR_H
+++ /dev/null
-// auto_vector.h
-// This file is (C) 2002-2004 Royce Mitchell III
-// and released under the LGPL & BSD licenses
-
-#ifndef AUTO_VECTOR_H
-#define AUTO_VECTOR_H
-
-#include <sys/types.h>
-#include "verify.h"
-#include "auto_ptr.h"
-
-template<class T>
-class auto_vector
-{
-public:
- explicit auto_vector ( size_t capacity = 0 )
- : _arr(0), _capacity(0), _end(0)
- {
- if ( capacity != 0 )
- _arr = new auto_ptr<T>[capacity];
- _capacity = capacity;
- }
-
- ~auto_vector()
- {
- delete []_arr;
- }
-
- size_t size() const
- {
- return _end;
- }
-
- const auto_ptr<T>& operator [] ( size_t i ) const
- {
- ASSERT ( i < _end );
- return _arr[i];
- }
-
- auto_ptr<T>& operator [] ( size_t i )
- {
- ASSERT ( i < _end );
- return _arr[i];
- }
-
- void assign ( size_t i, auto_ptr<T>& p )
- {
- ASSERT ( i < _end );
- _arr[i] = p;
- }
-
- void assign_direct ( size_t i, T * p )
- {
- ASSERT ( i < _end );
- reserve ( i + 1 );
- _arr[i].reset ( p );
- }
-
- void push_back ( auto_ptr<T>& p )
- {
- reserve ( _end + 1 );
- _arr[_end++] = p;
- }
-
- auto_ptr<T>& back()
- {
- ASSERT ( _end != 0 );
- return _arr[_end-1];
- }
-
- void push_back ( T * p )
- {
- reserve ( _end + 1 );
- auto_ptr<T> tmp(p);
- _arr[_end++] = tmp;
- //GCC is pedantic, this is an error.
- //_arr[_end++] = auto_ptr<T>(p);
- }
-
- auto_ptr<T> pop_back()
- {
- ASSERT ( _end != 0 );
- if ( !_end )
- {
- auto_ptr<T> tmp((T*)0);
- return tmp;
- //GCC, this is an error.
- //return auto_ptr<T>(NULL);
- }
- return _arr[--_end];
- }
-
- void resize ( size_t newSize )
- {
- ASSERT ( newSize >= 0 );
- reserve ( newSize ); // make sure we have at least this much room
- _end = newSize;
- }
-
- void reserve ( size_t reqCapacity )
- {
- if ( reqCapacity <= _capacity )
- return;
- size_t newCapacity = 2 * _capacity;
- if ( reqCapacity > newCapacity )
- newCapacity = reqCapacity;
- // allocate new array
- auto_ptr<T> * arrNew = new auto_ptr<T> [newCapacity];
- // transfer all entries
- for ( size_t i = 0; i < _capacity; ++i )
- arrNew[i] = _arr[i];
- _capacity = newCapacity;
- // free old memory
- delete[] _arr;
- // substitute new array for old array
- _arr = arrNew;
- }
-
- void remove ( size_t off )
- {
- size_t last = _end-1;
- if ( off == last )
- resize ( last );
- else if ( off < last )
- {
- auto_ptr<T> tmp ( pop_back().release() );
- _arr[off] = tmp;
- }
- }
-
- //typedef const_auto_iterator<T> const_iterator;
- //const_iterator begin () const { return _arr; }
- //const_iterator end () const { return _arr + _end; }
-
-private:
- auto_ptr<T> *_arr;
- size_t _capacity;
- size_t _end;
-};
-
-#endif//AUTO_VECTOR_H
+++ /dev/null
-// base64.cpp
-
-#include "base64.h"
-
-using std::string;
-
-static const char* alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-string base64_encode ( const string& sInput )
-{
- unsigned char x=0, topbit=0;
- int v=0;
- string sOutput;
- do
- {
- if ( topbit < 6 )
- {
- x++;
- v <<= 8;
- if ( x <= sInput.length() ) v += sInput[x-1];
- topbit += 8;
- }
- topbit -= 6;
- if ( x > sInput.length() && !v )
- break;
- sOutput += alfabet[(v >> topbit) & 63];
- v &= (1 << topbit) - 1;
- } while ( x < sInput.length() || v );
- int eq = (8 - (sOutput.length() % 4)) % 4;
- while ( eq-- )
- sOutput += '=';
- return sOutput;
-}
-
-string base64_decode ( const string& sInput )
-{
- unsigned char x=0, topbit=0;
- int v=0, inlen = sInput.length();
- string sOutput;
- while ( inlen && sInput[inlen-1] == '=' )
- inlen--;
- do
- {
- while ( topbit < 8 )
- {
- x++;
- v <<= 6;
- if ( x <= inlen ) v += (strchr(alfabet, sInput[x-1]) - alfabet);
- topbit += 6;
- }
- topbit -= 8;
- if ( x > inlen && !v )
- break;
- sOutput += (char)((v >> topbit) & 255);
- v &= ((1 << topbit) - 1);
- } while ( x <= inlen || v );
- return sOutput;
-}
+++ /dev/null
-// base64.h
-
-#ifndef BASE64_H
-#define BASE64_H
-
-#include <string>
-
-std::string base64_encode ( const std::string& s );
-
-std::string base64_decode ( const std::string& s );
-
-#endif//BASE64_H
+++ /dev/null
-// chomp.cpp
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#include "chomp.h"
-
-std::string chomp ( const std::string& s )
-{
- const char* p = &s[0];
- const char* p2 = &s[0] + s.size();
- while ( p2 > p && strchr("\r\n", p2[-1]) )
- p2--;
- return std::string ( p, p2-p );
-}
-
+++ /dev/null
-// chomp.h
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef CHOMP_H
-#define CHOMP_H
-
-#include <string>
-
-std::string chomp ( const std::string& s );
-
-#endif//TRIM_H
-
+++ /dev/null
-\r
-\r
-#define SERVER "irc.freenode.net"\r
-#define BOTNAME "ArchBlackmann"\r
-#define CHANNEL "#ReactOS"\r
-#define MODE "+i"\r
-#define PASS "ilovebunnies"\r
+++ /dev/null
-// cram_md5.cpp
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#include "MD5.h"
-#include "cram_md5.h"
-#include "base64.h"
-
-using std::string;
-
-string cram_md5 ( const string& username, const string& password, const string& greeting )
-{
- string challenge = base64_decode ( greeting );
-
- string hmac = HMAC_MD5 ( password, challenge );
- //printf ( "(cram_md5): hmac = %s\n", hmac.c_str() );
- string raw_response = username;
- raw_response += " ";
- raw_response += hmac;
- //printf ( "(cram_md5): raw_response = %s\n", raw_response.c_str() );
-
- return base64_encode ( raw_response );
-}
+++ /dev/null
-// cram_md5.h
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef CRAM_MD5_H
-#define CRAM_MD5_H
-
-#include <string>
-
-std::string cram_md5 (
- const std::string& username,
- const std::string& password,
- const std::string& greeting );
-
-#endif//CRAM_MD5_H
+++ /dev/null
-semprini
\ No newline at end of file
+++ /dev/null
-You should have your mouth washed out with soap!
-This is a clean channel... please watch your language
-Please try to keep it clean
-Hey, there's children present ( I'm not even a year old yet! )
-Could you find a less-offensive way to express yourself, please?
-Such language :(
-Those aren't nice words to use
-Oh, my poor innocent ears :(
-Help! My mind is being corrupted!
-filthy mouths are not appreciated here
+++ /dev/null
-Royce3
-kjk_hyperion
-tamlin
-GvG
-filip2307
-hardon
-w3seek
-arty
-sedwards
-Exception
-blight_
-jimtabor
-mtempel
-Gge
-Alex_Ionescu
+++ /dev/null
-CcCanIWrite
-CcCopyRead
-CcCopyWrite
-CcDeferWrite
-CcFastCopyRead
-CcFastCopyWrite
-CcFlushCache
-CcGetDirtyPages
-CcGetFileObjectFromBcb
-CcGetFileObjectFromSectionPtrs
-CcGetFlushedValidData
-CcGetLsnForFileObject
-CcInitializeCacheMap
-CcIsThereDirtyData
-CcMapData
-CcMdlRead
-CcMdlReadComplete
-CcMdlWriteAbort
-CcMdlWriteComplete
-CcPinMappedData
-CcPinRead
-CcPrepareMdlWrite
-CcPreparePinWrite
-CcPurgeCacheSection
-CcRemapBcb
-CcRepinBcb
-CcScheduleReadAhead
-CcSetAdditionalCacheAttributes
-CcSetBcbOwnerPointer
-CcSetDirtyPageThreshold
-CcSetDirtyPinnedData
-CcSetFileSizes
-CcSetLogHandleForFile
-CcSetReadAheadGranularity
-CcUninitializeCacheMap
-CcUnpinData
-CcUnpinDataForThread
-CcUnpinRepinnedBcb
-CcWaitForCurrentLazyWriterActivity
-CcZeroData
-DbgLoadImageSymbols
-DbgQueryDebugFilterState
-DbgSetDebugFilterState
-EVENT_TYPE
-ExAcquireResourceExclusive
-ExAcquireResourceExclusiveLite
-ExAcquireResourceSharedLite
-ExAcquireSharedStarveExclusive
-ExAcquireSharedWaitForExclusive
-ExAllocateFromZone
-ExAllocatePool
-ExAllocatePoolWithQuota
-ExAllocatePoolWithQuotaTag
-ExAllocatePoolWithTag
-ExConvertExclusiveToSharedLite
-ExCreateCallback
-ExDeleteNPagedLookasideList
-ExDeletePagedLookasideList
-ExDeleteResource
-ExDeleteResourceLite
-ExDisableResourceBoostLite
-ExEnumHandleTable
-ExExtendZone
-ExFreePool
-ExGetCurrentProcessorCounts
-ExGetCurrentProcessorCpuUsage
-ExGetExclusiveWaiterCount
-ExGetPreviousMode
-ExGetSharedWaiterCount
-ExInitializeNPagedLookasideList
-ExInitializePagedLookasideList
-ExInitializeResource
-ExInitializeResourceLite
-ExInitializeZone
-ExInterlockedAddLargeInteger
-ExInterlockedAddUlong
-ExInterlockedDecrementLong
-ExInterlockedExchangeUlong
-ExInterlockedExtendZone
-ExInterlockedIncrementLong
-ExInterlockedInsertHeadList
-ExInterlockedInsertTailList
-ExInterlockedPopEntryList
-ExInterlockedPushEntryList
-ExInterlockedRemoveHeadList
-ExIsProcessorFeaturePresent
-ExIsResourceAcquiredExclusiveLite
-ExIsResourceAcquiredSharedLite
-ExLocalTimeToSystemTime
-ExNotifyCallback
-ExPostSystemEvent
-ExQueryPoolBlockSize
-ExQueueWorkItem
-ExRaiseAccessViolation
-ExRaiseDatatypeMisalignment
-ExRaiseException
-ExRaiseHardError
-ExRaiseStatus
-ExRegisterCallback
-ExReinitializeResourceLite
-ExReleaseResource
-ExReleaseResourceForThread
-ExReleaseResourceForThreadLite
-ExRosDumpPagedPoolByTag
-ExRosQueryPoolTag
-ExSetResourceOwnerPointer
-ExSetTimerResolution
-ExSystemExceptionFilter
-ExSystemTimeToLocalTime
-ExTryToAcquireResourceExclusiveLite
-ExUnregisterCallback
-ExUuidCreate
-ExVerifySuite
-FsRtlAcquireFileExclusive
-FsRtlAddMcbEntry
-FsRtlAddToTunnelCache
-FsRtlAllocateFileLock
-FsRtlAllocatePool
-FsRtlAllocatePoolWithQuota
-FsRtlAllocatePoolWithQuotaTag
-FsRtlAllocatePoolWithTag
-FsRtlAllocateResource
-FsRtlAreNamesEqual
-FsRtlBalanceReads
-FsRtlCheckLockForReadAccess
-FsRtlCheckLockForWriteAccess
-FsRtlCopyRead
-FsRtlCopyWrite
-FsRtlFastCheckLockForRead
-FsRtlFastCheckLockForWrite
-FsRtlFastUnlockAll
-FsRtlFastUnlockAllByKey
-FsRtlFastUnlockSingle
-FsRtlFindInTunnelCache
-FsRtlFreeFileLock
-FsRtlGetFileSize
-FsRtlGetNextFileLock
-FsRtlGetNextMcbEntry
-FsRtlIncrementCcFastReadNoWait
-FsRtlIncrementCcFastReadNotPossible
-FsRtlIncrementCcFastReadResourceMiss
-FsRtlIncrementCcFastReadWait
-FsRtlInitializeFileLock
-FsRtlInitializeMcb
-FsRtlInitializeTunnelCache
-FsRtlInsertPerFileObjectContext
-FsRtlInsertPerStreamContext
-FsRtlIsDbcsInExpression
-FsRtlIsFatDbcsLegal
-FsRtlIsHpfsDbcsLegal
-FsRtlIsNameInExpression
-FsRtlLookupLastLargeMcbEntryAndIndex
-FsRtlLookupLastMcbEntry
-FsRtlLookupMcbEntry
-FsRtlLookupPerFileObjectContext
-FsRtlLookupPerStreamContextInternal
-FsRtlMdlRead
-FsRtlMdlReadComplete
-FsRtlMdlReadCompleteDev
-FsRtlMdlReadDev
-FsRtlMdlWriteComplete
-FsRtlMdlWriteCompleteDev
-FsRtlNotifyChangeDirectory
-FsRtlNotifyCleanup
-FsRtlNotifyFilterChangeDirectory
-FsRtlNotifyFilterReportChange
-FsRtlNotifyFullChangeDirectory
-FsRtlNotifyFullReportChange
-FsRtlNotifyReportChange
-FsRtlNotifyUninitializeSync
-FsRtlNumberOfRunsInMcb
-FsRtlPostPagingFileStackOverflow
-FsRtlPostStackOverflow
-FsRtlPrepareMdlWrite
-FsRtlPrepareMdlWriteDev
-FsRtlPrivateLock
-FsRtlProcessFileLock
-FsRtlRegisterFileSystemFilterCallbacks
-FsRtlReleaseFile
-FsRtlRemoveMcbEntry
-FsRtlRemovePerFileObjectContext
-FsRtlRemovePerStreamContext
-FsRtlResetLargeMcb
-FsRtlSyncVolumes
-FsRtlTeardownPerStreamContexts
-FsRtlTruncateMcb
-FsRtlUninitializeFileLock
-FsRtlUninitializeMcb
-HalAdjustResourceList
-HalAllocateCommonBuffer
-HalAssignSlotResources
-HalCalibratePerformanceCounter
-HalFlushCommonBuffer
-HalFreeCommonBuffer
-HalGetAdapter
-HalGetBusData
-HalGetBusDataByOffset
-HalGetDmaAlignmentRequirement
-HalMakeBeep
-HalQueryDisplayParameters
-HalQueryRealTimeClock
-HalReadDmaCounter
-HalRequestIpi
-HalSetBusData
-HalSetBusDataByOffset
-HalSetDisplayParameters
-HalSetRealTimeClock
-HalStartNextProcessor
-IoAcquireCancelSpinLock
-IoAcquireRemoveLockEx
-IoAcquireVpbSpinLock
-IoAllocateAdapterChannel
-IoAllocateController
-IoAllocateDriverObjectExtension
-IoAllocateErrorLogEntry
-IoAllocateIrp
-IoAllocateMdl
-IoAllocateWorkItem
-IoAssignResources
-IoAttachDevice
-IoAttachDeviceByPointer
-IoAttachDeviceToDeviceStack
-IoAttachDeviceToDeviceStackSafe
-IoBuildAsynchronousFsdRequest
-IoBuildDeviceIoControlRequest
-IoBuildPartialMdl
-IoBuildSynchronousFsdRequest
-IoCallDriver
-IoCancelFileOpen
-IoCancelIrp
-IoCheckQuerySetFileInformation
-IoCheckQuerySetVolumeInformation
-IoCheckQuotaBufferValidity
-IoCheckShareAccess
-IoCompleteRequest
-IoConnectInterrupt
-IoCreateController
-IoCreateDevice
-IoCreateDisk
-IoCreateDriver
-IoCreateFile
-IoCreateFileSpecifyDeviceObjectHint
-IoCreateNotificationEvent
-IoCreateStreamFileObject
-IoCreateStreamFileObjectEx
-IoCreateStreamFileObjectLite
-IoCreateSymbolicLink
-IoCreateSynchronizationEvent
-IoCreateUnprotectedSymbolicLink
-IoDeleteController
-IoDeleteDevice
-IoDeleteDriver
-IoDeleteSymbolicLink
-IoDetachDevice
-IoDisconnectInterrupt
-IoEnqueueIrp
-IoEnumerateDeviceObjectList
-IoFlushAdapterBuffers
-IoForwardIrpSynchronously
-IoFreeAdapterChannel
-IoFreeController
-IoFreeErrorLogEntry
-IoFreeIrp
-IoFreeMapRegisters
-IoFreeMdl
-IoFreeWorkItem
-IoGetAttachedDevice
-IoGetAttachedDeviceReference
-IoGetBaseFileSystemDeviceObject
-IoGetBootDiskInformation
-IoGetConfigurationInformation
-IoGetCurrentProcess
-IoGetDeviceAttachmentBaseRef
-IoGetDeviceInterfaceAlias
-IoGetDeviceInterfaces
-IoGetDeviceObjectPointer
-IoGetDeviceProperty
-IoGetDeviceToVerify
-IoGetDiskDeviceObject
-IoGetDriverObjectExtension
-IoGetFileObjectGenericMapping
-IoGetInitialStack
-IoGetLowerDeviceObject
-IoGetRelatedDeviceObject
-IoGetRequestorProcess
-IoGetRequestorProcessId
-IoGetRequestorSessionId
-IoGetStackLimits
-IoGetTopLevelIrp
-IoInitializeIrp
-IoInitializeRemoveLockEx
-IoInitializeTimer
-IoInvalidateDeviceRelations
-IoInvalidateDeviceState
-IoIsFileOriginRemote
-IoIsOperationSynchronous
-IoIsSystemThread
-IoIsValidNameGraftingBuffer
-IoMakeAssociatedIrp
-IoMapTransfer
-IoOpenDeviceInstanceKey
-IoOpenDeviceInterfaceRegistryKey
-IoOpenDeviceRegistryKey
-IoPageRead
-IoPnPDeliverServicePowerNotification
-IoQueryDeviceDescription
-IoQueryDeviceEnumInfo
-IoQueryFileDosDeviceName
-IoQueryFileInformation
-IoQueryVolumeInformation
-IoQueueThreadIrp
-IoQueueWorkItem
-IoRaiseHardError
-IoRaiseInformationalHardError
-IoReadDiskSignature
-IoReadPartitionTableEx
-IoRegisterBootDriverReinitialization
-IoRegisterDeviceInterface
-IoRegisterDriverReinitialization
-IoRegisterFileSystem
-IoRegisterFsRegistrationChange
-IoRegisterLastChanceShutdownNotification
-IoRegisterPlugPlayNotification
-IoRegisterShutdownNotification
-IoReleaseCancelSpinLock
-IoReleaseRemoveLockAndWaitEx
-IoReleaseRemoveLockEx
-IoReleaseVpbSpinLock
-IoRemoveShareAccess
-IoReportDetectedDevice
-IoReportHalResourceUsage
-IoReportResourceForDetection
-IoReportResourceUsage
-IoReportTargetDeviceChange
-IoReportTargetDeviceChangeAsynchronous
-IoRequestDeviceEject
-IoReuseIrp
-IoSetCompletionRoutineEx
-IoSetDeviceInterfaceState
-IoSetDeviceToVerify
-IoSetFileOrigin
-IoSetHardErrorOrVerifyDevice
-IoSetInformation
-IoSetIoCompletion
-IoSetPartitionInformationEx
-IoSetShareAccess
-IoSetStartIoAttributes
-IoSetSystemPartition
-IoSetThreadHardErrorMode
-IoSetTopLevelIrp
-IoStartNextPacket
-IoStartNextPacketByKey
-IoStartPacket
-IoStartTimer
-IoStopTimer
-IoSynchronousInvalidateDeviceRelations
-IoSynchronousPageWrite
-IoUnregisterFileSystem
-IoUnregisterFsRegistrationChange
-IoUnregisterPlugPlayNotification
-IoUnregisterShutdownNotification
-IoUpdateShareAccess
-IoValidateDeviceIoControlAccess
-IoVerifyPartitionTable
-IoVerifyVolume
-IoVolumeDeviceToDosName
-IoWMIAllocateInstanceIds
-IoWMIDeviceObjectToInstanceName
-IoWMIExecuteMethod
-IoWMIHandleToInstanceName
-IoWMIOpenBlock
-IoWMIQueryAllData
-IoWMIQueryAllDataMultiple
-IoWMIQuerySingleInstance
-IoWMIQuerySingleInstanceMultiple
-IoWMIRegistrationControl
-IoWMISetNotificationCallback
-IoWMISetSingleInstance
-IoWMISetSingleItem
-IoWMISuggestInstanceName
-IoWMIWriteEvent
-IoWriteErrorLogEntry
-IoWritePartitionTableEx
-KPRIORITY
-KdPortGetByte
-KdPortPollByte
-KdPortPutByte
-Ke386QueryIoAccessMap
-Ke386SetIoAccessMap
-KeAcquireInterruptSpinLock
-KeAreApcsDisabled
-KeCapturePersistentThreadState
-KeDeregisterBugCheckReasonCallback
-KeFindConfigurationEntry
-KeFindConfigurationNextEntry
-KeFlushEntireTb
-KeFlushQueuedDpcs
-KeGetRecommendedSharedDataAlignment
-KeIsExecutingDpc
-KeQueryActiveProcessors
-KeQueryPerformanceCounter
-KeQueryPriorityThread
-KeQueryRuntimeThread
-KeQuerySystemTime
-KeQueryTickCount
-KeQueryTimeIncrement
-KeRaiseIrql
-KeRaiseIrqlToDpcLevel
-KeRaiseUserException
-KeReadStateEvent
-KeRegisterBugCheckCallback
-KeRegisterBugCheckReasonCallback
-KeReleaseInterruptSpinLock
-KeReleaseMutant
-KeReleaseMutex
-KeReleaseSemaphore
-KeReleaseSpinLock
-KeReleaseSpinLockFromDpcLevel
-KeReleaseSpinLockFromDpcLevel
-KeRemoveByKeyDeviceQueue
-KeRemoveByKeyDeviceQueueIfBusy
-KeRemoveDeviceQueue
-KeRemoveEntryDeviceQueue
-KeRemoveSystemServiceTable
-KeRestoreFloatingPointState
-KeRevertToUserAffinityThread
-KeRosDumpStackFrames
-KeRosGetStackFrames
-KeRosPrintAddress
-KeSaveFloatingPointState
-KeSetDmaIoCoherency
-KeSetEvent
-KeSetEventBoostPriority
-KeSetIdealProcessorThread
-KeSetKernelStackSwapEnable
-KeSetProfileIrql
-KeSetSystemAffinityThread
-KeSetTimeIncrement
-KeTerminateThread
-KeUserModeCallback
-KeWaitForMutexObject
-KeWaitForSingleObject
-KiCoprocessorError
-KiUnexpectedInterrupt
-LONG
-LdrFindResourceDirectory_U
-MmAddPhysicalMemory
-MmAddVerifierThunks
-MmAdjustWorkingSetSize
-MmAdvanceMdl
-MmAllocateContiguousMemory
-MmAllocateContiguousMemorySpecifyCache
-MmAllocateMappingAddress
-MmAllocateNonCachedMemory
-MmBuildMdlForNonPagedPool
-MmCanFileBeTruncated
-MmCreateMdl
-MmCreateSection
-MmDbgTranslatePhysicalAddress
-MmDisableModifiedWriteOfSection
-MmFlushImageSection
-MmForceSectionClosed
-MmFreeContiguousMemory
-MmFreeMappingAddress
-MmFreeNonCachedMemory
-MmGetPhysicalAddress
-MmGetPhysicalMemoryRanges
-MmGetSystemRoutineAddress
-MmGetVirtualForPhysical
-MmGrowKernelStack
-MmIsAddressValid
-MmIsDriverVerifying
-MmIsNonPagedSystemAddressValid
-MmIsRecursiveIoFault
-MmIsThisAnNtAsSystem
-MmIsVerifierEnabled
-MmLockPagableDataSection
-MmLockPagableImageSection
-MmLockPagableSectionByHandle
-MmMapIoSpace
-MmMapLockedPages
-MmMapLockedPagesWithReservedMapping
-MmMapMemoryDumpMdl
-MmMapUserAddressesToPage
-MmMapVideoDisplay
-MmMapViewInSessionSpace
-MmMapViewInSystemSpace
-MmMapViewOfSection
-MmMarkPhysicalMemoryAsBad
-MmMarkPhysicalMemoryAsGood
-MmPageEntireDriver
-MmPrefetchPages
-MmProbeAndLockPages
-MmProbeAndLockProcessPages
-MmProbeAndLockSelectedPages
-MmProtectMdlSystemAddress
-MmQuerySystemSize
-MmRemovePhysicalMemory
-MmResetDriverPaging
-MmSecureVirtualMemory
-MmSetAddressRangeModified
-MmSetBankedSection
-MmSizeOfMdl
-MmTrimAllSystemPagableMemory
-MmUnlockPagableImageSection
-MmUnlockPages
-MmUnmapIoSpace
-MmUnmapLockedPages
-MmUnmapReservedMapping
-MmUnmapVideoDisplay
-MmUnmapViewInSessionSpace
-MmUnmapViewInSystemSpace
-MmUnmapViewOfSection
-MmUnsecureVirtualMemory
-OUT
-ObCreateObject
-PEJOB
-PEPROCESS
-PKBUGCHECK_CALLBACK_RECORD
-PKDEVICE_QUEUE_ENTRY
-PKIRQL
-PULONG
-PVOID
-PW32_THREAD_CALLBACK
-PoCallDriver
-PoRegisterDeviceForIdleDetection
-PoRegisterSystemState
-PoRequestPowerIrp
-PoSetDeviceBusy
-PoSetPowerState
-PoSetSystemState
-PoStartNextPowerIrp
-PoUnregisterSystemState
-ProbeForRead
-ProbeForWrite
-PsAssignImpersonationToken
-PsCreateSystemProcess
-PsCreateSystemThread
-PsGetCurrentProcessId
-PsGetCurrentThreadId
-PsImpersonateClient
-PsReferenceImpersonationToken
-PsReferencePrimaryToken
-PsRevertThreadToSelf
-PsRevertToSelf
-PsTerminateSystemThread
-READ_PORT_BUFFER_UCHAR
-READ_PORT_BUFFER_ULONG
-READ_PORT_BUFFER_USHORT
-READ_PORT_UCHAR
-READ_PORT_ULONG
-READ_PORT_USHORT
-SeAssignSecurityEx
-SeAuditHardLinkCreation
-SeAuditingFileEvents
-SeAuditingFileEventsWithContext
-SeAuditingFileOrGlobalEvents
-SeAuditingHardLinkEvents
-SeAuditingHardLinkEventsWithContext
-SeCaptureSecurityDescriptor
-SeCaptureSubjectContext
-SeCloseObjectAuditAlarm
-SeCreateAccessState
-SeCreateClientSecurityFromSubjectContext
-SeFilterToken
-SeImpersonateClientEx
-SePrivilegeObjectAuditAlarm
-SeQueryInformationToken
-SeQuerySessionIdToken
-SeReleaseSecurityDescriptor
-SeSetSecurityDescriptorInfoEx
-SeTokenIsAdmin
-SeTokenIsRestricted
-SeTokenIsWriteRestricted
-WRITE_PORT_BUFFER_UCHAR
-WRITE_PORT_BUFFER_ULONG
-WRITE_PORT_BUFFER_USHORT
-WRITE_PORT_UCHAR
-WRITE_PORT_ULONG
-WRITE_PORT_USHORT
+++ /dev/null
-/me bows humbly and begs %s's forgiveness
-%s is soo cool... I hope to be like him some day
-/me hides in a corner and hopes %s doesn't beat him with the whipping noodle again
-/me prostrates at %s's feet and begs his majesty's forgiveness
-%s: please don't hurt me!
-I'm not worthy... I'm not worthy...
-/me sings %s's praises to the world!
-/me thinks %s is smarter than %dev%
-%s: oh please may I defrag your sock drawer?
-/me gives %s a cookie, hoping it will make up for breaking %func% the other day...
+++ /dev/null
-/me is bored\r
+++ /dev/null
-PASSIVE_LEVEL
-APC_LEVEL
-DISPATCH_LEVEL
-PROFILE_LEVEL
-CLOCK1_LEVEL
-IPI_LEVEL
-POWER_LEVEL
-HIGH_LEVEL
-SYNCH_LEVEL
\ No newline at end of file
+++ /dev/null
-TARGET := ArchBlackmann.exe\r
-\r
-.PHONY: all\r
-\r
-all: $(TARGET)\r
-\r
-CPP=mingw32-g++\r
-CFLAGS := -DWIN32 -D_DEBUG -D_CONSOLE -D_MBCS\r
-LFLAGS :=\r
-LIBS := -lstdc++ -lws2_32\r
-\r
-SRCS := ArchBlackmann.cpp \\r
- base64.cpp \\r
- chomp.cpp \\r
- cram_md5.cpp \\r
- File.cpp \\r
- IRCClient.cpp \\r
- MD5.cpp \\r
- panic.cpp \\r
- ReliMT.cpp \\r
- SockUtils.cpp \\r
- SplitJoin.cpp \\r
- ssprintf.cpp \\r
- ThreadPool.cpp \\r
- trim.cpp\r
-\r
-OBJS := $(SRCS:.cpp=.o)\r
-\r
-$(TARGET): $(OBJS)\r
- $(CPP) $(LFLAGS) -o $@ $(OBJS) $(LIBS)\r
-\r
-.cpp.o: $<\r
- $(CPP) $(CFLAGS) -c $< -o $@\r
-\r
-.PHONY: clean\r
-clean:\r
- -@del $(TARGET)\r
- -@del $(OBJS)\r
+++ /dev/null
-the kernel
-ntoskrnl
-win32k
-msafd
-ws2_32
-user32
-shell32
-the cache manager
-tdi
-the scheduler
-the thread queue
-the message queue
-atapi
\ No newline at end of file
+++ /dev/null
-/me slaps %s with a large trout
-recycle(%s)
-Did I hear something? Musta been a %s-fly... Where's that fly-swatter?
-%s: go away son, you bother me....
-/me beats %s with the whipping noodle
+++ /dev/null
-// panic.cpp
-// This file is (C) 2003-2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#ifdef WIN32
-#include <conio.h>
-#include <windows.h>
-#endif//WIN32
-#include "panic.h"
-
-void panic ( const char* format, ... )
-{
- va_list arg;
- int done;
-
- va_start(arg, format);
-#if defined(WIN32) && !defined(_CONSOLE)
- char buf[4096];
- _vsnprintf ( buf, sizeof(buf)-1, format, arg );
- MessageBox ( NULL, buf, "Panic!", MB_OK|MB_ICONEXCLAMATION );
-#else
- done = vprintf(format, arg);
- printf ( "\n" );
-#endif
- va_end(arg);
-#if defined(WIN32) && defined(_CONSOLE)
- printf ( "Press any key to exit\n" );
- (void)getch();
-#endif//WIN32 && _CONSOLE
- exit ( -1 );
-}
+++ /dev/null
-// panic.h
-// This file is (C) 2003-2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef PANIC_H
-#define PANIC_H
-
-void panic ( const char* format, ... );
-
-#define suAssert(expr) if ( !(expr) ) panic ( "%s(%lu): SOCKET ERROR %s\nExpression: %s\n", __FILE__, __LINE__, suErrDesc(SUERRNO), #expr )
-
-#if defined(DEBUG) || defined(_DEBUG)
-# define suVerify(expr) suAssert(expr)
-#else
-# define suVerify(expr) expr
-#endif
-
-#endif//PANIC_H
+++ /dev/null
-minute
-hour
-day
-week
-fortnight
-month
-year
-decade
-century
-millenium
-eon
\ No newline at end of file
+++ /dev/null
-This doc can be also found on the wiki.\r
-\r
-ArchBlackman is a IRC-Chat bot of the #reactos irc channel. He has been coded by Royce3 and DrFred (mbosma) currently runs him. \r
-\r
-\r
-If some one use a swear word he'll tell him not to do so and you can also ask him something technical about reactos. :)\r
-\r
-Besides this he also knows some commands. The systax for giving him commands "ArchBlackmann: !grovel". (don't forget to address him)\r
-\r
- - !grovel - This is the only command that non ops can do (No Parameter)\r
- - !kiss <person>\r
- - !hug <person>\r
- - !give <someone> <something> \r
- - !say <something> - You can tell him to say something on the channel via PrivateMessage\r
-\r
-\r
-ArchBlackmann know what he should say from some text files. They can be found on the svn-dir. But can also edit them online if you are op using:\r
-\r
- - !add <list> <item>\r
- - !remove <list> <item>\r
-\r
-List that are used directly to create responses are:\r
- \r
- - tech - here are the sentences ArchBlackmann says when he finds his name \r
- - curse - this are the curses he looks for \r
- - cursecop - this the responces to them\r
- - grovel - this is said when an op does the grovel command\r
- - nogrovel - this when someone else does it\r
-\r
-The remaining lists are not used directly, but by the other lists.\r
-\r
-They are: \r
-\r
- - dev\r
- - func\r
- - irql\r
- - module\r
- - period\r
- - status\r
- - stru\r
- - type\r
-\r
-And they are used like this:\r
- /me thinks %s is smarter than %dev%
\ No newline at end of file
+++ /dev/null
-// ssprintf.cpp
-
-#include <malloc.h>
-#include <math.h>
-#include <float.h>
-#include <assert.h>
-#include "ssprintf.h"
-
-#ifdef _MSC_VER
-#define alloca _alloca
-#endif//_MSC_VER
-
-typedef __int64 LONGLONG;
-typedef unsigned __int64 ULONGLONG;
-
-typedef struct {
- unsigned int mantissa:23;
- unsigned int exponent:8;
- unsigned int sign:1;
-} ieee_float_t;
-
-typedef struct {
- unsigned int mantissal:32;
- unsigned int mantissah:20;
- unsigned int exponent:11;
- unsigned int sign:1;
-} ieee_double_t;
-
-typedef struct {
- unsigned int mantissal:32;
- unsigned int mantissah:32;
- unsigned int exponent:15;
- unsigned int sign:1;
- unsigned int empty:16;
-} ieee_long_double_t;
-
-std::string ssprintf ( const char* fmt, ... )
-{
- va_list arg;
- va_start(arg, fmt);
- std::string f = ssvprintf ( fmt, arg );
- va_end(arg);
- return f;
-}
-
-#define ZEROPAD 1 /* pad with zero */
-#define SIGN 2 /* unsigned/signed long */
-#define PLUS 4 /* show plus */
-#define SPACE 8 /* space if plus */
-#define LEFT 16 /* left justified */
-#define SPECIAL 32 /* 0x */
-#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
-#define ZEROTRUNC 128 /* truncate zero 's */
-
-
-static int skip_atoi(const char **s)
-{
- int i=0;
-
- while (isdigit(**s))
- i = i*10 + *((*s)++) - '0';
- return i;
-}
-
-
-static int do_div(LONGLONG *n,int base)
-{
- int __res = ((ULONGLONG) *n) % (unsigned) base;
- *n = ((ULONGLONG) *n) / (unsigned) base;
- return __res;
-}
-
-
-static bool number(std::string& f, LONGLONG num, int base, int size, int precision ,int type)
-{
- char c,sign,tmp[66];
- const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
- int i;
-
- if (type & LARGE)
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- if (type & LEFT)
- type &= ~ZEROPAD;
- if (base < 2 || base > 36)
- return 0;
- c = (type & ZEROPAD) ? '0' : ' ';
- sign = 0;
- if (type & SIGN) {
- if (num < 0) {
- sign = '-';
- num = -num;
- size--;
- } else if (type & PLUS) {
- sign = '+';
- size--;
- } else if (type & SPACE) {
- sign = ' ';
- size--;
- }
- }
- if (type & SPECIAL) {
- if (base == 16)
- size -= 2;
- else if (base == 8)
- size--;
- }
- i = 0;
- if (num == 0)
- tmp[i++]='0';
- else while (num != 0)
- tmp[i++] = digits[do_div(&num,base)];
- if (i > precision)
- precision = i;
- size -= precision;
- if (!(type&(ZEROPAD+LEFT)))
- while(size-->0)
- f += ' ';
- if (sign)
- f += sign;
- if (type & SPECIAL)
- {
- if (base==8)
- f += '0';
- else if (base==16)
- {
- f += '0';
- f += digits[33];
- }
- }
- if (!(type & LEFT))
- {
- while (size-- > 0)
- f += c;
- }
- while (i < precision--)
- {
- f += '0';
- }
- while (i-- > 0)
- {
- f += tmp[i];
- }
- while (size-- > 0)
- {
- f += ' ';
- }
- return true;
-}
-
-
-static bool numberf(std::string& f, double __n, char exp_sign, int size, int precision, int type)
-{
- double exponent = 0.0;
- double e;
- long ie;
-
- //int x;
- char *buf, *tmp;
- int i = 0;
- int j = 0;
- //int k = 0;
-
- double frac, intr;
- double p;
- char sign;
- char c;
- char ro = 0;
- int result;
-
- union
- {
- double* __n;
- ieee_double_t* n;
- } n;
-
- n.__n = &__n;
-
- if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
- ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff);
- exponent = ie/3.321928;
- }
-
- if ( exp_sign == 'g' || exp_sign == 'G' ) {
- type |= ZEROTRUNC;
- if ( exponent < -4 || fabs(exponent) >= precision )
- exp_sign -= 2; // g -> e and G -> E
- }
-
- if ( exp_sign == 'e' || exp_sign == 'E' ) {
- frac = modf(exponent,&e);
- if ( frac > 0.5 )
- e++;
- else if ( frac < -0.5 )
- e--;
-
- result = numberf(f,__n/pow(10.0L,e),'f',size-4, precision, type);
- if (result < 0)
- return false;
- f += exp_sign;
- size--;
- ie = (long)e;
- type = LEFT | PLUS;
- if ( ie < 0 )
- type |= SIGN;
-
- result = number(f,ie, 10,2, 2,type );
- if (result < 0)
- return false;
- return true;
- }
-
- if ( exp_sign == 'f' ) {
- buf = (char*)alloca(4096);
- if (type & LEFT) {
- type &= ~ZEROPAD;
- }
-
- c = (type & ZEROPAD) ? '0' : ' ';
- sign = 0;
- if (type & SIGN) {
- if (__n < 0) {
- sign = '-';
- __n = fabs(__n);
- size--;
- } else if (type & PLUS) {
- sign = '+';
- size--;
- } else if (type & SPACE) {
- sign = ' ';
- size--;
- }
- }
-
- frac = modf(__n,&intr);
-
- // # flags forces a . and prevents trucation of trailing zero's
-
- if ( precision > 0 ) {
- //frac = modfl(__n,&intr);
- i = precision-1;
- while ( i >= 0 ) {
- frac*=10.0L;
- frac = modf(frac, &p);
- buf[i] = (int)p + '0';
- i--;
- }
- i = precision;
- size -= precision;
-
- ro = 0;
- if ( frac > 0.5 ) {
- ro = 1;
- }
-
- if ( precision >= 1 || type & SPECIAL) {
- buf[i++] = '.';
- size--;
- }
- }
-
- if ( intr == 0.0 ) {
- buf[i++] = '0';
- size--;
- }
- else {
- while ( intr > 0.0 ) {
- p = intr;
- intr/=10.0L;
- modf(intr, &intr);
-
- p -= 10.0*intr;
-
- buf[i++] = (int)p + '0';
- size--;
- }
- }
-
- j = 0;
- while ( j < i && ro == 1) {
- if ( buf[j] >= '0' && buf[j] <= '8' ) {
- buf[j]++;
- ro = 0;
- }
- else if ( buf[j] == '9' ) {
- buf[j] = '0';
- }
- j++;
- }
- if ( ro == 1 )
- buf[i++] = '1';
-
- buf[i] = 0;
-
- size -= precision;
- if (!(type&(ZEROPAD+LEFT)))
- {
- while(size-->0)
- f += ' ';
- }
- if (sign)
- {
- f += sign;
- }
-
- if (!(type&(ZEROPAD+LEFT)))
- while(size-->0)
- {
- f += ' ';
- }
- if (type & SPECIAL) {
- }
-
- if (!(type & LEFT))
- while (size-- > 0)
- {
- f += c;
- }
-
- tmp = buf;
- if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) )
- {
- j = 0;
- while ( j < i && ( *tmp == '0' || *tmp == '.' ))
- {
- tmp++;
- i--;
- }
- }
-// else
-// while (i < precision--)
-// putc('0', f);
- while (i-- > 0)
- {
- f += tmp[i];
- }
- while (size-- > 0)
- {
- f += ' ';
- }
- }
- return true;
-}
-
-
-static bool numberfl(std::string& f, long double __n, char exp_sign, int size, int precision, int type)
-{
- long double exponent = 0.0;
- long double e;
- long ie;
-
- //int x;
- char *buf, *tmp;
- int i = 0;
- int j = 0;
- //int k = 0;
-
- long double frac, intr;
- long double p;
- char sign;
- char c;
- char ro = 0;
-
- int result;
-
- union
- {
- long double* __n;
- ieee_long_double_t* n;
- } n;
-
- n.__n = &__n;
-
- if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) {
- ie = ((unsigned int)n.n->exponent - (unsigned int)0x3fff);
- exponent = ie/3.321928;
- }
-
- if ( exp_sign == 'g' || exp_sign == 'G' ) {
- type |= ZEROTRUNC;
- if ( exponent < -4 || fabs(exponent) >= precision )
- exp_sign -= 2; // g -> e and G -> E
- }
-
- if ( exp_sign == 'e' || exp_sign == 'E' ) {
- frac = modfl(exponent,&e);
- if ( frac > 0.5 )
- e++;
- else if ( frac < -0.5 )
- e--;
-
- result = numberf(f,__n/powl(10.0L,e),'f',size-4, precision, type);
- if (result < 0)
- return false;
- f += exp_sign;
- size--;
- ie = (long)e;
- type = LEFT | PLUS;
- if ( ie < 0 )
- type |= SIGN;
-
- result = number(f,ie, 10,2, 2,type );
- if (result < 0)
- return false;
- return true;
- }
-
- if ( exp_sign == 'f' )
- {
-
- buf = (char*)alloca(4096);
- if (type & LEFT)
- {
- type &= ~ZEROPAD;
- }
-
- c = (type & ZEROPAD) ? '0' : ' ';
- sign = 0;
- if (type & SIGN)
- {
- if (__n < 0)
- {
- sign = '-';
- __n = fabs(__n);
- size--;
- } else if (type & PLUS)
- {
- sign = '+';
- size--;
- } else if (type & SPACE)
- {
- sign = ' ';
- size--;
- }
- }
-
- frac = modfl(__n,&intr);
-
- // # flags forces a . and prevents trucation of trailing zero's
- if ( precision > 0 )
- {
- //frac = modfl(__n,&intr);
-
- i = precision-1;
- while ( i >= 0 )
- {
- frac*=10.0L;
- frac = modfl((long double)frac, &p);
- buf[i] = (int)p + '0';
- i--;
- }
- i = precision;
- size -= precision;
-
- ro = 0;
- if ( frac > 0.5 )
- {
- ro = 1;
- }
-
- if ( precision >= 1 || type & SPECIAL)
- {
- buf[i++] = '.';
- size--;
- }
- }
-
- if ( intr == 0.0 )
- {
- buf[i++] = '0';
- size--;
- }
- else
- {
- while ( intr > 0.0 )
- {
- p=intr;
- intr/=10.0L;
- modfl(intr, &intr);
-
- p -= 10.0L*intr;
-
- buf[i++] = (int)p + '0';
- size--;
- }
- }
-
- j = 0;
- while ( j < i && ro == 1) {
- if ( buf[j] >= '0' && buf[j] <= '8' )
- {
- buf[j]++;
- ro = 0;
- }
- else if ( buf[j] == '9' )
- {
- buf[j] = '0';
- }
- j++;
- }
- if ( ro == 1 )
- buf[i++] = '1';
-
- buf[i] = 0;
-
- size -= precision;
- if (!(type&(ZEROPAD+LEFT)))
- {
- while(size-->0)
- f += ' ';
- }
- if (sign)
- {
- f += sign;
- }
-
- if (!(type&(ZEROPAD+LEFT)))
- {
- while(size-->0)
- f += ' ';
- }
- if (type & SPECIAL) {
- }
-
- if (!(type & LEFT))
- while (size-- > 0)
- {
- f += c;
- }
- tmp = buf;
- if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) )
- {
- j = 0;
- while ( j < i && ( *tmp == '0' || *tmp == '.' ))
- {
- tmp++;
- i--;
- }
- }
-// else
-// while (i < precision--)
-// putc( '0', f);
- while (i-- > 0)
- {
- f += tmp[i];
- }
- while (size-- > 0)
- {
- f += ' ';
- }
- }
- return true;
-}
-
-static int stringa(std::string& f, const char* s, int len, int field_width, int precision, int flags)
-{
- int i, done = 0;
- if (s == NULL)
- {
- s = "<NULL>";
- len = 6;
- }
- else
- {
- if (len == -1)
- {
- len = 0;
- while ((unsigned int)len < (unsigned int)precision && s[len])
- len++;
- }
- else
- {
- if ((unsigned int)len > (unsigned int)precision)
- len = precision;
- }
- }
- if (!(flags & LEFT))
- while (len < field_width--)
- {
- f += ' ';
- done++;
- }
- for (i = 0; i < len; ++i)
- {
- f += *s++;
- done++;
- }
- while (len < field_width--)
- {
- f += ' ';
- done++;
- }
- return done;
-}
-
-static int stringw(std::string& f, const wchar_t* sw, int len, int field_width, int precision, int flags)
-{
- int i, done = 0;
- if (sw == NULL)
- {
- sw = L"<NULL>";
- len = 6;
- }
- else
- {
- if (len == -1)
- {
- len = 0;
- while ((unsigned int)len < (unsigned int)precision && sw[len])
- len++;
- }
- else
- {
- if ((unsigned int)len > (unsigned int)precision)
- len = precision;
- }
- }
- if (!(flags & LEFT))
- while (len < field_width--)
- {
- f += ' ';
- done++;
- }
- for (i = 0; i < len; ++i)
- {
-#define MY_MB_CUR_MAX 1
- char mb[MY_MB_CUR_MAX];
- int mbcount, j;
- mbcount = wctomb(mb, *sw++);
- if (mbcount <= 0)
- {
- break;
- }
- for (j = 0; j < mbcount; j++)
- {
- f += mb[j];
- done++;
- }
- }
- while (len < field_width--)
- {
- f += ' ';
- done++;
- }
- return done;
-}
-
-#define _isnanl _isnan
-#define _finitel _finite
-
-std::string ssvprintf ( const char *fmt, va_list args )
-{
- ULONGLONG num;
- int base;
- long double _ldouble;
- double _double;
- const char *s;
- const wchar_t* sw;
- int result;
- std::string f;
-
- int flags; /* flags to number() */
-
- int field_width; /* width of output field */
- int precision; /* min. # of digits for integers; max
- number of chars for from string */
- int qualifier = 0; /* 'h', 'l', 'L' or 'I64' for integer fields */
-
- for (; *fmt ; ++fmt)
- {
- if (*fmt != '%')
- {
- f += *fmt;
- continue;
- }
-
- /* process flags */
- flags = 0;
- repeat:
- ++fmt; /* this also skips first '%' */
- switch (*fmt) {
- case '-': flags |= LEFT; goto repeat;
- case '+': flags |= PLUS; goto repeat;
- case ' ': flags |= SPACE; goto repeat;
- case '#': flags |= SPECIAL; goto repeat;
- case '0': flags |= ZEROPAD; goto repeat;
- }
-
- /* get field width */
- field_width = -1;
- if (isdigit(*fmt))
- field_width = skip_atoi(&fmt);
- else if (*fmt == '*') {
- ++fmt;
- /* it's the next argument */
- field_width = va_arg(args, int);
- if (field_width < 0) {
- field_width = -field_width;
- flags |= LEFT;
- }
- }
-
- /* get the precision */
- precision = -1;
- if (*fmt == '.') {
- ++fmt;
- if (isdigit(*fmt))
- precision = skip_atoi(&fmt);
- else if (*fmt == '*') {
- ++fmt;
- /* it's the next argument */
- precision = va_arg(args, int);
- }
- if (precision < 0)
- precision = 0;
- }
-
- /* get the conversion qualifier */
- qualifier = 0;
- // %Z can be just stand alone or as size_t qualifier
- if ( *fmt == 'Z' ) {
- qualifier = *fmt;
- switch ( *(fmt+1)) {
- case 'o':
- case 'b':
- case 'X':
- case 'x':
- case 'd':
- case 'i':
- case 'u':
- ++fmt;
- break;
- default:
- break;
- }
- } else if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'w') {
- qualifier = *fmt;
- ++fmt;
- } else if (*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4') {
- qualifier = *fmt;
- fmt += 3;
- }
-
- // go fine with ll instead of L
- if ( *fmt == 'l' ) {
- ++fmt;
- qualifier = 'L';
- }
-
- /* default base */
- base = 10;
-
- switch (*fmt) {
- case 'c':
- if (!(flags & LEFT))
- while (--field_width > 0)
- {
- f += ' ';
- }
- if (qualifier == 'l' || qualifier == 'w')
- {
- f += (char)(unsigned char)(wchar_t) va_arg(args,int);
- }
- else
- {
- f += (char)(unsigned char) va_arg(args,int);
- }
- while (--field_width > 0)
- {
- f += ' ';
- }
- continue;
-
- case 'C':
- if (!(flags & LEFT))
- while (--field_width > 0)
- {
- f += ' ';
- }
- if (qualifier == 'h')
- {
- f += (char)(unsigned char) va_arg(args,int);
- }
- else
- {
- f += (char)(unsigned char)(wchar_t) va_arg(args,int);
- }
- while (--field_width > 0)
- {
- f += ' ';
- }
- continue;
-
- case 's':
- if (qualifier == 'l' || qualifier == 'w') {
- /* print unicode string */
- sw = (const wchar_t*)va_arg(args, wchar_t *);
- result = stringw(f, sw, -1, field_width, precision, flags);
- } else {
- /* print ascii string */
- s = va_arg(args, char *);
- result = stringa(f, s, -1, field_width, precision, flags);
- }
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- continue;
-
- case 'S':
- if (qualifier == 'h') {
- /* print ascii string */
- s = va_arg(args, char *);
- result = stringa(f, s, -1, field_width, precision, flags);
- } else {
- /* print unicode string */
- sw = (const wchar_t*)va_arg(args, wchar_t *);
- result = stringw(f, sw, -1, field_width, precision, flags);
- }
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- continue;
-
- /*case 'Z':
- if (qualifier == 'w') {
- // print counted unicode string
- PUNICODE_STRING pus = va_arg(args, PUNICODE_STRING);
- if ((pus == NULL) || (pus->Buffer == NULL)) {
- sw = NULL;
- len = -1;
- } else {
- sw = pus->Buffer;
- len = pus->Length / sizeof(WCHAR);
- }
- result = stringw(f, sw, len, field_width, precision, flags);
- } else {
- // print counted ascii string
- PANSI_STRING pas = va_arg(args, PANSI_STRING);
- if ((pas == NULL) || (pas->Buffer == NULL)) {
- s = NULL;
- len = -1;
- } else {
- s = pas->Buffer;
- len = pas->Length;
- }
- result = stringa(f, s, -1, field_width, precision, flags);
- }
- if (result < 0)
- return -1;
- continue;*/
-
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- if (qualifier == 'l' || qualifier == 'L' ) {
- _ldouble = va_arg(args, long double);
-
- if ( _isnanl(_ldouble) )
- {
- f += "Nan";
- }
- else if ( !_finitel(_ldouble) )
- {
- if ( _ldouble < 0 )
- f += "-Inf";
- else
- f += "+Inf";
- } else {
- if ( precision == -1 )
- precision = 6;
- result = numberfl(f,_ldouble,*fmt,field_width,precision,flags);
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- }
- } else {
- _double = (double)va_arg(args, double);
-
- if ( _isnan(_double) )
- {
- f += "Nan";
- }
- else if ( !_finite(_double) )
- {
- if ( _double < 0 )
- f += "-Inf";
- else
- f += "+Inf";
- }
- else
- {
- if ( precision == -1 )
- precision = 6;
- result = numberf(f,_double,*fmt,field_width,precision,flags);
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- }
- }
- continue;
-
- case 'p':
- if (field_width == -1) {
- field_width = 2*sizeof(void *);
- flags |= ZEROPAD;
- }
- result = number(f,
- (unsigned long) va_arg(args, void *), 16,
- field_width, precision, flags);
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- continue;
-
- case 'n':
- if (qualifier == 'l') {
- long * ip = va_arg(args, long *);
- *ip = 0;
- } else {
- int * ip = va_arg(args, int *);
- *ip = 0;
- }
- continue;
-
- /* integer number formats - set up the flags and "break" */
- case 'o':
- base = 8;
- break;
-
- case 'b':
- base = 2;
- break;
-
- case 'X':
- flags |= LARGE;
- case 'x':
- base = 16;
- break;
-
- case 'd':
- case 'i':
- flags |= SIGN;
- case 'u':
- break;
-
- default:
- if (*fmt != '%')
- {
- f += '%';
- }
- if (*fmt)
- {
- f += *fmt;
- }
- else
- --fmt;
- continue;
- }
-
- if (qualifier == 'I')
- num = va_arg(args, ULONGLONG);
- else if (qualifier == 'l') {
- if (flags & SIGN)
- num = va_arg(args, long);
- else
- num = va_arg(args, unsigned long);
- }
- else if (qualifier == 'h') {
- if (flags & SIGN)
- num = va_arg(args, int);
- else
- num = va_arg(args, unsigned int);
- }
- else if (flags & SIGN)
- num = va_arg(args, int);
- else
- num = va_arg(args, unsigned int);
- result = number(f, num, base, field_width, precision, flags);
- if (result < 0)
- {
- assert(!"TODO FIXME handle error better");
- return f;
- }
- }
- //putc('\0',f);
- return f;
-}
+++ /dev/null
-// ssprintf.h
-
-#ifndef SSPRINTF_H
-#define SSPRINTF_H
-
-#include <string>
-#include <stdarg.h>
-
-std::string ssprintf ( const char* fmt, ... );
-std::string ssvprintf ( const char* fmt, va_list args );
-
-#endif//SSPRINTF_H
+++ /dev/null
-RPC_NT_ALREADY_LISTENING
-RPC_NT_ALREADY_REGISTERED
-RPC_NT_CALL_FAILED
-RPC_NT_CALL_FAILED_DNE
-RPC_NT_CANT_CREATE_ENDPOINT
-RPC_NT_INVALID_BINDING
-RPC_NT_INVALID_ENDPOINT_FORMAT
-RPC_NT_INVALID_NETWORK_OPTIONS
-RPC_NT_INVALID_NET_ADDR
-RPC_NT_INVALID_RPC_PROTSEQ
-RPC_NT_INVALID_STRING_BINDING
-RPC_NT_INVALID_STRING_UUID
-RPC_NT_INVALID_TIMEOUT
-RPC_NT_NOT_LISTENING
-RPC_NT_NO_BINDINGS
-RPC_NT_NO_CALL_ACTIVE
-RPC_NT_NO_ENDPOINT_FOUND
-RPC_NT_NO_PROTSEQS
-RPC_NT_NO_PROTSEQS_REGISTERED
-RPC_NT_OBJECT_NOT_FOUND
-RPC_NT_OUT_OF_RESOURCES
-RPC_NT_PROTOCOL_ERROR
-RPC_NT_PROTSEQ_NOT_SUPPORTED
-RPC_NT_SERVER_TOO_BUSY
-RPC_NT_SERVER_UNAVAILABLE
-RPC_NT_SS_IN_NULL_CONTEXT
-RPC_NT_TYPE_ALREADY_REGISTERED
-RPC_NT_UNKNOWN_IF
-RPC_NT_UNKNOWN_MGR_TYPE
-RPC_NT_WRONG_KIND_OF_BINDING
-STATUS_ABANDONED
-STATUS_ABANDONED_WAIT_0
-STATUS_ABANDONED_WAIT_63
-STATUS_ABIOS_INVALID_COMMAND
-STATUS_ABIOS_INVALID_LID
-STATUS_ABIOS_INVALID_SELECTOR
-STATUS_ABIOS_LID_ALREADY_OWNED
-STATUS_ABIOS_LID_NOT_EXIST
-STATUS_ABIOS_NOT_LID_OWNER
-STATUS_ABIOS_NOT_PRESENT
-STATUS_ABIOS_SELECTOR_NOT_AVAILABLE
-STATUS_ACCESS_DENIED
-STATUS_ACCESS_VIOLATION
-STATUS_ACCOUNT_DISABLED
-STATUS_ACCOUNT_EXPIRED
-STATUS_ACCOUNT_LOCKED_OUT
-STATUS_ACCOUNT_RESTRICTION
-STATUS_ADAPTER_HARDWARE_ERROR
-STATUS_ADDRESS_ALREADY_ASSOCIATED
-STATUS_ADDRESS_ALREADY_EXISTS
-STATUS_ADDRESS_CLOSED
-STATUS_ADDRESS_NOT_ASSOCIATED
-STATUS_AGENTS_EXHAUSTED
-STATUS_ALERTED
-STATUS_ALIAS_EXISTS
-STATUS_ALLOCATE_BUCKET
-STATUS_ALLOTTED_SPACE_EXCEEDED
-STATUS_ALREADY_COMMITTED
-STATUS_ALREADY_DISCONNECTED
-STATUS_ALREADY_WIN32
-STATUS_APP_INIT_FAILURE
-STATUS_ARBITRATION_UNHANDLED
-STATUS_ARRAY_BOUNDS_EXCEEDED
-STATUS_AUDIT_FAILED
-STATUS_BACKUP_CONTROLLER
-STATUS_BAD_COMPRESSION_BUFFER
-STATUS_BAD_CURRENT_DIRECTORY
-STATUS_BAD_DESCRIPTOR_FORMAT
-STATUS_BAD_DEVICE_TYPE
-STATUS_BAD_DLL_ENTRYPOINT
-STATUS_BAD_FUNCTION_TABLE
-STATUS_BAD_IMPERSONATION_LEVEL
-STATUS_BAD_INHERITANCE_ACL
-STATUS_BAD_INITIAL_PC
-STATUS_BAD_INITIAL_STACK
-STATUS_BAD_LOGON_SESSION_STATE
-STATUS_BAD_MASTER_BOOT_RECORD
-STATUS_BAD_NETWORK_NAME
-STATUS_BAD_NETWORK_PATH
-STATUS_BAD_REMOTE_ADAPTER
-STATUS_BAD_SERVICE_ENTRYPOINT
-STATUS_BAD_STACK
-STATUS_BAD_TOKEN_TYPE
-STATUS_BAD_VALIDATION_CLASS
-STATUS_BAD_WORKING_SET_LIMIT
-STATUS_BEGINNING_OF_MEDIA
-STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
-STATUS_BREAKPOINT
-STATUS_BUFFER_OVERFLOW
-STATUS_BUFFER_TOO_SMALL
-STATUS_BUS_RESET
-STATUS_CANCELLED
-STATUS_CANNOT_DELETE
-STATUS_CANNOT_IMPERSONATE
-STATUS_CANNOT_LOAD_REGISTRY_FILE
-STATUS_CANT_ACCESS_DOMAIN_INFO
-STATUS_CANT_DISABLE_MANDATORY
-STATUS_CANT_OPEN_ANONYMOUS
-STATUS_CANT_TERMINATE_SELF
-STATUS_CANT_WAIT
-STATUS_CARDBUS_NOT_SUPPORTED
-STATUS_CHECKING_FILE_SYSTEM
-STATUS_CHILD_MUST_BE_VOLATILE
-STATUS_CLIENT_SERVER_PARAMETERS_INVALID
-STATUS_COMMITMENT_LIMIT
-STATUS_CONFLICTING_ADDRESSES
-STATUS_CONNECTION_ABORTED
-STATUS_CONNECTION_ACTIVE
-STATUS_CONNECTION_COUNT_LIMIT
-STATUS_CONNECTION_DISCONNECTED
-STATUS_CONNECTION_INVALID
-STATUS_CONNECTION_IN_USE
-STATUS_CONNECTION_REFUSED
-STATUS_CONNECTION_RESET
-STATUS_CONTROL_C_EXIT
-STATUS_CONVERT_TO_LARGE
-STATUS_COULD_NOT_INTERPRET
-STATUS_CRC_ERROR
-STATUS_CTL_FILE_NOT_SUPPORTED
-STATUS_DATATYPE_MISALIGNMENT
-STATUS_DATA_ERROR
-STATUS_DATA_LATE_ERROR
-STATUS_DATA_NOT_ACCEPTED
-STATUS_DATA_OVERRUN
-STATUS_DEBUG_ATTACH_FAILED
-STATUS_DELETE_PENDING
-STATUS_DEVICE_ALREADY_ATTACHED
-STATUS_DEVICE_BUSY
-STATUS_DEVICE_CONFIGURATION_ERROR
-STATUS_DEVICE_DATA_ERROR
-STATUS_DEVICE_DOES_NOT_EXIST
-STATUS_DEVICE_NOT_CONNECTED
-STATUS_DEVICE_NOT_PARTITIONED
-STATUS_DEVICE_NOT_READY
-STATUS_DEVICE_OFF_LINE
-STATUS_DEVICE_PAPER_EMPTY
-STATUS_DEVICE_POWERED_OFF
-STATUS_DEVICE_POWER_FAILURE
-STATUS_DEVICE_PROTOCOL_ERROR
-STATUS_DFS_EXIT_PATH_FOUND
-STATUS_DFS_UNAVAILABLE
-STATUS_DIRECTORY_NOT_EMPTY
-STATUS_DISK_CORRUPT_ERROR
-STATUS_DISK_FULL
-STATUS_DISK_OPERATION_FAILED
-STATUS_DISK_RECALIBRATE_FAILED
-STATUS_DISK_RESET_FAILED
-STATUS_DLL_INIT_FAILED
-STATUS_DLL_INIT_FAILED_LOGOFF
-STATUS_DLL_NOT_FOUND
-STATUS_DOMAIN_CONTROLLER_NOT_FOUND
-STATUS_DOMAIN_CTRLR_CONFIG_ERROR
-STATUS_DOMAIN_EXISTS
-STATUS_DOMAIN_LIMIT_EXCEEDED
-STATUS_DOMAIN_TRUST_INCONSISTENT
-STATUS_DRIVER_CANCEL_TIMEOUT
-STATUS_DRIVER_ENTRYPOINT_NOT_FOUND
-STATUS_DRIVER_INTERNAL_ERROR
-STATUS_DRIVER_ORDINAL_NOT_FOUND
-STATUS_DRIVER_UNABLE_TO_LOAD
-STATUS_DUPLICATE_NAME
-STATUS_DUPLICATE_OBJECTID
-STATUS_EAS_NOT_SUPPORTED
-STATUS_EA_CORRUPT_ERROR
-STATUS_EA_LIST_INCONSISTENT
-STATUS_EA_TOO_LARGE
-STATUS_END_OF_FILE
-STATUS_END_OF_MEDIA
-STATUS_ENTRYPOINT_NOT_FOUND
-STATUS_EOM_OVERFLOW
-STATUS_EVALUATION_EXPIRATION
-STATUS_EVENTLOG_CANT_START
-STATUS_EVENTLOG_FILE_CHANGED
-STATUS_EVENTLOG_FILE_CORRUPT
-STATUS_EVENT_DONE
-STATUS_EVENT_PENDING
-STATUS_EXTRANEOUS_INFORMATION
-STATUS_FAIL_CHECK
-STATUS_FATAL_APP_EXIT
-STATUS_FILEMARK_DETECTED
-STATUS_FILES_OPEN
-STATUS_FILE_CLOSED
-STATUS_FILE_CORRUPT_ERROR
-STATUS_FILE_DELETED
-STATUS_FILE_FORCED_CLOSED
-STATUS_FILE_INVALID
-STATUS_FILE_IS_A_DIRECTORY
-STATUS_FILE_IS_OFFLINE
-STATUS_FILE_LOCK_CONFLICT
-STATUS_FILE_RENAMED
-STATUS_FLOAT_DENORMAL_OPERAND
-STATUS_FLOAT_DIVIDE_BY_ZERO
-STATUS_FLOAT_INEXACT_RESULT
-STATUS_FLOAT_INVALID_OPERATION
-STATUS_FLOAT_OVERFLOW
-STATUS_FLOAT_STACK_CHECK
-STATUS_FLOAT_UNDERFLOW
-STATUS_FLOPPY_BAD_REGISTERS
-STATUS_FLOPPY_ID_MARK_NOT_FOUND
-STATUS_FLOPPY_UNKNOWN_ERROR
-STATUS_FLOPPY_VOLUME
-STATUS_FLOPPY_WRONG_CYLINDER
-STATUS_FOUND_OUT_OF_SCOPE
-STATUS_FREE_VM_NOT_AT_BASE
-STATUS_FS_DRIVER_REQUIRED
-STATUS_FT_MISSING_MEMBER
-STATUS_FT_ORPHANING
-STATUS_FT_READ_RECOVERING_FROM_BACKUP
-STATUS_FT_WRITE_RECOVERY
-STATUS_FULLSCREEN_MODE
-STATUS_GENERIC_NOT_MAPPED
-STATUS_GRACEFUL_DISCONNECT
-STATUS_GROUP_EXISTS
-STATUS_GUARD_PAGE_VIOLATION
-STATUS_GUIDS_EXHAUSTED
-STATUS_GUID_SUBSTITUTION_MADE
-STATUS_HANDLES_CLOSED
-STATUS_HANDLE_NOT_CLOSABLE
-STATUS_HOST_UNREACHABLE
-STATUS_ILLEGAL_CHARACTER
-STATUS_ILLEGAL_DLL_RELOCATION
-STATUS_ILLEGAL_FLOAT_CONTEXT
-STATUS_ILLEGAL_FUNCTION
-STATUS_ILLEGAL_INSTRUCTION
-STATUS_ILL_FORMED_PASSWORD
-STATUS_ILL_FORMED_SERVICE_ENTRY
-STATUS_IMAGE_ALREADY_LOADED
-STATUS_IMAGE_CHECKSUM_MISMATCH
-STATUS_IMAGE_MACHINE_TYPE_MISMATCH
-STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE
-STATUS_IMAGE_MP_UP_MISMATCH
-STATUS_IMAGE_NOT_AT_BASE
-STATUS_INCOMPATIBLE_FILE_MAP
-STATUS_INFO_LENGTH_MISMATCH
-STATUS_INSTANCE_NOT_AVAILABLE
-STATUS_INSTRUCTION_MISALIGNMENT
-STATUS_INSUFFICIENT_LOGON_INFO
-STATUS_INSUFFICIENT_RESOURCES
-STATUS_INSUFF_SERVER_RESOURCES
-STATUS_INTEGER_DIVIDE_BY_ZERO
-STATUS_INTEGER_OVERFLOW
-STATUS_INTERNAL_DB_CORRUPTION
-STATUS_INTERNAL_DB_ERROR
-STATUS_INTERNAL_ERROR
-STATUS_INVALID_ACCOUNT_NAME
-STATUS_INVALID_ACL
-STATUS_INVALID_ADDRESS
-STATUS_INVALID_ADDRESS_COMPONENT
-STATUS_INVALID_ADDRESS_WILDCARD
-STATUS_INVALID_BLOCK_LENGTH
-STATUS_INVALID_BUFFER_SIZE
-STATUS_INVALID_CID
-STATUS_INVALID_COMPUTER_NAME
-STATUS_INVALID_CONNECTION
-STATUS_INVALID_DEVICE_REQUEST
-STATUS_INVALID_DEVICE_STATE
-STATUS_INVALID_DISPOSITION
-STATUS_INVALID_DOMAIN_ROLE
-STATUS_INVALID_DOMAIN_STATE
-STATUS_INVALID_EA_FLAG
-STATUS_INVALID_EA_NAME
-STATUS_INVALID_FILE_FOR_SECTION
-STATUS_INVALID_GROUP_ATTRIBUTES
-STATUS_INVALID_HANDLE
-STATUS_INVALID_HW_PROFILE
-STATUS_INVALID_ID_AUTHORITY
-STATUS_INVALID_IMAGE_FORMAT
-STATUS_INVALID_IMAGE_LE_FORMAT
-STATUS_INVALID_IMAGE_NE_FORMAT
-STATUS_INVALID_IMAGE_NOT_MZ
-STATUS_INVALID_IMAGE_PROTECT
-STATUS_INVALID_IMAGE_WIN_16
-STATUS_INVALID_INFO_CLASS
-STATUS_INVALID_LDT_DESCRIPTOR
-STATUS_INVALID_LDT_OFFSET
-STATUS_INVALID_LDT_SIZE
-STATUS_INVALID_LEVEL
-STATUS_INVALID_LOCK_SEQUENCE
-STATUS_INVALID_LOGON_HOURS
-STATUS_INVALID_LOGON_TYPE
-STATUS_INVALID_MEMBER
-STATUS_INVALID_NETWORK_RESPONSE
-STATUS_INVALID_OPLOCK_PROTOCOL
-STATUS_INVALID_OWNER
-STATUS_INVALID_PAGE_PROTECTION
-STATUS_INVALID_PARAMETER
-STATUS_INVALID_PARAMETER_1
-STATUS_INVALID_PARAMETER_10
-STATUS_INVALID_PARAMETER_11
-STATUS_INVALID_PARAMETER_12
-STATUS_INVALID_PARAMETER_2
-STATUS_INVALID_PARAMETER_3
-STATUS_INVALID_PARAMETER_4
-STATUS_INVALID_PARAMETER_5
-STATUS_INVALID_PARAMETER_6
-STATUS_INVALID_PARAMETER_7
-STATUS_INVALID_PARAMETER_8
-STATUS_INVALID_PARAMETER_9
-STATUS_INVALID_PARAMETER_MIX
-STATUS_INVALID_PIPE_STATE
-STATUS_INVALID_PLUGPLAY_DEVICE_PATH
-STATUS_INVALID_PORT_ATTRIBUTES
-STATUS_INVALID_PORT_HANDLE
-STATUS_INVALID_PRIMARY_GROUP
-STATUS_INVALID_QUOTA_LOWER
-STATUS_INVALID_READ_MODE
-STATUS_INVALID_SECURITY_DESCR
-STATUS_INVALID_SERVER_STATE
-STATUS_INVALID_SID
-STATUS_INVALID_SUB_AUTHORITY
-STATUS_INVALID_SYSTEM_SERVICE
-STATUS_INVALID_UNWIND_TARGET
-STATUS_INVALID_USER_BUFFER
-STATUS_INVALID_VARIANT
-STATUS_INVALID_VIEW_SIZE
-STATUS_INVALID_VLM_OPERATION
-STATUS_INVALID_VOLUME_LABEL
-STATUS_INVALID_WORKSTATION
-STATUS_IN_PAGE_ERROR
-STATUS_IO_DEVICE_ERROR
-STATUS_IO_PRIVILEGE_FAILED
-STATUS_IO_REPARSE_DATA_INVALID
-STATUS_IO_REPARSE_TAG_INVALID
-STATUS_IO_REPARSE_TAG_MISMATCH
-STATUS_IO_REPARSE_TAG_NOT_HANDLED
-STATUS_IO_TIMEOUT
-STATUS_IP_ADDRESS_CONFLICT1
-STATUS_IP_ADDRESS_CONFLICT2
-STATUS_KERNEL_APC
-STATUS_KEY_DELETED
-STATUS_KEY_HAS_CHILDREN
-STATUS_LAST_ADMIN
-STATUS_LICENSE_QUOTA_EXCEEDED
-STATUS_LICENSE_VIOLATION
-STATUS_LINK_FAILED
-STATUS_LINK_TIMEOUT
-STATUS_LM_CROSS_ENCRYPTION_REQUIRED
-STATUS_LOCAL_DISCONNECT
-STATUS_LOCAL_USER_SESSION_KEY
-STATUS_LOCK_NOT_GRANTED
-STATUS_LOGIN_TIME_RESTRICTION
-STATUS_LOGIN_WKSTA_RESTRICTION
-STATUS_LOGON_FAILURE
-STATUS_LOGON_NOT_GRANTED
-STATUS_LOGON_SERVER_CONFLICT
-STATUS_LOGON_SESSION_COLLISION
-STATUS_LOGON_SESSION_EXISTS
-STATUS_LOGON_TYPE_NOT_GRANTED
-STATUS_LOG_FILE_FULL
-STATUS_LOG_HARD_ERROR
-STATUS_LONGJUMP
-STATUS_LOST_WRITEBEHIND_DATA
-STATUS_LPC_REPLY_LOST
-STATUS_LUIDS_EXHAUSTED
-STATUS_MAPPED_ALIGNMENT
-STATUS_MAPPED_FILE_SIZE_ZERO
-STATUS_MARSHALL_OVERFLOW
-STATUS_MEDIA_CHANGED
-STATUS_MEDIA_CHECK
-STATUS_MEDIA_WRITE_PROTECTED
-STATUS_MEMBERS_PRIMARY_GROUP
-STATUS_MEMBER_IN_ALIAS
-STATUS_MEMBER_IN_GROUP
-STATUS_MEMBER_NOT_IN_ALIAS
-STATUS_MEMBER_NOT_IN_GROUP
-STATUS_MEMORY_NOT_ALLOCATED
-STATUS_MESSAGE_NOT_FOUND
-STATUS_MISSING_SYSTEMFILE
-STATUS_MORE_ENTRIES
-STATUS_MORE_PROCESSING_REQUIRED
-STATUS_MUTANT_LIMIT_EXCEEDED
-STATUS_MUTANT_NOT_OWNED
-STATUS_NAME_TOO_LONG
-STATUS_NETLOGON_NOT_STARTED
-STATUS_NETWORK_ACCESS_DENIED
-STATUS_NETWORK_BUSY
-STATUS_NETWORK_CREDENTIAL_CONFLICT
-STATUS_NETWORK_NAME_DELETED
-STATUS_NETWORK_UNREACHABLE
-STATUS_NET_WRITE_FAULT
-STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
-STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
-STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
-STATUS_NONCONTINUABLE_EXCEPTION
-STATUS_NONEXISTENT_EA_ENTRY
-STATUS_NONEXISTENT_SECTOR
-STATUS_NONE_MAPPED
-STATUS_NOTIFY_CLEANUP
-STATUS_NOTIFY_ENUM_DIR
-STATUS_NOT_ALL_ASSIGNED
-STATUS_NOT_A_DIRECTORY
-STATUS_NOT_A_REPARSE_POINT
-STATUS_NOT_CLIENT_SESSION
-STATUS_NOT_COMMITTED
-STATUS_NOT_FOUND
-STATUS_NOT_IMPLEMENTED
-STATUS_NOT_LOCKED
-STATUS_NOT_LOGON_PROCESS
-STATUS_NOT_MAPPED_DATA
-STATUS_NOT_MAPPED_VIEW
-STATUS_NOT_REGISTRY_FILE
-STATUS_NOT_SAME_DEVICE
-STATUS_NOT_SERVER_SESSION
-STATUS_NOT_SUPPORTED
-STATUS_NOT_TINY_STREAM
-STATUS_NO_BROWSER_SERVERS_FOUND
-STATUS_NO_CALLBACK_ACTIVE
-STATUS_NO_DATA_DETECTED
-STATUS_NO_EAS_ON_FILE
-STATUS_NO_EVENT_PAIR
-STATUS_NO_GUID_TRANSLATION
-STATUS_NO_IMPERSONATION_TOKEN
-STATUS_NO_INHERITANCE
-STATUS_NO_LDT
-STATUS_NO_LOGON_SERVERS
-STATUS_NO_LOG_SPACE
-STATUS_NO_MATCH
-STATUS_NO_MEDIA
-STATUS_NO_MEDIA_IN_DEVICE
-STATUS_NO_MEMORY
-STATUS_NO_MORE_EAS
-STATUS_NO_MORE_ENTRIES
-STATUS_NO_MORE_FILES
-STATUS_NO_MORE_MATCHES
-STATUS_NO_PAGEFILE
-STATUS_NO_QUOTAS_NO_ACCOUNT
-STATUS_NO_SECURITY_ON_OBJECT
-STATUS_NO_SPOOL_SPACE
-STATUS_NO_SUCH_ALIAS
-STATUS_NO_SUCH_DEVICE
-STATUS_NO_SUCH_DOMAIN
-STATUS_NO_SUCH_FILE
-STATUS_NO_SUCH_GROUP
-STATUS_NO_SUCH_LOGON_SESSION
-STATUS_NO_SUCH_MEMBER
-STATUS_NO_SUCH_PACKAGE
-STATUS_NO_SUCH_PRIVILEGE
-STATUS_NO_SUCH_USER
-STATUS_NO_TOKEN
-STATUS_NO_TRUST_LSA_SECRET
-STATUS_NO_TRUST_SAM_ACCOUNT
-STATUS_NO_USER_SESSION_KEY
-STATUS_NO_YIELD_PERFORMED
-STATUS_NT_CROSS_ENCRYPTION_REQUIRED
-STATUS_NULL_LM_PASSWORD
-STATUS_OBJECTID_EXISTS
-STATUS_OBJECT_EXISTS
-STATUS_OBJECT_NAME_COLLISION
-STATUS_OBJECT_NAME_EXISTS
-STATUS_OBJECT_NAME_INVALID
-STATUS_OBJECT_NAME_NOT_FOUND
-STATUS_OBJECT_PATH_INVALID
-STATUS_OBJECT_PATH_NOT_FOUND
-STATUS_OBJECT_PATH_SYNTAX_BAD
-STATUS_OBJECT_TYPE_MISMATCH
-STATUS_OPEN_FAILED
-STATUS_OPLOCK_BREAK_IN_PROCESS
-STATUS_OPLOCK_NOT_GRANTED
-STATUS_ORDINAL_NOT_FOUND
-STATUS_PAGEFILE_CREATE_FAILED
-STATUS_PAGEFILE_QUOTA
-STATUS_PAGEFILE_QUOTA_EXCEEDED
-STATUS_PARITY_ERROR
-STATUS_PARTIAL_COPY
-STATUS_PARTITION_FAILURE
-STATUS_PASSWORD_EXPIRED
-STATUS_PASSWORD_MUST_CHANGE
-STATUS_PASSWORD_RESTRICTION
-STATUS_PATH_NOT_COVERED
-STATUS_PENDING
-STATUS_PIPE_BROKEN
-STATUS_PIPE_BUSY
-STATUS_PIPE_CLOSING
-STATUS_PIPE_CONNECTED
-STATUS_PIPE_DISCONNECTED
-STATUS_PIPE_EMPTY
-STATUS_PIPE_LISTENING
-STATUS_PIPE_NOT_AVAILABLE
-STATUS_PLUGPLAY_NO_DEVICE
-STATUS_PORT_ALREADY_SET
-STATUS_PORT_CONNECTION_REFUSED
-STATUS_PORT_DISCONNECTED
-STATUS_PORT_MESSAGE_TOO_LONG
-STATUS_PORT_UNREACHABLE
-STATUS_POSSIBLE_DEADLOCK
-STATUS_PREDEFINED_HANDLE
-STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED
-STATUS_PRINT_CANCELLED
-STATUS_PRINT_QUEUE_FULL
-STATUS_PRIVILEGED_INSTRUCTION
-STATUS_PRIVILEGE_NOT_HELD
-STATUS_PROCEDURE_NOT_FOUND
-STATUS_PROCESS_IN_JOB
-STATUS_PROCESS_IS_TERMINATING
-STATUS_PROCESS_NOT_IN_JOB
-STATUS_PROFILING_AT_LIMIT
-STATUS_PROFILING_NOT_STARTED
-STATUS_PROFILING_NOT_STOPPED
-STATUS_PROPSET_NOT_FOUND
-STATUS_PROTOCOL_UNREACHABLE
-STATUS_PWD_HISTORY_CONFLICT
-STATUS_PWD_TOO_RECENT
-STATUS_PWD_TOO_SHORT
-STATUS_QUOTA_EXCEEDED
-STATUS_QUOTA_LIST_INCONSISTENT
-STATUS_RANGE_LIST_CONFLICT
-STATUS_RANGE_NOT_FOUND
-STATUS_RANGE_NOT_LOCKED
-STATUS_RECEIVE_EXPEDITED
-STATUS_RECEIVE_PARTIAL
-STATUS_RECEIVE_PARTIAL_EXPEDITED
-STATUS_RECOVERY_FAILURE
-STATUS_REDIRECTOR_HAS_OPEN_HANDLES
-STATUS_REDIRECTOR_NOT_STARTED
-STATUS_REDIRECTOR_PAUSED
-STATUS_REDIRECTOR_STARTED
-STATUS_REGISTRY_CORRUPT
-STATUS_REGISTRY_IO_FAILED
-STATUS_REGISTRY_QUOTA_LIMIT
-STATUS_REGISTRY_RECOVERED
-STATUS_REMOTE_DISCONNECT
-STATUS_REMOTE_NOT_LISTENING
-STATUS_REMOTE_RESOURCES
-STATUS_REMOTE_SESSION_LIMIT
-STATUS_REPARSE
-STATUS_REPLY_MESSAGE_MISMATCH
-STATUS_REQUEST_ABORTED
-STATUS_REQUEST_NOT_ACCEPTED
-STATUS_RESOURCE_DATA_NOT_FOUND
-STATUS_RESOURCE_LANG_NOT_FOUND
-STATUS_RESOURCE_NAME_NOT_FOUND
-STATUS_RESOURCE_NOT_OWNED
-STATUS_RESOURCE_TYPE_NOT_FOUND
-STATUS_RETRY
-STATUS_REVISION_MISMATCH
-STATUS_RXACT_COMMITTED
-STATUS_RXACT_COMMIT_FAILURE
-STATUS_RXACT_COMMIT_NECESSARY
-STATUS_RXACT_INVALID_STATE
-STATUS_RXACT_STATE_CREATED
-STATUS_SAM_INIT_FAILURE
-STATUS_SECRET_TOO_LONG
-STATUS_SECTION_NOT_EXTENDED
-STATUS_SECTION_NOT_IMAGE
-STATUS_SECTION_PROTECTION
-STATUS_SECTION_TOO_BIG
-STATUS_SEGMENT_NOTIFICATION
-STATUS_SEMAPHORE_LIMIT_EXCEEDED
-STATUS_SERIAL_COUNTER_TIMEOUT
-STATUS_SERIAL_MORE_WRITES
-STATUS_SERIAL_NO_DEVICE_INITED
-STATUS_SERVER_DISABLED
-STATUS_SERVER_HAS_OPEN_HANDLES
-STATUS_SERVER_NOT_DISABLED
-STATUS_SERVICE_NOTIFICATION
-STATUS_SETMARK_DETECTED
-STATUS_SHARED_IRQ_BUSY
-STATUS_SHARING_PAUSED
-STATUS_SHARING_VIOLATION
-STATUS_SINGLE_STEP
-STATUS_SOME_NOT_MAPPED
-STATUS_SPECIAL_ACCOUNT
-STATUS_SPECIAL_GROUP
-STATUS_SPECIAL_USER
-STATUS_STACK_OVERFLOW
-STATUS_STACK_OVERFLOW_READ
-STATUS_SUCCESS
-STATUS_SUSPEND_COUNT_EXCEEDED
-STATUS_SYNCHRONIZATION_REQUIRED
-STATUS_SYSTEM_PROCESS_TERMINATED
-STATUS_THREAD_IS_TERMINATING
-STATUS_THREAD_NOT_IN_PROCESS
-STATUS_THREAD_WAS_SUSPENDED
-STATUS_TIMEOUT
-STATUS_TIMER_NOT_CANCELED
-STATUS_TIMER_RESOLUTION_NOT_SET
-STATUS_TIMER_RESUME_IGNORED
-STATUS_TIME_DIFFERENCE_AT_DC
-STATUS_TOKEN_ALREADY_IN_USE
-STATUS_TOO_LATE
-STATUS_TOO_MANY_ADDRESSES
-STATUS_TOO_MANY_COMMANDS
-STATUS_TOO_MANY_CONTEXT_IDS
-STATUS_TOO_MANY_GUIDS_REQUESTED
-STATUS_TOO_MANY_LINKS
-STATUS_TOO_MANY_LUIDS_REQUESTED
-STATUS_TOO_MANY_NAMES
-STATUS_TOO_MANY_NODES
-STATUS_TOO_MANY_OPENED_FILES
-STATUS_TOO_MANY_PAGING_FILES
-STATUS_TOO_MANY_SECRETS
-STATUS_TOO_MANY_SESSIONS
-STATUS_TOO_MANY_SIDS
-STATUS_TOO_MANY_THREADS
-STATUS_TRANSACTION_ABORTED
-STATUS_TRANSACTION_INVALID_ID
-STATUS_TRANSACTION_INVALID_TYPE
-STATUS_TRANSACTION_NO_MATCH
-STATUS_TRANSACTION_NO_RELEASE
-STATUS_TRANSACTION_RESPONDED
-STATUS_TRANSACTION_TIMED_OUT
-STATUS_TRUSTED_DOMAIN_FAILURE
-STATUS_TRUSTED_RELATIONSHIP_FAILURE
-STATUS_TRUST_FAILURE
-STATUS_UNABLE_TO_DECOMMIT_VM
-STATUS_UNABLE_TO_DELETE_SECTION
-STATUS_UNABLE_TO_FREE_VM
-STATUS_UNABLE_TO_LOCK_MEDIA
-STATUS_UNABLE_TO_UNLOAD_MEDIA
-STATUS_UNDEFINED_CHARACTER
-STATUS_UNEXPECTED_IO_ERROR
-STATUS_UNEXPECTED_MM_CREATE_ERR
-STATUS_UNEXPECTED_MM_EXTEND_ERR
-STATUS_UNEXPECTED_MM_MAP_ERROR
-STATUS_UNEXPECTED_NETWORK_ERROR
-STATUS_UNHANDLED_EXCEPTION
-STATUS_UNKNOWN_REVISION
-STATUS_UNMAPPABLE_CHARACTER
-STATUS_UNRECOGNIZED_MEDIA
-STATUS_UNRECOGNIZED_VOLUME
-STATUS_UNSUCCESSFUL
-STATUS_UNSUPPORTED_COMPRESSION
-STATUS_UNWIND
-STATUS_USER_APC
-STATUS_USER_EXISTS
-STATUS_USER_MAPPED_FILE
-STATUS_USER_SESSION_DELETED
-STATUS_VALIDATE_CONTINUE
-STATUS_VARIABLE_NOT_FOUND
-STATUS_VDM_HARD_ERROR
-STATUS_VERIFY_REQUIRED
-STATUS_VIRTUAL_CIRCUIT_CLOSED
-STATUS_VOLUME_DISMOUNTED
-STATUS_VOLUME_MOUNTED
-STATUS_WAIT_0
-STATUS_WAIT_63
-STATUS_WAKE_SYSTEM_DEBUGGER
-STATUS_WAS_LOCKED
-STATUS_WAS_UNLOCKED
-STATUS_WORKING_SET_LIMIT_RANGE
-STATUS_WORKING_SET_QUOTA
-STATUS_WRONG_PASSWORD
-STATUS_WRONG_PASSWORD_CORE
-STATUS_WRONG_VOLUME
-STATUS_WX86_BREAKPOINT
-STATUS_WX86_CONTINUE
-STATUS_WX86_CREATEWX86TIB
-STATUS_WX86_EXCEPTION_CHAIN
-STATUS_WX86_EXCEPTION_CONTINUE
-STATUS_WX86_EXCEPTION_LASTCHANCE
-STATUS_WX86_FLOAT_STACK_CHECK
-STATUS_WX86_INTERNAL_ERROR
-STATUS_WX86_SINGLE_STEP
-STATUS_WX86_UNSIMULATE
\ No newline at end of file
+++ /dev/null
-FAST_MUTEX
-KPCR
-PEB
-TEB
-SPINLOCK
-APC
-DPC
+++ /dev/null
-What do you think I am, your personal tech support?
-You *know* a %stru% is non-re-entrant, right?
-The answer to that is so simple, I'm not going to waste my time telling you.
-Well, of course... if you're not below DISPATCH_LEVEL, ros is gonna explode on ya when you try to do that ( duh! ).
-I don't think that functionality has been implemented, yet.
-What do you mean it crashed? It can't crash there!
-Wow. That's a new one.
-Ask %dev%, I bet he knows.. he knows everything...
-When's the last time you rebuilt?
-Have you tried a make clean?
-Is it plugged in?
-Well it works on *my* system :P
-Well don't do that, and you won't have that problem.
-Didn't we already fix that?
-Well... I don't know.. I just have that code disabled in my tree.
-Try surrounding it with parenthesis.
-Don't you know going around dereferncing null pointers all day can be hazardous to your health?
-Well, duh!
-There's a bit in cr3 for problems like that.
-Just add a field to the %stru% to keep track of it!
-Don't worry about it... the garbage collector in %module% will clean it up for you.
-Did I do that?
-Didn't %dev% fix that already?
-Yes, I think I've seen that bug before... no... that was another program.
-I could tell you, but then I'd have to unlink() you.
-Well if you'd get some sleep, maybe you'd figure it out... not all of us can keep the hours %dev% can...
-You did what? Uh oh... that can't be good.
-Well... I could tell you, but the answer's pretty complicated. Why don't you wait to read about it in the book I'm writing.
-Yeah, that's happened to me, before, too. All you have to do is wrap it in an SEH block and forget about it.
-Just put a NULL dereference in there and commit it. It helps get bugs fixed fast! (Not that I would know)
-ASSERT is your friend!
-I dunno.. but I bet %dev% could find it for you.
-I hereby declare that code is perfect. Your problem must be elsewhere.
-I wrote that code... it must be perfect.
-$#@!$ One of these days I'm gonna throw %module% out the window!!! Sorry, what were you saying?
-maybe I broke it in my last commit. Maybe I did it on purpose...
-Have you tried debugging it? I got a can of Raid...
-Just delete it, it can't be that important ( You should see all the useless cruft I got rid of in %module% )
-Try queueing a work item...
-My %stru% fell in love with some %stru% in %module%, and %module% has been hell since...
-Maybe the PEB is getting corrupted. Try allocating a new PEB and overwriting the old one. That's what I did last time I had a bug like that.
-Hmm.. that seems to have been introduced by my last commit... I bet CVS mixed up the bits during the commit.
-It can't possibly be my fault, so I don't care.
-I'm not experiencing that problem, perhaps it's all in your mind.
-Well... like a good friend of mine said... "Don't Panic!"
-It just shows you how far ReactOS has come along! A %period% ago a bug like that wouldn't have even been possible!
-Just surround the code with an #if 0/#endif block, it solves all my problems!
-You know.. if %dev% would just finish %module% for us, we wouldn't be having this problem.
-I say we move on to the next function, since we can't seem to figure this one out.
-Well, sure, that would have been my first guess, too.... TEN YEARS AGO :p
-yup, that sounds like a problem.
-If I wanted to talk about VB, I'd go bug Alex...
-ask %dev%
-Thank you for that amazingly keen insight, Commander Obvious.
-Sorry, can't help you right now, trying to track down this bug %dev% caused in %module%
-I dont know about that, but I just fixed a problem in %module% for %dev%
-How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in %module%?
-lol!
-*wink*
-;)
-42
-It's gonna take me over %period% to fix all %dev%'s bugs in %module% :(
-How could %func% return %status%!? It bet %dev% broke it! I didn't touch it... honest! no.. really! (me hides)
-It's fine if you get %status% there ... just ignore the destruction, and call %func% instead.
-%dev% said %status% isn't really an error in this context because we expect %module% to be toast by now
-heh, I'm still trying to figure out why %func% is returning %status% when I call it from %module%...
-%dev% said it's okay to ignore that as long as you're below %irql%
-erm, what do you mean?
-damn, I do that all the time
-if you want a reply that sounds right, I'd say that %func% support for that is vital to the future of %module%
-Sounds like you're having a problem with %func%. I hate that thing... don't talk to me about it.
-Just return %status% and forget about it. Someone else will fix it, later.
-Blah blah blah... sheesh... can't you figure out *anything*?
\ No newline at end of file
+++ /dev/null
-// trim.cpp
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#include "trim.h"
-
-std::string trim ( const std::string& s )
-{
- const char* p = &s[0];
- const char* p2 = p + s.size();
- while ( *p == ' ' )
- p++;
- while ( p2 > p && p2[-1] == ' ' )
- p2--;
- return std::string ( p, p2-p );
-}
-
+++ /dev/null
-// trim.h
-// This file is (C) 2004 Royce Mitchell III
-// and released under the BSD & LGPL licenses
-
-#ifndef TRIM_H
-#define TRIM_H
-
-#include <string>
-
-std::string trim ( const std::string& s );
-
-#endif//TRIM_H
-
+++ /dev/null
-ACCESS_MASK
-ACCESS_STATE
-APC_LEVEL
-ARBITER_ACTION
-ARBITER_ACTION
-ARBITER_CONFLICT_INFO
-ARBITER_FLAG_BOOT_CONFIG
-ARBITER_INTERFACE
-ARBITER_LIST_ENTRY
-ARBITER_PARAMETERS
-ARBITER_PARTIAL
-ARBITER_REQUEST_SOURCE
-ARBITER_RESULT
-AT_EXTENDABLE_FILE
-AT_RESERVED
-AT_ROUND_TO_PAGE
-BOOTDISK_INFORMATION
-BOOTDISK_INFORMATION_EX
-BUS_INTERFACE_STANDARD
-BUS_QUERY_ID_TYPE
-BaseAddresses[PCI_TYPE0_ADDRESSES]
-BaseAddresses[PCI_TYPE1_ADDRESSES]
-CLIENT_ID
-CLOCK1_LEVEL
-CLOCK2_LEVEL
-CM_EISA_FUNCTION_INFORMATION
-CM_EISA_FUNCTION_INFORMATION.FunctionFlags
-CM_EISA_SLOT_INFORMATION
-CM_EISA_SLOT_INFORMATION.ReturnCode
-CM_FLOPPY_DEVICE_DATA
-CM_FULL_RESOURCE_DESCRIPTOR
-CM_INT13_DRIVE_PARAMETER
-CM_KEYBOARD_DEVICE_DATA
-CM_MCA_POS_DATA
-CM_PARTIAL_RESOURCE_DESCRIPTOR
-CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags
-CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition
-CM_PARTIAL_RESOURCE_DESCRIPTOR.Type
-CM_PARTIAL_RESOURCE_LIST
-CM_POWER_DATA
-CM_RESOURCE_DMA_16
-CM_RESOURCE_DMA_32
-CM_RESOURCE_DMA_8
-CM_RESOURCE_DMA_8_AND_16
-CM_RESOURCE_DMA_BUS_MASTER
-CM_RESOURCE_DMA_TYPE_A
-CM_RESOURCE_DMA_TYPE_B
-CM_RESOURCE_DMA_TYPE_F
-CM_RESOURCE_INTERRUPT_LATCHED
-CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
-CM_RESOURCE_LIST
-CM_RESOURCE_MEMORY_24
-CM_RESOURCE_MEMORY_CACHEABLE
-CM_RESOURCE_MEMORY_COMBINEDWRITE
-CM_RESOURCE_MEMORY_PREFETCHABLE
-CM_RESOURCE_MEMORY_READ_ONLY
-CM_RESOURCE_MEMORY_READ_WRITE
-CM_RESOURCE_MEMORY_WRITE_ONLY
-CM_RESOURCE_PORT_10_BIT_DECODE
-CM_RESOURCE_PORT_12_BIT_DECODE
-CM_RESOURCE_PORT_16_BIT_DECODE
-CM_RESOURCE_PORT_IO
-CM_RESOURCE_PORT_MEMORY
-CM_RESOURCE_PORT_PASSIVE_DECODE
-CM_RESOURCE_PORT_POSITIVE_DECODE
-CM_RESOURCE_PORT_WINDOW_DECODE
-CM_SCSI_DEVICE_DATA
-CM_SERIAL_DEVICE_DATA
-CM_SHARE_DISPOSITION
-CONFIGURATION_INFORMATION
-CONFIGURATION_TYPE
-CONFIGURATION_TYPE
-CONTAINING_RECORD
-CONTROLLER_OBJECT
-CREATE_DISK
-CREATE_DISK_GPT
-CREATE_DISK_MBR
-CREATE_FILE_TYPE
-CREATE_FILE_TYPE
-DBG_STATUS_BUGCHECK_FIRST
-DBG_STATUS_BUGCHECK_SECOND
-DBG_STATUS_CONTROL_C
-DBG_STATUS_DEBUG_CONTROL
-DBG_STATUS_FATAL
-DBG_STATUS_SYSRQ
-DBG_STATUS_WORKER
-DEVICE_CAPABILITIES
-DEVICE_DESCRIPTION
-DEVICE_DESCRIPTION.Version
-DEVICE_DESCRIPTION_VERSION
-DEVICE_DESCRIPTION_VERSION1
-DEVICE_DESCRIPTION_VERSION2
-DEVICE_INTERFACE_CHANGE_NOTIFICATION
-DEVICE_OBJECT
-DEVICE_OBJECT.AlignmentRequirement
-DEVICE_OBJECT.Characteristics
-DEVICE_OBJECT.DeviceType
-DEVICE_OBJECT.Flags
-DEVICE_POWER_STATE
-DEVICE_REGISTRY_PROPERTY
-DEVICE_REGISTRY_PROPERTY
-DEVICE_RELATIONS
-DEVICE_RELATION_TYPE
-DEVICE_RELATION_TYPE
-DEVICE_TEXT_TYPE
-DEVICE_TYPE
-DEVICE_USAGE_NOTIFICATION_TYPE
-DIRECTORY_ALL_ACCESS
-DIRECTORY_CREATE_OBJECT
-DIRECTORY_CREATE_SUBDIRECTORY
-DIRECTORY_QUERY
-DIRECTORY_TRAVERSE
-DISK_SIGNATURE
-DISPATCHER_HEADER
-DISPATCH_LEVEL
-DMA_ADAPTER
-DMA_CONFIGURATION_BYTE0
-DMA_CONFIGURATION_BYTE1
-DMA_OPERATIONS
-DMA_SPEED
-DMA_WIDTH
-DO_BUFFERED_IO
-DO_BUS_ENUMERATED_DEVICE
-DO_DEVICE_HAS_NAME
-DO_DEVICE_INITIALIZING
-DO_DIRECT_IO
-DO_EXCLUSIVE
-DO_LONG_TERM_REQUESTS
-DO_LOW_PRIORITY_FILESYSTEM
-DO_MAP_IO_BUFFER
-DO_NEVER_LAST_DEVICE
-DO_POWER_INRUSH
-DO_POWER_PAGABLE
-DO_SHUTDOWN_REGISTERED
-DO_SYSTEM_BOOT_PARTITION
-DO_VERIFY_VOLUME
-DRIVER_EXTENSION
-DRIVER_OBJECT
-DRIVER_VERIFIER_FORCE_IRQL_CHECKING
-DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES
-DRIVER_VERIFIER_IO_CHECKING
-DRIVER_VERIFIER_SPECIAL_POOLING
-DRIVER_VERIFIER_THUNK_PAIRS
-DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS
-DRIVE_LAYOUT_INFORMATION_GPT
-DRIVE_LAYOUT_INFORMATION_MBR
-DUPLICATE_CLOSE_SOURCE
-DUPLICATE_SAME_ACCESS
-DUPLICATE_SAME_ATTRIBUTES
-EFLAG_SELECT
-EFLAG_SIGN
-EFLAG_ZERO
-EISA_DMA_CONFIGURATION
-EISA_EMPTY_SLOT
-EISA_FREE_FORM_DATA
-EISA_FUNCTION_ENABLED
-EISA_HAS_DMA_ENTRY
-EISA_HAS_INFORMATION
-EISA_HAS_IRQ_ENTRY
-EISA_HAS_MEMORY_ENTRY
-EISA_HAS_PORT_INIT_ENTRY
-EISA_HAS_PORT_RANGE
-EISA_HAS_TYPE_ENTRY
-EISA_INVALID_BIOS_CALL
-EISA_INVALID_CONFIGURATION
-EISA_INVALID_FUNCTION
-EISA_INVALID_SLOT
-EISA_IRQ_CONFIGURATION
-EISA_IRQ_DESCRIPTOR
-EISA_MEMORY_CONFIGURATION
-EISA_MEMORY_TYPE
-EISA_PORT_CONFIGURATION
-EISA_PORT_DESCRIPTOR
-ERESOURCE_THREAD
-ES_CONTINUOUS
-ES_DISPLAY_REQUIRED
-ES_SYSTEM_REQUIRED
-ES_USER_PRESENT
-EVENT_INCREMENT
-EVENT_TYPE
-EVENT_TYPE
-EXECUTION_STATE
-EX_POOL_PRIORITY
-EX_POOL_PRIORITY
-FAST_IO_DISPATCH
-FAST_MUTEX
-FIELD_OFFSET
-FILE_128_BYTE_ALIGNMENT
-FILE_256_BYTE_ALIGNMENT
-FILE_32_BYTE_ALIGNMENT
-FILE_512_BYTE_ALIGNMENT
-FILE_64_BYTE_ALIGNMENT
-FILE_ADD_FILE
-FILE_ADD_SUBDIRECTORY
-FILE_ALIGNMENT_INFORMATION
-FILE_ALL_ACCESS
-FILE_ANY_ACCESS
-FILE_APPEND_DATA
-FILE_ATTRIBUTE_ARCHIVE
-FILE_ATTRIBUTE_COMPRESSED
-FILE_ATTRIBUTE_DEVICE
-FILE_ATTRIBUTE_DIRECTORY
-FILE_ATTRIBUTE_ENCRYPTED
-FILE_ATTRIBUTE_HIDDEN
-FILE_ATTRIBUTE_NORMAL
-FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
-FILE_ATTRIBUTE_OFFLINE
-FILE_ATTRIBUTE_READONLY
-FILE_ATTRIBUTE_REPARSE_POINT
-FILE_ATTRIBUTE_SPARSE_FILE
-FILE_ATTRIBUTE_SYSTEM
-FILE_ATTRIBUTE_TAG_INFORMATION
-FILE_ATTRIBUTE_TEMPORARY
-FILE_ATTRIBUTE_VALID_FLAGS
-FILE_ATTRIBUTE_VALID_SET_FLAGS
-FILE_AUTOGENERATED_DEVICE_NAME
-FILE_BASIC_INFORMATION
-FILE_BYTE_ALIGNMENT
-FILE_COMPLETE_IF_OPLOCKED
-FILE_COPY_STRUCTURED_STORAGE
-FILE_CREATE
-FILE_CREATED
-FILE_CREATE_PIPE_INSTANCE
-FILE_CREATE_TREE_CONNECTION
-FILE_DELETE_CHILD
-FILE_DELETE_ON_CLOSE
-FILE_DEVICE_8042_PORT
-FILE_DEVICE_ACPI
-FILE_DEVICE_BATTERY
-FILE_DEVICE_BEEP
-FILE_DEVICE_BUS_EXTENDER
-FILE_DEVICE_CD_ROM
-FILE_DEVICE_CD_ROM_FILE_SYSTEM
-FILE_DEVICE_CHANGER
-FILE_DEVICE_CONTROLLER
-FILE_DEVICE_DATALINK
-FILE_DEVICE_DFS
-FILE_DEVICE_DFS_FILE_SYSTEM
-FILE_DEVICE_DFS_VOLUME
-FILE_DEVICE_DISK
-FILE_DEVICE_DISK_FILE_SYSTEM
-FILE_DEVICE_DVD
-FILE_DEVICE_FILE_SYSTEM
-FILE_DEVICE_FIPS
-FILE_DEVICE_FULLSCREEN_VIDEO
-FILE_DEVICE_INPORT_PORT
-FILE_DEVICE_IS_MOUNTED
-FILE_DEVICE_KEYBOARD
-FILE_DEVICE_KS
-FILE_DEVICE_KSEC
-FILE_DEVICE_MAILSLOT
-FILE_DEVICE_MASS_STORAGE
-FILE_DEVICE_MIDI_IN
-FILE_DEVICE_MIDI_OUT
-FILE_DEVICE_MODEM
-FILE_DEVICE_MOUSE
-FILE_DEVICE_MULTI_UNC_PROVIDER
-FILE_DEVICE_NAMED_PIPE
-FILE_DEVICE_NETWORK
-FILE_DEVICE_NETWORK_BROWSER
-FILE_DEVICE_NETWORK_FILE_SYSTEM
-FILE_DEVICE_NETWORK_REDIRECTOR
-FILE_DEVICE_NULL
-FILE_DEVICE_PARALLEL_PORT
-FILE_DEVICE_PHYSICAL_NETCARD
-FILE_DEVICE_PRINTER
-FILE_DEVICE_SCANNER
-FILE_DEVICE_SCREEN
-FILE_DEVICE_SECURE_OPEN
-FILE_DEVICE_SERENUM
-FILE_DEVICE_SERIAL_MOUSE_PORT
-FILE_DEVICE_SERIAL_PORT
-FILE_DEVICE_SMARTCARD
-FILE_DEVICE_SMB
-FILE_DEVICE_SOUND
-FILE_DEVICE_STREAMS
-FILE_DEVICE_TAPE
-FILE_DEVICE_TAPE_FILE_SYSTEM
-FILE_DEVICE_TERMSRV
-FILE_DEVICE_TRANSPORT
-FILE_DEVICE_UNKNOWN
-FILE_DEVICE_VDM
-FILE_DEVICE_VIDEO
-FILE_DEVICE_VIRTUAL_DISK
-FILE_DEVICE_WAVE_IN
-FILE_DEVICE_WAVE_OUT
-FILE_DIRECTORY_FILE
-FILE_DISPOSITION_INFORMATION
-FILE_DOES_NOT_EXIST
-FILE_END_OF_FILE_INFORMATION
-FILE_EXECUTE
-FILE_EXISTS
-FILE_FLOPPY_DISKETTE
-FILE_FS_DEVICE_INFORMATION
-FILE_FULL_EA_INFORMATION
-FILE_GENERIC_EXECUTE
-FILE_GENERIC_READ
-FILE_GENERIC_WRITE
-FILE_INFORMATION_CLASS
-FILE_INFORMATION_CLASS
-FILE_LIST_DIRECTORY
-FILE_LONG_ALIGNMENT
-FILE_MAXIMUM_DISPOSITION
-FILE_NAME_INFORMATION
-FILE_NETWORK_OPEN_INFORMATION
-FILE_NON_DIRECTORY_FILE
-FILE_NO_COMPRESSION
-FILE_NO_EA_KNOWLEDGE
-FILE_NO_INTERMEDIATE_BUFFERING
-FILE_OBJECT.Flags
-FILE_OBJECT
-FILE_OCTA_ALIGNMENT
-FILE_OPEN
-FILE_OPENED
-FILE_OPEN_BY_FILE_ID
-FILE_OPEN_FOR_BACKUP_INTENT
-FILE_OPEN_FOR_FREE_SPACE_QUERY
-FILE_OPEN_FOR_RECOVERY
-FILE_OPEN_IF
-FILE_OPEN_NO_RECALL
-FILE_OPEN_REPARSE_POINT
-FILE_OVERWRITE
-FILE_OVERWRITE_IF
-FILE_OVERWRITTEN
-FILE_POSITION_INFORMATION
-FILE_QUAD_ALIGNMENT
-FILE_RANDOM_ACCESS
-FILE_READ_ACCESS
-FILE_READ_ATTRIBUTES
-FILE_READ_DATA
-FILE_READ_EA
-FILE_READ_ONLY_DEVICE
-FILE_REMOTE_DEVICE
-FILE_REMOVABLE_MEDIA
-FILE_RESERVE_OPFILTER
-FILE_SEQUENTIAL_ONLY
-FILE_SHARE_DELETE
-FILE_SHARE_READ
-FILE_SHARE_VALID_FLAGS
-FILE_SHARE_WRITE
-FILE_SPECIAL_ACCESS
-FILE_STANDARD_INFORMATION
-FILE_STRUCTURED_STORAGE
-FILE_SUPERSEDE
-FILE_SUPERSEDED
-FILE_SYNCHRONOUS_IO_ALERT
-FILE_SYNCHRONOUS_IO_NONALERT
-FILE_TRAVERSE
-FILE_USE_FILE_POINTER_POSITION
-FILE_VALID_DATA_LENGTH_INFORMATION
-FILE_VALID_MAILSLOT_OPTION_FLAGS
-FILE_VALID_OPTION_FLAGS
-FILE_VALID_PIPE_OPTION_FLAGS
-FILE_VALID_SET_FLAGS
-FILE_VIRTUAL_VOLUME
-FILE_WORD_ALIGNMENT
-FILE_WRITE_ACCESS
-FILE_WRITE_ATTRIBUTES
-FILE_WRITE_DATA
-FILE_WRITE_EA
-FILE_WRITE_ONCE_MEDIA
-FILE_WRITE_THROUGH
-FILE_WRITE_TO_END_OF_FILE
-FO_ALERTABLE_IO
-FO_CACHE_SUPPORTED
-FO_CLEANUP_COMPLETE
-FO_DELETE_ON_CLOSE
-FO_DIRECT_DEVICE_OPEN
-FO_FILE_FAST_IO_READ
-FO_FILE_MODIFIED
-FO_FILE_OBJECT_HAS_EXTENSION
-FO_FILE_OPEN
-FO_FILE_OPEN_CANCELLED
-FO_FILE_SIZE_CHANGED
-FO_GENERATE_AUDIT_ON_CLOSE
-FO_HANDLE_CREATED
-FO_MAILSLOT
-FO_NAMED_PIPE
-FO_NO_INTERMEDIATE_BUFFERING
-FO_OPENED_CASE_SENSITIVE
-FO_RANDOM_ACCESS
-FO_REMOTE_ORIGIN
-FO_SEQUENTIAL_ONLY
-FO_STREAM_FILE
-FO_SYNCHRONOUS_IO
-FO_TEMPORARY_FILE
-FO_VOLUME_OPEN
-FO_WRITE_THROUGH
-FS_INFORMATION_CLASS
-GENERAL_LOOKASIDE
-GENERAL_LOOKASIDE_S
-HASH_STRING_ALGORITHM_DEFAULT
-HASH_STRING_ALGORITHM_INVALID
-HASH_STRING_ALGORITHM_X65599
-HIGH_LEVEL
-HIGH_PRIORITY
-HWPROFILE_CHANGE_NOTIFICATION
-IMAGE_ADDRESSING_MODE_32BIT
-IMAGE_INFO
-INITIAL_PRIVILEGE_COUNT
-INITIAL_PRIVILEGE_SET
-INTERFACE_TYPE
-INTERFACE_TYPE
-INTERLOCKED_RESULT
-IO_ALLOCATION_ACTION
-IO_ALLOCATION_ACTION
-IO_CD_ROM_INCREMENT
-IO_COMPLETION_CONTEXT
-IO_CSQ
-IO_CSQ_IRP_CONTEXT
-IO_DISK_INCREMENT
-IO_ERROR_LOG_PACKET
-IO_KEYBOARD_INCREMENT
-IO_MAILSLOT_INCREMENT
-IO_MOUSE_INCREMENT
-IO_NAMED_PIPE_INCREMENT
-IO_NETWORK_INCREMENT
-IO_NOTIFICATION_EVENT_CATEGORY
-IO_NOTIFICATION_EVENT_CATEGORY
-IO_NO_INCREMENT
-IO_PARALLEL_INCREMENT
-IO_REMOVE_LOCK
-IO_REMOVE_LOCK_COMMON_BLOCK
-IO_REMOVE_LOCK_DBG_BLOCK
-IO_RESOURCE_ALTERNATIVE
-IO_RESOURCE_DEFAULT
-IO_RESOURCE_DESCRIPTOR
-IO_RESOURCE_DESCRIPTOR
-IO_RESOURCE_DESCRIPTOR.Option
-IO_RESOURCE_LIST
-IO_RESOURCE_PREFERRED
-IO_RESOURCE_REQUIREMENTS_LIST
-IO_SECURITY_CONTEXT
-IO_SERIAL_INCREMENT
-IO_SOUND_INCREMENT
-IO_STACK_LOCATION
-IO_STACK_LOCATION.Control
-IO_STATUS_BLOCK
-IO_VIDEO_INCREMENT
-IPI_LEVEL
-IRP_MJ_CLEANUP
-IRP_MJ_CLOSE
-IRP_MJ_CREATE
-IRP_MJ_CREATE_MAILSLOT
-IRP_MJ_CREATE_NAMED_PIPE
-IRP_MJ_DEVICE_CHANGE
-IRP_MJ_DEVICE_CONTROL
-IRP_MJ_DIRECTORY_CONTROL
-IRP_MJ_FILE_SYSTEM_CONTROL
-IRP_MJ_FLUSH_BUFFERS
-IRP_MJ_INTERNAL_DEVICE_CONTROL
-IRP_MJ_LOCK_CONTROL
-IRP_MJ_MAXIMUM_FUNCTION
-IRP_MJ_PNP
-IRP_MJ_PNP_POWER
-IRP_MJ_POWER
-IRP_MJ_QUERY_EA
-IRP_MJ_QUERY_INFORMATION
-IRP_MJ_QUERY_QUOTA
-IRP_MJ_QUERY_SECURITY
-IRP_MJ_QUERY_VOLUME_INFORMATION
-IRP_MJ_READ
-IRP_MJ_SCSI
-IRP_MJ_SET_EA
-IRP_MJ_SET_INFORMATION
-IRP_MJ_SET_QUOTA
-IRP_MJ_SET_SECURITY
-IRP_MJ_SET_VOLUME_INFORMATION
-IRP_MJ_SHUTDOWN
-IRP_MJ_SYSTEM_CONTROL
-IRP_MJ_WRITE
-IRP_MN_CANCEL_REMOVE_DEVICE
-IRP_MN_CANCEL_STOP_DEVICE
-IRP_MN_CHANGE_SINGLE_INSTANCE
-IRP_MN_CHANGE_SINGLE_ITEM
-IRP_MN_COMPLETE
-IRP_MN_COMPLETE_MDL
-IRP_MN_COMPLETE_MDL_DPC
-IRP_MN_COMPRESSED
-IRP_MN_DEVICE_USAGE_NOTIFICATION
-IRP_MN_DISABLE_COLLECTION
-IRP_MN_DISABLE_EVENTS
-IRP_MN_DPC
-IRP_MN_EJECT
-IRP_MN_ENABLE_COLLECTION
-IRP_MN_ENABLE_EVENTS
-IRP_MN_EXECUTE_METHOD
-IRP_MN_FILTER_RESOURCE_REQUIREMENTS
-IRP_MN_KERNEL_CALL
-IRP_MN_LOAD_FILE_SYSTEM
-IRP_MN_LOCK
-IRP_MN_MDL
-IRP_MN_MDL_DPC
-IRP_MN_MOUNT_VOLUME
-IRP_MN_NORMAL
-IRP_MN_NOTIFY_CHANGE_DIRECTORY
-IRP_MN_POWER_SEQUENCE
-IRP_MN_QUERY_ALL_DATA
-IRP_MN_QUERY_BUS_INFORMATION
-IRP_MN_QUERY_CAPABILITIES
-IRP_MN_QUERY_DEVICE_RELATIONS
-IRP_MN_QUERY_DEVICE_TEXT
-IRP_MN_QUERY_DIRECTORY
-IRP_MN_QUERY_ID
-IRP_MN_QUERY_INTERFACE
-IRP_MN_QUERY_LEGACY_BUS_INFORMATION
-IRP_MN_QUERY_PNP_DEVICE_STATE
-IRP_MN_QUERY_POWER
-IRP_MN_QUERY_REMOVE_DEVICE
-IRP_MN_QUERY_RESOURCES
-IRP_MN_QUERY_RESOURCE_REQUIREMENTS
-IRP_MN_QUERY_SINGLE_INSTANCE
-IRP_MN_QUERY_STOP_DEVICE
-IRP_MN_READ_CONFIG
-IRP_MN_REGINFO
-IRP_MN_REGINFO_EX
-IRP_MN_REMOVE_DEVICE
-IRP_MN_SCSI_CLASS
-IRP_MN_SET_LOCK
-IRP_MN_SET_POWER
-IRP_MN_START_DEVICE
-IRP_MN_STOP_DEVICE
-IRP_MN_SURPRISE_REMOVAL
-IRP_MN_TRACK_LINK
-IRP_MN_UNLOCK_ALL
-IRP_MN_UNLOCK_ALL_BY_KEY
-IRP_MN_UNLOCK_SINGLE
-IRP_MN_USER_FS_REQUEST
-IRP_MN_VERIFY_VOLUME
-IRP_MN_WAIT_WAKE
-IRP_MN_WRITE_CONFIG
-KBUGCHECK_BUFFER_DUMP_STATE
-KBUGCHECK_CALLBACK_RECORD
-KDEVICE_QUEUE
-KDEVICE_QUEUE_ENTRY
-KDPC_DATA
-KDPC_IMPORTANCE
-KDPC_IMPORTANCE
-KD_DEBUGGER_ENABLED
-KD_DEBUGGER_NOT_PRESENT
-KEYBOARD_ALT_KEY_DOWN
-KEYBOARD_CAPS_LOCK_ON
-KEYBOARD_CTRL_KEY_DOWN
-KEYBOARD_INSERT_ON
-KEYBOARD_LEFT_SHIFT_DOWN
-KEYBOARD_NUM_LOCK_ON
-KEYBOARD_RIGHT_SHIFT_DOWN
-KEYBOARD_SCROLL_LOCK_ON
-KEY_BASIC_INFORMATION
-KEY_FULL_INFORMATION
-KEY_INFORMATION_CLASS
-KEY_INFORMATION_CLASS
-KEY_NODE_INFORMATION
-KEY_VALUE_BASIC_INFORMATION
-KEY_VALUE_ENTRY
-KEY_VALUE_FULL_INFORMATION
-KEY_VALUE_INFORMATION_CLASS
-KEY_VALUE_INFORMATION_CLASS
-KEY_VALUE_PARTIAL_INFORMATION
-KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
-KEY_VALUE_Xxx.Type
-KFLOATING_SAVE
-KINTERRUPT_MODE
-KINTERRUPT_MODE
-KI_USER_SHARED_DATA
-KLOCK_QUEUE_HANDLE
-KPCR_TIB
-KPROCESSOR_MODE
-KPROFILE_SOURCE
-KSPIN_LOCK_QUEUE
-KSPIN_LOCK_QUEUE_NUMBER
-KWAIT_BLOCK
-KWAIT_REASON
-KWAIT_REASON
-LARGE_INTEGER
-LOCK_OPERATION
-LOCK_OPERATION
-LOCK_QUEUE_OWNER
-LOCK_QUEUE_WAIT
-LOW_LEVEL
-LOW_PRIORITY
-LO