/* CPPDOC_BEGIN_EXCLUDE */ /*************************************************************************** OxYD Socket v0.1 File : OxYDSocket.h Versions : - v0.1 (20/01/2003) : Initial release --------------------------------------------------------------------------- Copyright (C) 2003 Grégory WILMES -- Engage Security (http://www.engagesecurity.com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ /* CPPDOC_END_EXCLUDE */ #ifndef __COXYDSOCKET_H #define __COXYDSOCKET_H #include "stdafx.h" // Error codes #ifndef OXYDSOCKET_ERRORS #define OXYDSOCKET_ERRORS enum Errors // Declare enum type Errors { ERROR__UNKNOWN_ERROR, // = 0 by default // ERROR__UNABLE_TO_CREATE_VALUE_KEY, ERROR__UNABLE_TO_QUERY_VALUE_FROM_REGISTRY, ERROR__UNABLE_TO_FIND_BROWSER_RUNNING_DIRECTORY, ERROR__WRONG_DEFAULT_BROWSER, ERROR__UNABLE_TO_CREATE_A_NEW_PROCESS, ERROR__FAILED_TO_ENUMERATES_ALL_TOPLEVEL_WINDOWS, ERROR__FAILED_TO_FIND_BROWSER_WINDOW, ERROR__UNABLE_TO_TERMINATE_THE_PROCESS, ERROR__THE_BROWSER_IS_NOT_RUNNING }; #endif #define BROWSER " - Microsoft Internet Explorer" #define BROWSER_EXE "iexplore.exe" /** * stat * * Structure used to store windows handles. */ typedef struct { HWND hWnd; // CString strText; } stat; /** * class COxYDSocket * * Basic class. */ class COxYDSocket { HWND m_hWnd, m_hWndUrl; CWnd *m_pWnd, *m_pWndUrl; RECT m_Rect; int m_nLastError; BOOL m_bBrowserRunning; CString m_strRemoteAddress, m_strRemotePort; CString m_strWindowOldText; public: COxYDSocket(); ~COxYDSocket(); BOOL IsBrowserRunning(); BOOL Connect(CString strRemoteAddr, CString strRemotePort); BOOL Connect(CString strRemoteAddress, unsigned short nRemotePort); BOOL ShutDown(); BOOL SendRaw(CString strTxt); BOOL ReceiveRaw(CString &strTxt); CString GetRemoteAddress(); CString GetRemotePort(); int GetLastError(); CString FormatMessage(int nLastError = -1); }; #endif