TVerdict CCommsdat151Step::doTestStepL() /** * @return - TVerdict code * Test Notification after doing a Modify and Commit. * CED -i Z:\testdata\configs\te_commsdat_iap_table1.cfg */ { SetTestStepResult(EFail); INFO_PRINTF1(_L("CCommsdat151Step::doTestStepL() in the file commsdat151Step.cpp")); #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_2); #else CMDBSession *cmdbSession = CMDBSession::NewL(KCDVersion1_1); #endif CleanupStack::PushL(cmdbSession); // need to define P&S properties cmdbSession->PublishProperties(); cmdbSession->OpenTransactionL(); CCDIAPRecord *record = static_cast<CCDIAPRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); CleanupStack::PushL(record); record->iNetworkWeighting = KNetworkWeighting; INFO_PRINTF1(_L("Finding IAP record...")); TBool found = record->FindL(*cmdbSession); INFO_PRINTF3(_L("FindL result for record %08x was %b, should be 1"), record->ElementId(), found); if (found) { _LIT(KThreadName,"TestThread151"); CNotificationTester *tester = CNotificationTester::NewL(KThreadName, cmdbSession, record); CleanupStack::PushL(tester); TRequestStatus notified; tester->LogOn(notified); INFO_PRINTF1(_L("Set NotificationTester")); TPtrC testService(_L("Test Service")); record->iServiceType.SetMaxLengthL(testService.Length()); record->iServiceType = testService; record->ModifyL(*cmdbSession); if(tester->IsAdded()) { INFO_PRINTF1(_L("added to active scheduler")); } else { INFO_PRINTF1(_L("not added to active scheduler")); } cmdbSession->CommitTransactionL(); User::WaitForRequest (notified); TInt testEvtType = 0; RProperty::Get(KUidSystemCategory, KUidCommDbNotificationEvent.iUid, testEvtType); if(tester->iStatus == KErrNone && testEvtType == TCDNotifiableEvent::ECommit) { SetTestStepResult(EPass); } cmdbSession->Close(); CleanupStack::PopAndDestroy(tester); } else { cmdbSession->CommitTransactionL(); cmdbSession->Close(); } CleanupStack::PopAndDestroy(record); CleanupStack::PopAndDestroy(cmdbSession); return TestStepResult(); }
int main(int argc, char **argv) { //mode //1 = only execute memchunkhax2 //2 = only execute service call //3 = execute memchunkhax2 and service call afterwards //4 = execute all u8 mode = 4; u8 success; const char* service = "am:u"; gfxInitDefault(); consoleInit(GFX_TOP, NULL); if (mode == 1) { // Run the exploit success = execute_memchunkhax2(); printf("Exploit returned: %s\n", success ? "Success!" : "Failure."); } if (mode == 2) { testService(service); } if (mode == 3) { // Run the exploit success = execute_memchunkhax2(); printf("Exploit returned: %s\n", success ? "Success!" : "Failure."); testService(service); } if (mode == 4) { // This one should fail testService(service); // Run the exploit success = execute_memchunkhax2(); printf("Exploit returned: %s\n", success ? "Success!" : "Failure."); // This one hopefully won't testService(service); } printf("Press START to reboot.\n"); printf("Press SELECT to (try to) exit.\n"); u8 debugFirst = 1; while(aptMainLoop()) { hidScanInput(); if (debugFirst == 1) { printf("entered loop"); debugFirst = 0; } if(hidKeysDown() & KEY_SELECT) { break; } if(hidKeysDown() & KEY_START) { //Reboot console aptOpenSession(); APT_HardwareResetAsync(); aptCloseSession(); } gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } gfxExit(); return 0; }