static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { if (! initialize(pids, L"BLR.exe", L"pbcl.dll")) return false; if (refreshPointers()) { // unlink plugin if this fails *prev_hostipport = '\0'; float avatar_pos[3], avatar_front[3], avatar_top[3]; float camera_pos[3], camera_front[3], camera_top[3]; std::string context; std::wstring identity; if (fetch(avatar_pos, avatar_front, avatar_top, camera_pos, camera_front, camera_top, context, identity)) { *prev_hostipport = '\0'; // we need to do this again since fetch() above overwrites this (which results in empty context until next change) return true; } } generic_unlock(); return false; }
void WeatherPlugin::timeout() { if (!getSocketFactory()->isActive() || !isDone() || (*getID() == 0)) return; time_t now; time(&now); if ((unsigned)now < getTime() + CHECK1_INTERVAL) return; m_bForecast = false; if ((unsigned)now >= getForecastTime() + CHECK2_INTERVAL) m_bForecast = true; string url = "http://xoap.weather.com/weather/local/"; url += getID(); url += "?cc=*&prod=xoap&par=1004517364&key=a29796f587f206b2&unit="; url += getUnits() ? "s" : "m"; if (m_bForecast && getForecast()){ url += "&dayf="; url += number(getForecast()); } fetch(url.c_str()); }
/* Return a list of tag names from a list of tag id's (<id_list>), sorted case-insensitively */ QStringList tags_repository::names_list(std::list<uint>& id_list) { if (!m_tags_map_fetched) { fetch(); } QStringList result; std::map<int,message_tag>::const_iterator iterm; std::list<uint>::const_iterator iterl = id_list.begin(); QMap<QString, QString> m; for (; iterl != id_list.end(); ++iterl) { iterm = m_tags_map.find((int)*iterl); if (iterm != m_tags_map.end()) { QString tag = tags_repository::hierarchy(iterm->second.id()); m.insert(tag.toLower(), tag); } } // this returns the strings in the order of the map according to // Qt's documentation return m.values(); }
/* print out the help page for -T flag */ static void do_help(void) { struct Probes *pr; printf("usage:"); for (pr=list; pr->cmd; pr++) { printf("\tlilo -T %s%s\t%s\n", pr->cmd, pr->str ? pr->str : " ", pr->help); } #ifdef DEBUG printf(" In some cases, the '-v' flag will produce more output.\n"); printf("sizeof(video_t) = %d sizeof(floppy_t) = %d sizeof(hard_t) = %d\n" "sizeof(edd_t) = %d sizeof(buf.s) = %d\n", sizeof(video_t), sizeof(floppy_t), sizeof(hard_t), sizeof(edd_t), sizeof(buf.s) ); printf("fetch returns %d\n", fetch()); #endif }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { if (! initialize(pids, L"Gw.exe")) return false; float cam[3], pos[3], front[3],camfront[3], top[3], camtop[3]; std::string context; std::wstring identity; prev_areaid = 0; prev_location = 0; if (fetch(pos, front, top, cam, camfront, camtop, context, identity)) { prev_areaid = 0; prev_location = 0; // we need to do this again since fetch() above overwrites this (which results in empty context until next change) return true; } else { generic_unlock(); return false; } }
void LiveJournalClient::send() { if ((m_requests.size() == 0) || m_request) return; m_request = m_requests.front(); m_requests.erase(m_requests.begin()); string url; url = "http://"; url += getServer(); if (getPort() != 80){ url += ":"; url += number(getPort()); } url += getURL(); string headers = "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: "; headers += number(m_request->m_buffer.size()); if (getFastServer()) headers += "\r\nCookie: ljfastserver=1"; m_fetchId = fetch(this, url.c_str(), &m_request->m_buffer); }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { posptr = NULL; if (! initialize(pids, L"arma2.exe")) return false; /* BYTE bState; peekProc((BYTE *) 0x00BF64D0, &bState, 1); if (bState == 0) return false; */ /* Comment out code we don't need BYTE *pModule=getModuleAddr(L"<module name, if you need it>.dll"); if (!pModule) */ BYTE *ptr1 = peekProc<BYTE *>((BYTE *) 0x00C500FC); BYTE *ptr2 = peekProc<BYTE *>(ptr1 + 0x88); BYTE *base = ptr2 + 0x10; posptr = base + 0x18; frontptr = base; topptr = base + 0xC; float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3]; std::string context; std::wstring identity; if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) { return true; } else { generic_unlock(); return false; } }
void SkypeFunctions::showContactList(wxListCtrl *contactList){ contactList->DeleteAllItems(); MyContactGroup::Ref skypeNamesContactGroup; if (!skype->GetHardwiredContactGroup(ContactGroup::ONLINE_BUDDIES, skypeNamesContactGroup)) throw SkypeException("Can't obtain contacts. (GetHardwiredContactGroup)\n"); if (!skypeNamesContactGroup->GetContacts(skypeNamesContactGroup->contactList)) throw SkypeException("Can't obtain contacts. (GetContacts)\n"); fetch(skypeNamesContactGroup->contactList); for (uint i = 0; i < skypeNamesContactGroup->contactList.size(); i++) { SEString id; if (!skypeNamesContactGroup->contactList[i]->GetIdentity(id)) throw SkypeException("Can't obatin contact id.\n"); SEString contactName; if (!skypeNamesContactGroup->contactList[i]->GetPropDisplayname(contactName)) throw SkypeException("Can't obtain contact name.\n"); SEString statusAsText; Contact::AVAILABILITY availability; if (!skypeNamesContactGroup->contactList[i]->GetPropAvailability(availability)) throw SkypeException("Cant obtain contact availability.\n"); statusAsText = tostring(availability); std::string auxS = (const char*) contactName; std::string auxS2 = (const char*) statusAsText; std::string auxS3 = (const char*) id; std::string status = "Contact::AVAILABILITY."; auxS2 = auxS2.substr(status.size(), auxS2.size()); wxString auxWXS(auxS.c_str(), wxConvUTF8); wxString auxWXS2(auxS2.c_str(), wxConvUTF8); wxString auxWXS3(auxS3.c_str(), wxConvUTF8); long itemIndex = contactList->InsertItem(0, auxWXS3); contactList->SetItem(itemIndex, 1, auxWXS2); contactList->SetItem(itemIndex, 2, auxWXS); }; }
int main() { char dpb[ 48 ]; int i = 0, len; long status[ 20 ]; dpb[ i++ ] = isc_dpb_version1; dpb[ i++ ] = isc_dpb_user_name; len = strlen( USER ); dpb[ i++ ] = ( char ) len; strncpy( &( dpb[ i ] ), USER, len ); i += len; dpb[ i++ ] = isc_dpb_password; len = strlen( PASSWORD ); dpb[ i++ ] = len; strncpy( &( dpb[ i ] ), PASSWORD, len ); i += len; if( isc_attach_database( status, 0, DATABASE, &db, i, dpb ) ) ERREXIT( status, 1 ); execute( "DROP TABLE TESTE" ); execute( "CREATE TABLE TESTE (code smallint)" ); execute( "INSERT INTO TESTE (code) VALUES (100)" ); query( "SELECT * FROM TESTE" ); while( fetch() == 0 ) printf( "%s\n", getdata( 0 ) ); qclose(); if( isc_detach_database( status, &db ) ) ERREXIT( status, 1 ); return 1; }
int main(int argc, const char * argv[]) { FILE *file = fopen("mcode.txt", "r" ); // stack_str = malloc((MAX_STACK_HEIGHT + 100) * sizeof(char)); /* fopen returns 0, the NULL pointer, on failure */ if ( file == 0 ) { printf( "Could not open file\n" ); exit(1); } fillCode( file ); fclose( file ); file = fopen("stacktrace.txt","w"); if ( file == NULL) { printf("Could not open file\n"); exit(1); } printCode( file ); fprintf(file, "Line OP L M pc bp sp stack \n"); fprintf(file, "----------------------------------------\n"); fprintf(file, "Init Values: 0 1 0 \n"); /*instruction cycle*/ //while instruction is not halt while ( halt == 0) { fetch(); execute(); printInstructionTrace(file); } fclose( file ); }
// // Fetch all metric values across all gadgets, and also update the // unified time axis. // void GroupControl::step(QmcTime::Packet *packet) { double stepPosition = __pmtimevalToReal(&packet->position); console->post(PmChart::DebugProtocol, "GroupControl::step: stepping to time %.2f, delta=%.2f, state=%s", stepPosition, my.realDelta, timeState()); if ((packet->source == QmcTime::ArchiveSource && ((packet->state == QmcTime::ForwardState && my.timeState != ForwardState) || (packet->state == QmcTime::BackwardState && my.timeState != BackwardState))) || sideStep(stepPosition, my.realPosition, my.realDelta)) return adjustWorldView(packet, false); my.pmtimeState = packet->state; my.position = packet->position; my.realPosition = stepPosition; int last = my.samples - 1; if (packet->state == QmcTime::ForwardState) { // left-to-right (all but 1st) if (my.samples > 1) memmove(&my.timeData[1], &my.timeData[0], sizeof(double) * last); my.timeData[0] = my.realPosition; } else if (packet->state == QmcTime::BackwardState) { // right-to-left if (my.samples > 1) memmove(&my.timeData[0], &my.timeData[1], sizeof(double) * last); my.timeData[last] = my.realPosition - torange(my.delta, last); } fetch(); bool active = isActive(packet); if (isActive(packet)) newButtonState(packet->state, packet->mode, pmchart->isTabRecording()); refreshGadgets(active); }
static void test_load (mongoc_client_t *client, unsigned iterations) { mongoc_collection_t *col; mongoc_database_t *db; bson_error_t error; unsigned i; bson_t b; bson_t q; bson_init(&b); bson_append_int32(&b, "ping", 4, 1); bson_init(&q); db = mongoc_client_get_database(client, "admin"); col = mongoc_client_get_collection(client, "test", "test"); for (i = 0; i < iterations; i++) { ping(db, &b); fetch(col, &q); } if (!mongoc_collection_drop(col, &error)) { MONGOC_WARNING("Failed to drop collection: %s", error.message); } mongoc_database_destroy(db); db = mongoc_client_get_database(client, "test"); if (!mongoc_database_drop(db, &error)) { MONGOC_WARNING("Failed to drop database: %s", error.message); } mongoc_database_destroy(db); mongoc_collection_destroy(col); bson_destroy(&b); }
void Send::start(QStringList &arguments) { SEStringList list; QStringList Arguments(arguments); QString blob, message; MyConversation::Refs inbox; MyConversation::Ref sconv; if (Arguments.size() != 2) { emit finished(new Response(false,"invalid arguments")); return; } blob = Arguments[0]; message = Arguments[1]; //std::cout << " room: " << (const char *)blob.toLocal8Bit() << std::endl << " message: " << (const char *)message.toLocal8Bit() << std::endl; skype->GetConversationList(inbox, Conversation::INBOX_CONVERSATIONS); fetch(inbox); for (int i = 0; i < inbox.size();i++) { SEString displayName; sconv = inbox[i]; sconv->GetPropDisplayname(displayName); if (strcmp((const char *)displayName,(const char *)blob.toLocal8Bit()) == 0) { //std::cout << (const char *)displayName << std::endl; Message::Ref rep; sconv->PostText((const char *)message.toLocal8Bit(), rep, false); emit finished(new Response(true,"ok")); return; } } emit finished(new Response(false,"not found")); }
void hp_nanoprocessor_device::execute_run() { do { // Check for interrupts (interrupt line is always enabled. Masking is done // outside of the NP, usually by ANDing the DC7 line with the interrupt // request signal) if (BIT(m_flags , NANO_I_BIT)) { m_reg_ISR = m_reg_PA; m_reg_PA = (uint16_t)(standard_irq_callback(0) & 0xff); dc_clr(HP_NANO_IE_DC); // Vector fetching takes 1 cycle m_icount -= 1; } else { debugger_instruction_hook(this , m_reg_PA); uint8_t opcode = fetch(); execute_one(opcode); // All opcodes execute in 2 cycles m_icount -= 2; } } while (m_icount > 0); }
void run_armsim() { while(ex_flag!=1) { b_flag=0; fetch(); decode(); execute(); if(ex_flag==1) {return ;} //if(control==17&&u==5) ////////// // return; ///////////// if(b_flag==1) continue; mem(); write_back(); } return; }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { if (!initialize(pids, L"BF2142.exe")) // Retrieve game executable's memory address return false; RendDX9 = getModuleAddr(L"RendDX9.dll"); // Retrieve "RendDX9.dll" module's memory address // This prevents the plugin from linking to the game in case something goes wrong during module's memory address retrieval. if (!RendDX9) return false; // Check if we can get meaningful data from it float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3]; std::wstring sidentity; std::string scontext; if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { return true; } else { generic_unlock(); return false; } }
/* Return the name of the tag including its parent hierarchy */ QString tags_repository::hierarchy(int id, QString sep) { if (!m_tags_map_fetched) { fetch(); } std::map<int,message_tag>::const_iterator i; i = m_tags_map.find(id); if (i == m_tags_map.end()) return ""; QString s; int parent_id = i->second.parent_id(); if (parent_id) { s = hierarchy(parent_id, sep); s.append(sep); s.append(i->second.name()); } else s = i->second.name(); return s; }
Service::Result Service::fetch() { Result result; result.first = false; std::string url = apiUrl; url += methodName(); for (auto &arg : m_arguments) { url += "&"; url += arg.first; url += "="; url += Curl::escape(arg.second); } std::string data; CURLcode code = Curl::perform(data, url); if (code != CURLE_OK) result.second = curl_easy_strerror(code); else if (actionFailed(data)) result.second = msgInvalidResponse; else { result = processData(data); // if relevant part of data was not found and one of arguments // was language, try to fetch it again without that parameter. // otherwise just report failure. if (!result.first && !m_arguments["lang"].empty()) { m_arguments.erase("lang"); result = fetch(); } } return result; }
void WideVM::runVmProgram(VMLocation loc, int b, int e) { m_begin = (b == -1)?0:b; m_end = (e == -1)?particleCount():e; if(loc.Location == -1) loc.Location = findStrInVector(loc.Name, m_prognames); if(loc.Location == -1) return; m_programcounter = m_subprograms[loc.Location]; while(m_programcounter < m_program.size()) { startLoop(); //in case an opcode uses while loopParticle init counter for it const int opcode = fetch(); switch(opcode) { case EVO_QUIT: opQuit(); break; case EVO_SIN: opSin(); break; case EVO_COS: opCos(); break; case EVO_COPY: opCopy(); break; case EVO_RAND2: opRand2(); break; case EVO_MATH2: opMath2(); break; } //switch opcodes pc } //while pc < opcodes size }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { faceptr = topptr = 0; if (! initialize(pids, L"BF1942.exe")) return false; procptr_t ptr1 = peekProcPtr(0x009A9468); procptr_t ptr2 = peekProcPtr(ptr1 + 0x98); faceptr = ptr2 + 0x5C; topptr = ptr2 + 0x4C; float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3]; std::string context; std::wstring identity; if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) { return true; } else { generic_unlock(); return false; } }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { if (! initialize(pids, L"UnrealTournament.exe", L"Engine.dll")) return false; BYTE* base = pModule + 0x290584; posptr = base; frtptr = base + 0x0C; topptr = base + 0x18; // Check if we can get meaningful data from it float apos[3], afront[3], atop[3]; float cpos[3], cfront[3], ctop[3]; std::wstring sidentity; std::string scontext; if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) { return true; } else { generic_unlock(); return false; } }
int jz_op ( ) { Address offset; descriptor *d; d = pop ( ); d = CoerceData (deref (d), T_Double); offset = fetch (pc ++).addr; if (D_Type (d) != T_Double) { TypeError ("in conditional context", d, NULL, NULL, F_False); RecycleData (d); return 1; } if (*D_Double (d) == 0) pc += offset; RecycleData (d); return 0; }
void lc8670_cpu_device::execute_run() { if (m_clock_changed) { change_clock_source(); return; } do { check_irqs(); debugger_instruction_hook(this, m_pc); int cycles = 0; m_ppc = m_pc; if (REG_PCON & HALT_MODE) { // in HALT state the timers are still updated cycles = 1; } else { // instruction fetch m_op = fetch(); int op_idx = decode_op(m_op); // execute the instruction cycles = (this->*s_opcode_table[op_idx])(); } // update the instruction counter m_icount -= cycles; } while (m_icount > 0 && !m_clock_changed); }
int main(int argc, char *argv[]) { int choice; int value; int index; while(1) { printf("What do you want to do?\n\n"); printf("1. Insert \n2. Fetch \n3. display \n4. Remove\n5. Exit\n"); scanf("%d", &choice); switch(choice) { case 1: printf("\nEnter the value you want to insert!\n"); scanf("%d", &value); insert(value); printf("\nInserted the value %d into linkedList\n", value); break; case 2: printf("\nValue at what index you want to fetch\n"); scanf("%d", &index); value = fetch(index); printf("\nValue at index %d is %d\n", index, value); //need to fetch real value break; case 3: display(); break; case 4: removee(); break; case 5: printf("\nExiting...\n"); exit(0); default: break; } } }
FetchClient::FetchClient(const char *url_str, Buffer *postData, const char *headers, bool bRedirect) { m_id = ++FetchManager::manager->m_id; FetchManager::manager->m_clients.push_back(this); m_socket = NULL; m_bDone = false; m_post = postData; m_state = None; m_code = 0; m_size = UNKNOWN_SIZE; m_bRedirect = bRedirect; m_uri = url_str; #ifdef WIN32 m_thread = NULL; #endif if (headers){ for (const char *h = headers; *h; h += strlen(h) + 1){ string header = h; string key = getToken(header, ':'); unsigned n; for (n = 0; n < header.length(); n++) if (header[n] != ' ') break; header = header.substr(n); addHeader(key.c_str(), header.c_str()); } } #ifdef WIN32 m_errCode = 0; if (hInet){ m_thread = new FetchThread(this); m_thread->start(); return; } #endif fetch(); }
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) { posptr = faceptr = topptr = NULL; if (! initialize(pids, L"BF2142.exe", L"BF2142Audio.dll")) return false; BYTE *cacheaddr = pModule + 0x4745c; BYTE *cache = peekProc<BYTE *>(cacheaddr); posptr = peekProc<BYTE *>(cache + 0xc0); faceptr = peekProc<BYTE *>(cache + 0xc4); topptr = peekProc<BYTE *>(cache + 0xc8); float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3]; std::string context; std::wstring identity; if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) { return true; } else { generic_unlock(); return false; } }
void UtubeData::init() { mHttp = new QHttp(this); connect(mHttp, SIGNAL(readyRead(const QHttpResponseHeader &)), this, SLOT(readData(const QHttpResponseHeader &))); connect(mHttp, SIGNAL(requestFinished(int, bool)), this, SLOT(finished(int, bool))); if (PlexyDesk::Config::getInstance()->m_proxyOn) { QNetworkProxy NtProxy(PlexyDesk::Config::getInstance()->proxyType, PlexyDesk::Config::getInstance()->proxyURL, PlexyDesk::Config::getInstance()->m_proxyPort, PlexyDesk::Config::getInstance()->proxyUser, PlexyDesk::Config::getInstance()->proxyPasswd); mHttp->setProxy(NtProxy); QNetworkProxy::setApplicationProxy(NtProxy); qDebug() << "UtubeData::init()" << "Proxy state" << PlexyDesk::Config::getInstance()->m_proxyOn << endl; } fetch(); }
bool FetchClient::error_state(const char *err, unsigned) { if (m_state == Redirect){ delete m_socket; m_socket = NULL; m_code = 0; m_hIn = ""; m_res.init(0); if (m_post){ delete m_post; m_post = NULL; } m_state = None; fetch(); return false; } if ((m_state == Data) && (m_size == UNKNOWN_SIZE)) return true; if (*err){ m_code = 0; log(L_DEBUG, "HTTP: %s", err); } return true; }
void UpdatePlugin::timeout() { if (!getSocketFactory()->isActive() || m_fetch_id) return; time_t now; time(&now); if ((unsigned)now >= getTime() + CHECK_INTERVAL){ string url = "http://sim.shutoff.ru/cgi-bin/update.pl?v=" VERSION; #ifdef WIN32 url += "&os=1"; #endif #ifdef CVS_BUILD url += "&cvs="; for (const char *p = __DATE__; *p; p++){ if (p == ' '){ url += "%20"; continue; } url += *p; } #endif m_fetch_id = fetch(NULL, url.c_str()); } }
IoStatus SwapSpace::fetchNextBuffer(void) { IoStatus status = (numSwap_ > 0) ? checkIO() : END_OF_DATA; if ((status == OK) && (swapStart_ != swapEnd_)) { if (swapRead_ != swapEnd_) { swapRead_ += swapBufferSize_; } if (swapRead_ < swapEnd_) { status = fetch(); // status == OK if read initiated } else { atEOF_ = true; status = END_OF_DATA; } } return status; }