Main Page   Compound List   File List   Compound Members  

Patch Class Reference

Representation of a kernel patch. More...

#include <Patch.hpp>

List of all members.

Public Methods

 Patch ()
 Create, but init nothing.

 Patch (unsigned char *data, unsigned short len, unsigned int addr)
 Create a patch with supplied data. More...

 Patch (unsigned char *data, unsigned short len, unsigned int addr, rwKernel *x)
 Create a patch with supplied data. More...

 Patch (string)
 Initialize the object from a string as created by dump (). More...

 Patch (string, rwKernel *)
 Initialize the object from a string as created by dump (). More...

 ~Patch ()
 Foo.

void initFromString (string)
 init object from a string.

string getPatchAsString ()
 Foo.

bool wasChanged ()
 tells you if the patch data was modified. More...

bool isLinked ()
bool isApplied ()
bool isFailed ()
bool isClean ()
int getState ()
void restore ()
 Restore patch data. More...

bool remove ()
 Remove applied Patch (Undo changes done to memory).

bool remove (rwKernel *)
 Remove applied Patch (Undo changes done to memory).

unsigned char * getData ()
 Get a pointer to patch data.

void apply (rwKernel *)
 Apply the patch to the kernel. More...

void apply ()
 Apply the patch to the kernel. More...

void link (Addr2AddrList *)
 link the patch with the kernel. More...

void dump (string file)
 Dump patch information into a file. More...


Friends

istream & operator>> (istream &, Patch &)
 Foo.

ostream & operator<< (ostream &, Patch &)
 Foo.


Detailed Description

Representation of a kernel patch.

A Patch is a amount of data, which is to be written to a given address. Patching means modification of kernel memory. Therefore, the data, which will be overwritten, is saved (before writting). Additionally the status of the Patch is tracked. Thus, you are able to undo, reapply and debug patches. The states a Patch must be in are: CLEAN (the patch was never touched) LINKED (it was linked without an error) APPLIED (it was applied without an error) LFAILED (linking failed) AFAILED (applying failed)


Constructor & Destructor Documentation

Patch::Patch unsigned char * data,
unsigned short len,
unsigned int addr
 

Create a patch with supplied data.

Parameters:
data   patch data.
len   length of patch data.
addr   memory address to where the data shall be written.

Patch::Patch unsigned char * data,
unsigned short len,
unsigned int addr,
rwKernel * x
 

Create a patch with supplied data.

This constructor, compared with the above, will set a local reference to a rwKernel object.

Parameters:
x   pointer to a rwKernel object.

Patch::Patch string
 

Initialize the object from a string as created by dump ().

See also:
dump()

Patch::Patch string ,
rwKernel *
 

Initialize the object from a string as created by dump ().

See also:
dump()


Member Function Documentation

void Patch::apply
 

Apply the patch to the kernel.

Use this apply method if you supplied a reference to a rwKernel object at creation time.

void Patch::apply rwKernel *
 

Apply the patch to the kernel.

Effectivly write the patch data to the supplied address. The method allows you to supply a a reference to a rwKernel object. you can supply on construction of the patch. However, there might be none at that time.

void Patch::dump string file
 

Dump patch information into a file.

This will produce human readable output. It can be used e.g. for restoring and debugging. Because the output is line based and can be used to initialize a Patch object you are effecitvely able to reproduce patching sessions.

See also:
Patch(string)
Parameters:
file   filename.

int Patch::getState
 

Returns:
the status.

bool Patch::isApplied
 

Returns:
true if the applying was successful.

bool Patch::isClean
 

Returns:
true if the patch was not touched.

bool Patch::isFailed
 

Returns:
true if linking or applying failed.

bool Patch::isLinked
 

Returns:
true if the linking returned no error messages.

void Patch::link Addr2AddrList *
 

link the patch with the kernel.

Replace all placeholders with real addresses.

void Patch::restore
 

Restore patch data.

Might be helpful if linking failed.

bool Patch::wasChanged
 

tells you if the patch data was modified.

(e.g. by linking).

Returns:
true if backup data and data differ.


The documentation for this class was generated from the following file:
Generated at Tue Aug 14 18:04:51 2001 for Kermit by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001