Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Utils.h File Reference

#include <abuse/Dnsbl.h>
#include <abuse/RegKey.h>
#include <abuse/SysError.h>
#include <string>
#include <list>
#include "PropertiesNames.h"

Go to the source code of this file.


#define isDlgItemEnabled(hDlg, id)   isWindowEnabled(GetDlgItem(hDlg,id))
#define enableDlgItem(hDlg, id, b)   EnableWindow(GetDlgItem(hDlg,id),(BOOL)b)
#define getDlgItemTextLength(hDlg, id)   GetWindowTextLength(GetDlgItem(hDlg,id))


RegKey * initReg (const std::string &name) throw (SysError)
std::string getOpenFileName (HWND hOwner, const std::string &initialfile="", const char *patterns=NULL, const std::string &title="")
std::string getSaveFileName (HWND hOwner, const std::string &initialfile="", const char *patterns=NULL, const std::string &title="")
std::string loadString (int ID) throw (SysError)
const std::string & getAbuseExePath ()
const std::string & getAbuseDataPath ()
RECT getDlgItemRect (HWND hDlg, DWORD id) throw (SysError)
bool isNtKernel ()
void EnableDefault (HWND hDlg, int ID)
void DisableDefault (HWND hDlg, int ID)
void populateComboWithResults (HWND hCombo)
__inline bool isWindowEnabled (HWND hWnd)
__inline BOOL setDlgItemText (HWND hDlg, int id, const std::string &str)
std::string getWindowText (HWND hWnd)
__inline std::string getDlgItemText (HWND hWnd, int id)
__inline int MessageBox (HWND hWnd, std::string text, std::string caption, UINT uType)
__inline std::string addreturn (const std::string &str)
__inline std::string skipreturn (const std::string &str)
__inline WNDPROC subclass (HWND hWnd, WNDPROC newWinProc)
__inline std::string resultToPropName (Result r)
__inline std::string resultToPropSubjName (Result r)
std::string encode (const std::string &str)
std::string decode (const std::string &str)
std::list< UrlRange > listStringToListUrlRange (const std::list< std::string > &)
std::list< std::string > listUrlRangeToListString (const std::list< UrlRange > &)
std::pair< std::string, std::string > splitString (const std::string &str, const char sep='-') throw (std::logic_error)
BOOL MakeSureDirectoryPathExists (PCSTR DirPath)
 Inner version of MakeSureDirectoryPathExists.

Define Documentation

#define enableDlgItem hDlg,
 )     EnableWindow(GetDlgItem(hDlg,id),(BOOL)b)

#define getDlgItemTextLength hDlg,
id   )     GetWindowTextLength(GetDlgItem(hDlg,id))

#define isDlgItemEnabled hDlg,
id   )     isWindowEnabled(GetDlgItem(hDlg,id))

Function Documentation

__inline std::string addreturn const std::string &  str  ) 

std::string decode const std::string &  str  ) 

void DisableDefault HWND  hDlg,
int  ID

void EnableDefault HWND  hDlg,
int  ID

std::string encode const std::string &  str  ) 

const std::string& getAbuseDataPath  ) 

const std::string& getAbuseExePath  ) 

RECT getDlgItemRect HWND  hDlg,
throw (SysError)

__inline std::string getDlgItemText HWND  hWnd,
int  id

std::string getOpenFileName HWND  hOwner,
const std::string &  initialfile = "",
const char *  patterns = NULL,
const std::string &  title = ""

std::string getSaveFileName HWND  hOwner,
const std::string &  initialfile = "",
const char *  patterns = NULL,
const std::string &  title = ""

std::string getWindowText HWND  hWnd  ) 

RegKey* initReg const std::string &  name  )  throw (SysError)

bool isNtKernel  ) 

__inline bool isWindowEnabled HWND  hWnd  ) 

std::list<UrlRange> listStringToListUrlRange const std::list< std::string > &   ) 

This pair of functions are used to convert from a list<UrlRange> to a list<string> (formatted "ipfrom-ipto", with no spaces in between) and viceversa. The conversion is needed while handling the list of trusted net ranges, which is stored in the registry as a list<string>, but it's used at runtime as a list<UrlRange>. See the notes in main.cpp:line 224

std::list<std::string> listUrlRangeToListString const std::list< UrlRange > &   ) 

std::string loadString int  ID  )  throw (SysError)

BOOL MakeSureDirectoryPathExists PCSTR  DirPath  ) 

Inner version of MakeSureDirectoryPathExists.

As MakeSureDirectoryPathExists is exported by DbgHelp, which is freely redistributable but not preset in all standard windows installation, I've rewritten a personal version of it

__inline int MessageBox HWND  hWnd,
std::string  text,
std::string  caption,
UINT  uType

void populateComboWithResults HWND  hCombo  ) 

__inline std::string resultToPropName Result  r  ) 

__inline std::string resultToPropSubjName Result  r  ) 

__inline BOOL setDlgItemText HWND  hDlg,
int  id,
const std::string &  str

__inline std::string skipreturn const std::string &  str  ) 

std::pair<std::string,std::string> splitString const std::string &  str,
const char  sep = '-'
throw (std::logic_error)

This function splits a string in the format "first<sep>second" into a couple of strings: pair<string,string>(first,second). In the release version there's no error checking

__inline WNDPROC subclass HWND  hWnd,
WNDPROC  newWinProc

Generated on Thu Jun 16 00:13:25 2005 for Abuse! by  doxygen 1.4.3