typedef struct GS {
// Application Common Base //
WORD nSize; // The Size of this Structure (bytes)
// An Easy way to detect the version
// of the Global Structure.
VARS gv; // Variables
FCT fct; // Functions
API api; // APIs
STR str; // Strings
LOG *Log; // Logging Stuff.
// End Common Base //
SRV *srv; // Server Context.
CLI *cli; // Client Context.
CFG *cfg; // Configuration Tool Context.
DWORD dwRes; // Nothing yet, just to have 4 byte here :).
} GS;
全局结构,其中包括nSize(全局结构体的大小,这样容易判断版本),VARS(变量结构),FCT(函数结构,构架所使用的函数),API(所使用的API函数),STR(定义字符串),LOG(日志结构),SRV(服务器上下文结构),CLI(客户端上下文结构),CFG(配置工具上下文结构),dwRes(保留字)
typedef struct _VARS {
WORD wHiBOVer; // Major BOXP Version.
WORD wLoBOVer; // Minor BOXP Version.
// Control Variables.
bool bIsBoxpRun; // Set it to - false - when want to end the BOXP App.
bool bIsBoxpReset; // Set it to - true - when want to restart the BOXP App.
bool bDelete; // Set it to - true - when want to remove the BOXP file and related system changes.
bool bIsWinNT; // OS type.
// we should more members to other O.S.s
bool bStarting; // Is the FrameWork starting.
bool bStopping; // Is the FrameWork stopping.
bool bEnableLogging; // Use Logging Service.
bool bInifile; // Use .ini file?
HINSTANCE hBaseAddress; // Pointer to the image in Memory.
char * lpCmdLine; // Pointer to the command line.
char lpThisFile[MAX_PATH]; // Path to this execuable file.
char lpThisPath[MAX_PATH]; // The path where we are running.
char lpIniFile[MAX_PATH]; // Path of the .ini file, used to save the config.
// Core Config.
char * pStrConfig; // Pointer to the Core Configuration String, if there is one
unsigned long nCfgLen; // Configuration Len.
DWORD dwErr; // FrameWork last error.
HANDLE hHeap; // Handle to this proccess heap.
OSVERSIONINFO osvi; // Contains operating system version information.
DWORD *pCrc32Table; // Pointer to the CRC32 Table.
IMAGE_PARAMETERS *g_pImageParamHead;
CRITICAL_SECTION g_PluginsCrit; // Plugins Repository Critical Section.
CRITICAL_SECTION g_ThreadsCrit; // Threads Repository Critical Section.
CRITICAL_SECTION g_DLLCrit; // Dll Critical Section
CRITICAL_SECTION g_LzhCrit; // Compression Critical Section,
// to avoid crashes because this LZHComp is a shared object.
// LZH COMPRESS TABLES -------------
BYTE p_len [64];
BYTE p_code[64];
BYTE d_code[256];
BYTE d_len [256];
struct LzhComp *Lzc; // Compression Engine
// Handlers
struct EncryptionHandler *EncHandler; // Encryption Handler
struct IOHandler *IOHandler; // Input/Output Engine Handler
struct AuthHandler *AuthHandler; // Auth Handler
#ifdef WIN32
PERF_CTX ntctx; // NT Process Lister Stuff
#endif
LANG_INFO *pLangInfos[MAX_LANGS]; // Languages Infos.
unsigned short nLangCount; // Number of Languages registered.
BOFILEDEL *pDelFiles; // Delete Files infos (the black list! :p ).
// These files will be deleted when the Engine shutdowns.
FUNC_INFO *pFuncs; // Custom Function Infos.
// Plug-ins stuff ---------------------------
PLUGIN_INFO *PlugInfo[MAX_PLUGS]; // Plugin Information Table
WORD nPluginCount; // Number of Plugins loaded.
VARIABLE_INFO *pPlugVars[MAX_VARS]; // Plugin Configuration Vars.
WORD nPlugVars; // Number of Plugin Config. Vars.
THREAD_INFO *pThreadInfo[MAX_THREADS]; // Extra Threads.
WORD nThreads; // Number of Extra Threas.
DWORD dwHoldrand; // Random number...
HMODULE hLibs[ LIBNUM ]; // Libary Handles.
char szStr[ 4620 ]; // All Strings stored here.
DWORD nStrLen; // Strings size.
// * When the boxp v1.0 final release will be
// completed, I want to have some space for
// future modifications, without rebuild all
// binaries.
DWORD lpReserved1; // not used.
DWORD lpReserved2; // not used.
DWORD lpReserved3; // not used.
DWORD lpReserved4; // not used.
} VARS;
包括了很多内容