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

Utils.cpp File Reference

#include <stdexcept>
#include <memory>
#include <map>
#include <abuse/Base64.h>
#include <abuse/Utils.h>
#include <abuse/UrlRange.h>
#include <algorithm>
#include "Utils.h"
#include "Resource.h"
#include <shlobj.h>

Defines

#define BUFFER_SIZE   0x1000

Functions

RegKey * initReg (const string &name) throw (SysError)
std::string loadString (int ID) throw (SysError)
RECT getDlgItemRect (HWND hDlg, DWORD id) throw (SysError)
string getWindowText (HWND hWnd)
OPENFILENAME internalInitFileName (HWND hOwner, const std::string &initial, const char *patterns, const string &title)
string getOpenFileName (HWND hOwner, const std::string &initial, const char *patterns, const string &title)
std::string getSaveFileName (HWND hOwner, const std::string &initialfile, const char *patterns, const std::string &title)
const std::string & getAbuseExePath ()
const std::string & getAbuseDataPath () throw (std::runtime_error)
bool isNtKernel ()
string encode (const std::string &str)
string decode (const std::string &str)
void EnableDefault (HWND hDlg, int ID)
void DisableDefault (HWND hDlg, int ID)
void populateComboWithResults (HWND hCombo)
static __inline UrlRange toUrlRange (const std::string &s)
std::list< UrlRange > listStringToListUrlRange (const std::list< std::string > &lst)
static __inline std::string toString (const UrlRange &rng)
std::list< std::string > listUrlRangeToListString (const std::list< UrlRange > &lst)
std::pair< std::string, std::string > splitString (const std::string &str, const char sep) throw (std::runtime_error)
BOOL MakeSureDirectoryPathExists (PCSTR DirPath)
 Inner version of MakeSureDirectoryPathExists.

Define Documentation

#define BUFFER_SIZE   0x1000
 


Function Documentation

string decode const std::string &  str  ) 
 

void DisableDefault HWND  hDlg,
int  ID
 

void EnableDefault HWND  hDlg,
int  ID
 

string encode const std::string &  str  ) 
 

const std::string& getAbuseDataPath  )  throw (std::runtime_error)
 

const std::string& getAbuseExePath  ) 
 

RECT getDlgItemRect HWND  hDlg,
DWORD  id
throw (SysError)
 

string getOpenFileName HWND  hOwner,
const std::string &  initial,
const char *  patterns,
const string &  title
 

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

string getWindowText HWND  hWnd  ) 
 

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

OPENFILENAME internalInitFileName HWND  hOwner,
const std::string &  initial,
const char *  patterns,
const string &  title
 

bool isNtKernel  ) 
 

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 > &  lst  ) 
 

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

void populateComboWithResults HWND  hCombo  ) 
 

std::pair<std::string,std::string> splitString const std::string &  str,
const char  sep = '-'
throw (std::runtime_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

static __inline std::string toString const UrlRange &  rng  )  [static]
 

static __inline UrlRange toUrlRange const std::string &  s  )  [static]
 


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