📄 mguardmain.cpp,v
字号:
head 1.2;access;symbols v1_0:1.1.1.2 xueyw:1.1.1 v111:1.1.1.2 MGuard:1.1.1 arelease:1.1.1.1 avendor:1.1.1;locks; strict;comment @// @;1.2date 2007.07.30.13.22.37; author administrator; state Exp;branches;next 1.1;deltatype text;permissions 644;commitid e9046ade61b0f8d;kopt kv;filename @MGuardMain.cpp@;1.1date 2007.07.24.10.59.30; author administrator; state Exp;branches 1.1.1.1;next ;deltatype text;permissions 644;1.1.1.1date 2007.07.24.10.59.30; author administrator; state Exp;branches;next 1.1.1.2;deltatype text;permissions 644;1.1.1.2date 2007.08.22.11.31.31; author administrator; state Exp;branches;next ;deltatype text;permissions 644;commitid 81046cc1e913f93;kopt kv;filename @MGuardMain.cpp@;desc@@1.2log@remove global capture@text@/** ============================================================================* Name : MGuardMain.cpp* Part of : MGuardMain* Created : 18.07.2007 by xueyw* Description:* Exe source file* Version :* Copyright: * ============================================================================*/// Include Files #include <e32base.h>#include <e32std.h>#include <e32cons.h> #include "MGuardMain.h"#include "MGuardMsgConsole.h"#include "MGuardKeyCapture.h"#include "MGuardConst.h"#include "MGuardState.h"#include "MGuardCommand.h"_LIT(KTextConsoleTitle, "Console");_LIT(KTextFailed, " failed, leave code = %d");_LIT(KTextPressAnyKey, " [press any key]\n");// Global VariablesLOCAL_D CMsgConsole* msgConsole; //LOCAL_D CGuardKeyCapturer capturer;LOCAL_D CConsoleBase* console; // write all messages to this// Local FunctionsLOCAL_C void MainL( const TDesC& /*aArgs*/ ){ // Create capturer console->Printf( _L("before capture")); CGuardKeyCapturer& capturer = CGuardKeyCapturer::GetInstance(); //CleanupStack::PushL( capturer ); console->Printf( _L("before console")); msgConsole = CMsgConsole::NewL( console ); // And start message capturing msgConsole->DoReceiveSMSL(); // And start capturing // Check if we should start capturer if ( CMGuardState::GetLockState() && !capturer.IsCatpureStarted() ) { capturer.StartCapturingL(); } CActiveScheduler::Start(); // Cleanup. Demo completed //CleanupStack::PopAndDestroy( capturer );}LOCAL_C void DoStartL(){ // Create active scheduler (to run active objects) CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); // Call main function with command line TBuf<256> cmdLine; RProcess().CommandLine(cmdLine); MainL(cmdLine); // Delete active scheduler CleanupStack::PopAndDestroy(scheduler);}// Global FunctionsGLDEF_C TInt E32Main(){ // Create cleanup stack CTrapCleanup* cleanup = CTrapCleanup::New(); // Create output console TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen))); if (createError) return createError; // Run application code inside TRAP harness, wait keypress when terminated TRAPD(mainError, DoStartL()); if (mainError) console->Printf(KTextFailed, mainError); console->Printf(KTextPressAnyKey); console->Getch(); delete console; delete cleanup; return KErrNone;}// End of file@1.1log@Initial revision@text@d25 1d34 1a34 1LOCAL_D CGuardKeyCapturer* capturer;d42 1a42 1 capturer = new (ELeave)CGuardKeyCapturer();d46 1a46 1 msgConsole = CMsgConsole::NewL( capturer, console );d54 1a54 1 !capturer->IsCatpureStarted() )d56 1a56 1 capturer->StartCapturingL();@1.1.1.1log@no message@text@@1.1.1.2log@no message@text@d5 1a5 1* Created : 13.08.2007 by xueywa15 3#include "MGuardMain.h"#include "MGuardMsgConsole.h"#include "MGuardScReqHandler.h"d18 1a18 4#include <e32cons.h> //#include <etelagsm.h>#include <plpvariant.h>d20 9a28 3// Constants_LIT(KTextConsoleTitle, "MGuardConsole");d32 3a34 2LOCAL_D CConsoleBase* console; d37 1a37 1LOCAL_C void MainL(const TDesC& /*aArgs*/)d39 4a42 62 // Get subscriber // try first to read the IMSI ////RTelServer iServer; ////RAdvGsmPhone iPhone; ////RTelServer::TPhoneInfo info; ////// Connect to the telephony server and load the TSY. ////User::LeaveIfError(iServer.Connect()); ////CleanupClosePushL(iServer); ////_LIT(KTsyName, "phonetsy.tsy"); ////User::LeaveIfError(iServer.LoadPhoneModule(KTsyName)); ////// Get the details for the first (and only) phone. ////User::LeaveIfError(iServer.GetPhoneInfo(0, info)); ////// Open the phone. ////User::LeaveIfError(iPhone.Open(iServer, info.iName)); ////CleanupClosePushL(iPhone); ////TRequestStatus status; ////MAdvGsmPhoneInformation::TSubscriberId myId; ////// get the imsi ////iPhone.GetSubscriberIdNS(status, myId); //////_LIT8(KFormatDecimal, "size of subscriberId:%u"); //////TBuf8<200> imeiString; //////imeiString.Format(KFormatDecimal,myId.Length()); ////// trace it ReportMessage(imeiString); ////TBuf<200> aValue; ////TInt i=0; ////aValue.Zero(); //////_LIT8(KFlwFormat,"%u"); ////for(i=0; i<myId.Length();i++) ////{ //// aValue.Append(myId[i]); ////} ////// ////CleanupStack::PopAndDestroy(&iPhone); ////User::LeaveIfError(iServer.UnloadPhoneModule(KTsyName)); ////CleanupStack::PopAndDestroy(&iServer); ////console->Printf( aValue ); TBuf<20> aImei;#ifndef __WINS__ // This only works on target machine TPlpVariantMachineId imei; PlpVariant::GetMachineIdL(imei); aImei.Copy(imei);#else // Return a fake IMEI when working on emulator _LIT(KEmulatorImei, "000000000000000"); aImei.Copy(KEmulatorImei);#endif console->Write( aImei ); CMsgConsole* msgConsole = CMsgConsole::NewL( console );d44 2d47 1a47 1 msgConsole->DoInterceptL();a48 5 RFs fs; User::LeaveIfError( fs.Connect() ); TFindFile findFile( fs ); CMGuardScReqHandler* aHandler = NULL; if ( KErrNone == findFile.FindByDir( _L("c:\\MGuardCapture.log"), KNullDesC ) ) d50 4d55 1a55 2 aHandler = aHandler = CMGuardScReqHandler::NewL( *msgConsole ); aHandler->RequestLock();a56 1 fs.Close();a57 9 // And start capturing // Check if we should start capturer //CMGuardScReqHandler* aHandler = aHandler = CMGuardScReqHandler::NewL( *msgConsole ); // aHandler->RequestLock(); //if ( !CMGuardState::GetLockState() ) //{ // aHandler->RequestUnlock(); //}d61 2a62 5 delete msgConsole; if ( aHandler ) { delete aHandler; }a83 1a86 1 __UHEAP_MARK;a87 1d93 1a93 1 // Run application code inside TRAP harnessd95 4d102 1a102 1 __UHEAP_MARKEND;@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -